update new doc members

This commit is contained in:
Theis Pieter Hollebeek 2025-10-15 12:19:46 +02:00
parent f8bdaf73ea
commit 89756c2a5e

View File

@ -327,21 +327,33 @@ lib.startGameLoop(function () {
});
```
Note: Sprite images have to be loaded. This is done asynchronously, meaning a sprite might not appear on the canvas after the first call to `drawSprite`.
Note: Sprite images have to be loaded. This is done asynchronously, meaning a sprite might not
appear on the canvas after the first call to `drawSprite`.
Note: The sprite images are cached internally on it's `name`, `width` and `height` property. If these are values are different between calls, new sprite images will be loaded. This means that after a resize, the sprite may not appear immediately.
Note: The sprite images are cached internally on it's `name`, `width` and `height` property. If
these are values are different between calls, new sprite images will be loaded. This means that
after a resize, the sprite may not appear immediately.
### `drawSpriteRotated`
```ts
lib.drawSpriteRotated(x: number, y: number, width: number, height: number, name: string, angle: number) -> void
lib.drawSpriteRotated(
x: number,
y: number,
width: number,
height: number,
name: string,
angle: number
) -> void
```
Same as `drawSprite`, but the sprite is rotate according to the `angle` parameter, specified in radians (meaning a full rotation is `2 * Math.PI`.) The sprite is rotated around the **center**.
Same as `drawSprite`, but the sprite is rotated according to the `angle` parameter, specified in
radians (meaning a full rotation is `2 * Math.PI`.) The sprite is rotated around the **center**.
Note: Angles have a granularity/precision of 360 steps per rotation. This is becuse sprite images are cached internally on `angle` in addition to `name`, `width` and `height`.
Note: Angles have a granularity/precision of 360 steps per rotation. This is because sprite images
are cached internally on `angle` in addition to `name`, `width` and `height`.
See also [`drawSprite`](#Lib-drawSprite).
See also: [`drawSprite`](#Lib-drawSprite)
### `drawRect`
@ -370,15 +382,23 @@ lib.startGameLoop(function () {
### `drawLine`
```ts
lib.drawLine(x0: number, y0: number, x1: number, y1: number, thickness: number, color: string) -> void
lib.drawLine(
x0: number, y0: number,
x1: number, y1: number,
thickness: number,
color: Color
) -> void
```
Draws a line.
Draws a line from `(x0, y0)` to `(x1, y1)`, with a thickness of `thickness` and a
[Color](#Models-Color).
See also: [`Models.Color`](#Models-Color)
### `drawPath`
```ts
lib.drawPath(path: [number, number][], color: string) -> void
lib.drawPath(path: [number, number][], color: Color) -> void
```
Fills an arbitrary polygon with [`Color`](#Models-Color).
@ -396,15 +416,17 @@ lib.drawPath([
Note: The `path` array must contain at minimum 1 element.
See also: [`Models.Color`](#Models-Color)
### `drawPathLine`
```ts
lib.drawPathLine(path: [number, number][], thickness: number, color: string) -> void
lib.drawPathLine(path: [number, number][], thickness: number, color: Color) -> void
```
Draws the outline of an arbitrary polygon.
See also [`drawPath`](#Lib-drawPath).
See also: [`drawPath`](#Lib-drawPath), [`drawLine`](#Lib-drawLine)
### `onMouseMove`
@ -525,4 +547,4 @@ The opposite of [`lib.onClick`](#Lib-onClick)
`lib.MouseButton.Left`, `lib.MouseButton.Right`, `lib.MouseButton.Middle`
A method of accessing [`Model.MouseButton`](#Model-MouseButton)
A way to access [`Model.MouseButton`](#Model-MouseButton) values