wrap signatures in codeblocks
This commit is contained in:
parent
ffe08fbd1e
commit
86edb2a26f
@ -162,7 +162,9 @@ lib.startGameFunction(loopFunction);
|
||||
|
||||
### `println`
|
||||
|
||||
`lib.println(msg: string) -> void`
|
||||
```ts
|
||||
lib.println(msg: string) -> void
|
||||
```
|
||||
|
||||
Print a message the debug console.
|
||||
|
||||
@ -181,7 +183,9 @@ It is a thursday.
|
||||
|
||||
### `startGameLoop`
|
||||
|
||||
`lib.startGameLoop(loopFunction: LoopFunc) -> void`
|
||||
```ts
|
||||
lib.startGameLoop(loopFunction: LoopFunc) -> void
|
||||
```
|
||||
|
||||
Registers a gameloop function, that is called on every tick.
|
||||
|
||||
@ -189,7 +193,9 @@ See also: [`Models.LoopFunc`](#Models-LoopFunc)
|
||||
|
||||
### `isPressed`
|
||||
|
||||
`lib.isPressed(key: Key) -> bool`
|
||||
```ts
|
||||
lib.isPressed(key: Key) -> bool
|
||||
```
|
||||
|
||||
Returns whether or not `key` is currently pressed.
|
||||
|
||||
@ -211,7 +217,9 @@ lib.startGameLoop(function (deltaT) {
|
||||
|
||||
### `onPress`
|
||||
|
||||
`lib.onPress(key: Key, handlerFunction: KeyEventFunc) -> void`
|
||||
```ts
|
||||
lib.onPress(key: Key, handlerFunction: KeyEventFunc) -> void
|
||||
```
|
||||
|
||||
Calls `handlerFunction` whenever `key` is pressed.
|
||||
|
||||
@ -233,13 +241,17 @@ lib.onRelease(" ", function () {
|
||||
|
||||
### `onRelease`
|
||||
|
||||
`lib.onRelease(key: Key, handlerFunction: KeyEventFunc) -> void`
|
||||
```ts
|
||||
lib.onRelease(key: Key, handlerFunction: KeyEventFunc) -> void
|
||||
```
|
||||
|
||||
The opposite of [`lib.onPress`](#Lib-onPress)
|
||||
|
||||
### `rgb`
|
||||
|
||||
`lib.rgb(red: number, green: number, blue: number) -> Color`
|
||||
```ts
|
||||
lib.rgb(red: number, green: number, blue: number) -> Color
|
||||
```
|
||||
|
||||
Generates a correctly formatted [`Color`](#Models-Color) value based on `red`, `green` and `blue`
|
||||
|
||||
@ -253,7 +265,9 @@ lib.drawRect(100, 0, 100, 100, lib.rgb(192, 127, 172));
|
||||
|
||||
### `clear`
|
||||
|
||||
`lib.clear(color: Color) -> void`
|
||||
```ts
|
||||
lib.clear(color: Color) -> void
|
||||
```
|
||||
|
||||
Paints the entire screen `color`.
|
||||
|
||||
@ -274,7 +288,9 @@ lib.startGameLoop(function () {
|
||||
|
||||
### `drawSprite`
|
||||
|
||||
`lib.drawSprite(x: number, y: number, width: number, height: number, name: string) -> void`
|
||||
```ts
|
||||
lib.drawSprite(x: number, y: number, width: number, height: number, name: string) -> void
|
||||
```
|
||||
|
||||
Draws a sprite imported in the asset editor.
|
||||
|
||||
@ -291,7 +307,9 @@ lib.startGameLoop(function () {
|
||||
|
||||
### `drawRect`
|
||||
|
||||
`lib.drawRect(x: number, y: number, width: number, height: number, color: Color) -> void`
|
||||
```ts
|
||||
lib.drawRect(x: number, y: number, width: number, height: number, color: Color) -> void
|
||||
```
|
||||
|
||||
Fills a rect with [`Color`](#Models-Color).
|
||||
|
||||
@ -313,7 +331,9 @@ lib.startGameLoop(function () {
|
||||
|
||||
### `onMouseMove`
|
||||
|
||||
`lib.onMouseMove(handlerFunction: MouseMoveEventFunc) -> void`
|
||||
```ts
|
||||
lib.onMouseMove(handlerFunction: MouseMoveEventFunc) -> void
|
||||
```
|
||||
|
||||
Calls `handlerFunction` whenever mouse is moved.
|
||||
|
||||
@ -357,7 +377,9 @@ lib.onMouseMove(mouseMoved);
|
||||
|
||||
### `isClicking`
|
||||
|
||||
`lib.isClicking(button: MouseButton) -> bool`
|
||||
```ts
|
||||
lib.isClicking(button: MouseButton) -> bool
|
||||
```
|
||||
|
||||
Returns whether or not `key` is currently pressed.
|
||||
|
||||
@ -379,7 +401,12 @@ lib.startGameLoop(function (deltaT) {
|
||||
|
||||
### `onClick`
|
||||
|
||||
`lib.onClick(handlerFunction: MouseButtonEventFunc, button: MouseButton = lib.MouseButton.Left) -> void`
|
||||
```ts
|
||||
lib.onClick(
|
||||
handlerFunction: MouseButtonEventFunc,
|
||||
button: MouseButton = lib.MouseButton.Left
|
||||
) -> void
|
||||
```
|
||||
|
||||
Calls `handlerFunction` whenever `button` is pressed.
|
||||
|
||||
@ -393,26 +420,32 @@ Example:
|
||||
```ts
|
||||
let isJumping = false;
|
||||
|
||||
lib.onClick(function () {
|
||||
isJumping = true;
|
||||
}, lib.MouseButton.Left);
|
||||
|
||||
/* here we take advantage of MouseButton.Left
|
||||
being the default argument, so we don't have
|
||||
to specify it. */
|
||||
lib.onClickRelease(function () {
|
||||
isJumping = false;
|
||||
});
|
||||
|
||||
/* here we decide to be explicit */
|
||||
lib.onClick(function () {
|
||||
isJumping = true;
|
||||
}, lib.MouseButton.Left);
|
||||
```
|
||||
|
||||
### `onClickRelease`
|
||||
|
||||
`lib.onClickRelease(handlerFunction: MouseButtonEventFunc, button: MouseButton = lib.MouseButton.Left) -> void`
|
||||
```ts
|
||||
lib.onClickRelease(
|
||||
handlerFunction: MouseButtonEventFunc,
|
||||
button: MouseButton = lib.MouseButton.Left
|
||||
) -> void`
|
||||
```
|
||||
|
||||
The opposite of [`lib.onClick`](#Lib-onClick)
|
||||
|
||||
### `MouseButton`
|
||||
|
||||
`lib.MouseButton.Left, lib.MouseButton.Right, lib.MouseButton.Middle`
|
||||
`lib.MouseButton.Left`, `lib.MouseButton.Right`, `lib.MouseButton.Middle`
|
||||
|
||||
A method of accessing [`Model.MouseButton`](#Model-MouseButton)
|
||||
|
Loading…
x
Reference in New Issue
Block a user