Skip to content

Commit

Permalink
add binding for nostroke
Browse files Browse the repository at this point in the history
  • Loading branch information
Acepie committed Apr 25, 2024
1 parent 19c41b5 commit 8113cae
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gleam.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "p5js_gleam"
version = "2.0.0"
version = "2.0.1"
target = "javascript"

description = "A simple game library providing p5.js bindings for Gleam in a functional style to make basic games and animations. Heavily inspired by the Racket library 2htdp/universe"
Expand Down
1 change: 1 addition & 0 deletions scripts/generate_p5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const elements = {
],
fill: ["color_hex: String"],
stroke: ["color_hex: String"],
noStroke: [],
strokeWeight: ["weight: Int"],
};

Expand Down
5 changes: 5 additions & 0 deletions src/p5js_ffi.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ export function stroke(p, ...args) {
return p;
}

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

export function strokeWeight(p, ...args) {
p.strokeWeight(...args);
return p;
Expand Down
4 changes: 4 additions & 0 deletions src/p5js_gleam/bindings.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ pub fn fill(p: P5, color_hex: String) -> P5
@external(javascript, "../p5js_ffi.mjs", "stroke")
pub fn stroke(p: P5, color_hex: String) -> P5

/// A binding to the p5.js `noStroke` function. Takes a p5 instance and the function's arguments and returns the p5 instance.
@external(javascript, "../p5js_ffi.mjs", "noStroke")
pub fn no_stroke(p: P5) -> P5

/// A binding to the p5.js `strokeWeight` function. Takes a p5 instance and the function's arguments and returns the p5 instance.
@external(javascript, "../p5js_ffi.mjs", "strokeWeight")
pub fn stroke_weight(p: P5, weight: Int) -> P5

0 comments on commit 8113cae

Please sign in to comment.