Skip to content

Commit

Permalink
fix rectangle binding
Browse files Browse the repository at this point in the history
  • Loading branch information
Acepie committed Apr 20, 2024
1 parent b8791ed commit d2c7f75
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion scripts/generate_p5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const elements = {
"height: Float",
],
circle: ["x_center: Float", "y_center: Float", "radius: Float"],
rectangle: [
rect: [
"top_left_x: Float",
"top_left_y: Float",
"width: Float",
Expand Down
4 changes: 2 additions & 2 deletions src/p5js_ffi.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ export function circle(p, ...args) {
return p;
}

export function rectangle(p, ...args) {
p.rectangle(...args);
export function rect(p, ...args) {
p.rect(...args);
return p;
}

Expand Down
6 changes: 3 additions & 3 deletions src/p5js_gleam/bindings.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ pub fn ellipse(
@external(javascript, "../p5js_ffi.mjs", "circle")
pub fn circle(p: P5, x_center: Float, y_center: Float, radius: Float) -> P5

/// A binding to the p5.js `rectangle` function. Takes a p5 instance and the function's arguments and returns the p5 instance.
@external(javascript, "../p5js_ffi.mjs", "rectangle")
pub fn rectangle(
/// A binding to the p5.js `rect` function. Takes a p5 instance and the function's arguments and returns the p5 instance.
@external(javascript, "../p5js_ffi.mjs", "rect")
pub fn rect(
p: P5,
top_left_x: Float,
top_left_y: Float,
Expand Down

0 comments on commit d2c7f75

Please sign in to comment.