Skip to content

Commit

Permalink
binding doc comments now link to p5js docs directly
Browse files Browse the repository at this point in the history
  • Loading branch information
Acepie committed Apr 25, 2024
1 parent 8113cae commit c46e8f2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
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.1"
version = "2.0.2"
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
4 changes: 2 additions & 2 deletions scripts/generate_p5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ const js = (name: string) =>
`;

const gleam = (name: string, args: string[]) =>
`/// A binding to the p5.js \`${name}\` function. Takes a p5 instance and the function's arguments and returns the p5 instance.
`/// A binding to the p5.js [\`${name}\`](https://p5js.org/reference/#/p5/${name}) function. Takes a p5 instance and the function's arguments and returns the p5 instance.
@external(javascript, "../p5js_ffi.mjs", "${name}")
pub fn ${camelToSnakeCase(name)}(p: P5${args.length ? ", " : ""}${args.join(
", "
", ",
)}) -> P5
`;
Expand Down
28 changes: 14 additions & 14 deletions src/p5js_gleam/bindings.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import p5js_gleam.{type P5, type SketchConfig}
@external(javascript, "../p5js_ffi.mjs", "startSketch")
pub fn start_sketch(config: SketchConfig(model, ignored)) -> Nil

/// A binding to the p5.js `createCanvas` function. Takes a p5 instance and the function's arguments and returns the p5 instance.
/// A binding to the p5.js [`createCanvas`](https://p5js.org/reference/#/p5/createCanvas) function. Takes a p5 instance and the function's arguments and returns the p5 instance.
@external(javascript, "../p5js_ffi.mjs", "createCanvas")
pub fn create_canvas(p: P5, width: Float, height: Float) -> P5

/// A binding to the p5.js `text` function. Takes a p5 instance and the function's arguments and returns the p5 instance.
/// A binding to the p5.js [`text`](https://p5js.org/reference/#/p5/text) function. Takes a p5 instance and the function's arguments and returns the p5 instance.
@external(javascript, "../p5js_ffi.mjs", "text")
pub fn text(
p: P5,
Expand All @@ -17,15 +17,15 @@ pub fn text(
bottom_corner_y: Float,
) -> P5

/// A binding to the p5.js `textSize` function. Takes a p5 instance and the function's arguments and returns the p5 instance.
/// A binding to the p5.js [`textSize`](https://p5js.org/reference/#/p5/textSize) function. Takes a p5 instance and the function's arguments and returns the p5 instance.
@external(javascript, "../p5js_ffi.mjs", "textSize")
pub fn text_size(p: P5, size: Int) -> P5

/// A binding to the p5.js `background` function. Takes a p5 instance and the function's arguments and returns the p5 instance.
/// A binding to the p5.js [`background`](https://p5js.org/reference/#/p5/background) function. Takes a p5 instance and the function's arguments and returns the p5 instance.
@external(javascript, "../p5js_ffi.mjs", "background")
pub fn background(p: P5, color: String) -> P5

/// A binding to the p5.js `ellipse` function. Takes a p5 instance and the function's arguments and returns the p5 instance.
/// A binding to the p5.js [`ellipse`](https://p5js.org/reference/#/p5/ellipse) function. Takes a p5 instance and the function's arguments and returns the p5 instance.
@external(javascript, "../p5js_ffi.mjs", "ellipse")
pub fn ellipse(
p: P5,
Expand All @@ -35,11 +35,11 @@ pub fn ellipse(
height: Float,
) -> P5

/// A binding to the p5.js `circle` function. Takes a p5 instance and the function's arguments and returns the p5 instance.
/// A binding to the p5.js [`circle`](https://p5js.org/reference/#/p5/circle) function. Takes a p5 instance and the function's arguments and returns the p5 instance.
@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 `rect` function. Takes a p5 instance and the function's arguments and returns the p5 instance.
/// A binding to the p5.js [`rect`](https://p5js.org/reference/#/p5/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,
Expand All @@ -49,7 +49,7 @@ pub fn rect(
height: Float,
) -> P5

/// A binding to the p5.js `square` function. Takes a p5 instance and the function's arguments and returns the p5 instance.
/// A binding to the p5.js [`square`](https://p5js.org/reference/#/p5/square) function. Takes a p5 instance and the function's arguments and returns the p5 instance.
@external(javascript, "../p5js_ffi.mjs", "square")
pub fn square(
p: P5,
Expand All @@ -58,7 +58,7 @@ pub fn square(
side_length: Float,
) -> P5

/// A binding to the p5.js `line` function. Takes a p5 instance and the function's arguments and returns the p5 instance.
/// A binding to the p5.js [`line`](https://p5js.org/reference/#/p5/line) function. Takes a p5 instance and the function's arguments and returns the p5 instance.
@external(javascript, "../p5js_ffi.mjs", "line")
pub fn line(
p: P5,
Expand All @@ -68,7 +68,7 @@ pub fn line(
point2_y: Float,
) -> P5

/// A binding to the p5.js `quad` function. Takes a p5 instance and the function's arguments and returns the p5 instance.
/// A binding to the p5.js [`quad`](https://p5js.org/reference/#/p5/quad) function. Takes a p5 instance and the function's arguments and returns the p5 instance.
@external(javascript, "../p5js_ffi.mjs", "quad")
pub fn quad(
p: P5,
Expand All @@ -82,18 +82,18 @@ pub fn quad(
p4_y: Float,
) -> P5

/// A binding to the p5.js `fill` function. Takes a p5 instance and the function's arguments and returns the p5 instance.
/// A binding to the p5.js [`fill`](https://p5js.org/reference/#/p5/fill) function. Takes a p5 instance and the function's arguments and returns the p5 instance.
@external(javascript, "../p5js_ffi.mjs", "fill")
pub fn fill(p: P5, color_hex: String) -> P5

/// A binding to the p5.js `stroke` function. Takes a p5 instance and the function's arguments and returns the p5 instance.
/// A binding to the p5.js [`stroke`](https://p5js.org/reference/#/p5/stroke) function. Takes a p5 instance and the function's arguments and returns the p5 instance.
@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.
/// A binding to the p5.js [`noStroke`](https://p5js.org/reference/#/p5/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.
/// A binding to the p5.js [`strokeWeight`](https://p5js.org/reference/#/p5/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 c46e8f2

Please sign in to comment.