Fix some titles, sigs in ref docs (#2128)
* Fix some title and sigs in ref docs * better buffer source
This commit is contained in:
parent
14418569d1
commit
3f106307ff
@ -233,7 +233,7 @@
|
||||
* [delete](/reference/game/delete)
|
||||
* [move](/reference/game/move)
|
||||
* [turn](/reference/game/turn)
|
||||
* [in on edge bounce](/reference/game/if-on-edge-bounce)
|
||||
* [if on edge bounce](/reference/game/if-on-edge-bounce)
|
||||
* [get](/reference/game/get)
|
||||
* [set](/reference/game/set)
|
||||
* [change](/reference/game/change)
|
||||
|
@ -1,21 +1,19 @@
|
||||
# change Sprite Property
|
||||
# change (Sprite Property)
|
||||
|
||||
Change the kind of [number](/types/number) you say for a [sprite](/reference/game/create-sprite).
|
||||
|
||||
```sig
|
||||
let item: game.LedSprite = null;
|
||||
item.change(LedSpriteProperty.X, 0);
|
||||
game.createSprite(0,0).change(LedSpriteProperty.X, 0);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
* the **sprite** you want to change
|
||||
* the kind of [number](/types/number) you want to change for the sprite, like
|
||||
* ``x``, how far up or down the sprite is on the screen (`0`-`4`)
|
||||
* ``y``, how far left or right the sprite is on the screen (`0`-`4`)
|
||||
* ``direction``, which way the sprite is pointing (this works the same way as the [turn](/reference/game/turn) function)
|
||||
* ``brightness``, how bright the LED sprite is (this works the same way as the [brightness](/reference/led/brightness) function)
|
||||
* ``blink``, how fast the sprite is blinking (the bigger the number is, the faster the sprite is blinking)
|
||||
* **property**: the property of the **Sprite** you want to change, like:
|
||||
>* ``x`` - how far up or down the sprite is on the screen (`0`-`4`)
|
||||
>* ``y`` - how far left or right the sprite is on the screen (`0`-`4`)
|
||||
>* ``direction`` - which way the sprite is pointing (this works the same way as the [turn](/reference/game/turn) function)
|
||||
>* ``brightness`` - how bright the LED sprite is (this works the same way as the [brightness](/reference/led/brightness) function)
|
||||
>* ``blink`` - how fast the sprite is blinking (the bigger the number is, the faster the sprite is blinking)
|
||||
|
||||
## Example
|
||||
|
||||
|
@ -17,6 +17,10 @@ game.createSprite(2, 2);
|
||||
|
||||
`0` and `4` mean the edges of the screen, and `2` means in the middle.
|
||||
|
||||
## Returns
|
||||
|
||||
* a new **LedSprite** at the location you say.
|
||||
|
||||
## ~ hint
|
||||
|
||||
Once the game engine is started, it will render the sprites to the screen and potentially override any kind of animation you are trying to show.
|
||||
|
@ -3,15 +3,10 @@
|
||||
Delete a sprite from the game.
|
||||
|
||||
```sig
|
||||
let item: game.LedSprite = null;
|
||||
item.delete();
|
||||
game.createSprite(0,0).delete()
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
* the **sprite** you want to delete from the game
|
||||
|
||||
### Example
|
||||
## Example
|
||||
|
||||
This program makes a sprite and shows the number of its brightness on the screen. Then, it deletes the sprite.
|
||||
|
||||
@ -21,6 +16,6 @@ basic.showNumber(ball.get(LedSpriteProperty.Brightness));
|
||||
ball.delete();
|
||||
```
|
||||
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[create sprite](/reference/game/create-sprite)
|
||||
|
@ -1,25 +1,23 @@
|
||||
# Get Sprite Property
|
||||
# get (Sprite Property)
|
||||
|
||||
Find something out about a [sprite](/reference/game/create-sprite).
|
||||
|
||||
```sig
|
||||
let item: game.LedSprite = null;
|
||||
item.get(LedSpriteProperty.X);
|
||||
game.createSprite(0,0).get(LedSpriteProperty.X);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
* the **sprite** you want to know something about
|
||||
* the kind of [number](/types/number) you want to know about the sprite, like
|
||||
* ``x``, how far up or down the sprite is on the screen (`0`-`4`)
|
||||
* ``y``, how far left or right the sprite is on the screen (`0`-`4`)
|
||||
* ``direction``, which way the sprite is pointing (this works the same way as the [turn](/reference/game/turn) function)
|
||||
* ``brightness``, how bright the LED sprite is (this works the same way as the [brightness](/reference/led/brightness) function)
|
||||
* ``blink``, how fast the sprite is blinking (the bigger the number is, the faster the sprite is blinking)
|
||||
* **property**: the property of the **Sprite** you want to know about, like:
|
||||
>* ``x`` - how far up or down the sprite is on the screen (`0`-`4`)
|
||||
>* ``y`` - how far left or right the sprite is on the screen (`0`-`4`)
|
||||
>* ``direction`` - which way the sprite is pointing (this works the same way as the [turn](/reference/game/turn) function)
|
||||
>* ``brightness`` - how bright the LED sprite is (this works the same way as the [brightness](/reference/led/brightness) function)
|
||||
>* ``blink`` - how fast the sprite is blinking (the bigger the number is, the faster the sprite is blinking)
|
||||
|
||||
## Returns
|
||||
|
||||
The [number](/types/number) you asked for.
|
||||
* a [number](/types/number) value of the property you asked for.
|
||||
|
||||
## Example
|
||||
|
||||
|
@ -4,8 +4,7 @@ Make a [sprite](/reference/game/create-sprite) on the edge of the
|
||||
[LED screen](/device/screen) bounce away.
|
||||
|
||||
```sig
|
||||
let item = game.createSprite(0, 2);
|
||||
item.ifOnEdgeBounce();
|
||||
game.createSprite(0, 2).ifOnEdgeBounce();
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
@ -6,17 +6,16 @@ Sprites are touching the edge if they overlap with an LED on the edge
|
||||
of the screen.
|
||||
|
||||
```sig
|
||||
let item: game.LedSprite = null;
|
||||
item.isTouchingEdge();
|
||||
game.createSprite(0, 2).isTouchingEdge();
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
* a **sprite** that might be touching the edge of the screen
|
||||
* a **sprite** that might be touching the edge of the screen.
|
||||
|
||||
## Returns
|
||||
|
||||
`true` if the sprite is touching the edge of the screen
|
||||
* `true` if the sprite is touching the edge of the screen.
|
||||
|
||||
## Example
|
||||
|
||||
|
@ -5,18 +5,16 @@ Find whether the sprite is touching another sprite you say.
|
||||
Sprites are touching if they share the same LED.
|
||||
|
||||
```sig
|
||||
let item: game.LedSprite = null;
|
||||
item.isTouching(null);
|
||||
game.createSprite(0, 2).isTouching(null);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
* a **sprite** you are checking
|
||||
* another **sprite** that might be touching the one you are checking
|
||||
* another **sprite** that might be touching the one you are checking.
|
||||
|
||||
## Returns
|
||||
|
||||
`true` if the two sprites are touching.
|
||||
* `true` if the two sprites are touching.
|
||||
|
||||
## Example
|
||||
|
||||
|
@ -3,13 +3,12 @@
|
||||
Move the sprite the number of LEDs you say.
|
||||
|
||||
```sig
|
||||
let item: game.LedSprite = null;
|
||||
item.move(1);
|
||||
game.createSprite(0, 2).move(1);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
* a [number](/types/number) that means how many LEDs the sprite should move
|
||||
* **leds**: a [number](/types/number) that means how many LEDs the sprite should move.
|
||||
|
||||
## Example
|
||||
|
||||
|
@ -1,21 +1,19 @@
|
||||
# Set Sprite Property
|
||||
# set (Sprite Property)
|
||||
|
||||
Make a [sprite](/reference/game/create-sprite) store the kind of [number](/types/number) you say.
|
||||
|
||||
```sig
|
||||
let item: game.LedSprite = null;
|
||||
item.set(LedSpriteProperty.X, 0);
|
||||
game.createSprite(0,0).set(LedSpriteProperty.X, 0);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
* the **sprite** you want to make store the number you say
|
||||
* the kind of [number](/types/number) you want to store in the sprite, like
|
||||
* ``x``, how far up or down the sprite is on the screen (`0`-`4`)
|
||||
* ``y``, how far left or right the sprite is on the screen (`0`-`4`)
|
||||
* ``direction``, which way the sprite is pointing (this works the same way as the [turn](/reference/game/turn) function)
|
||||
* ``brightness``, how bright the LED sprite is (this works the same way as the [brightness](/reference/led/brightness) function)
|
||||
* ``blink``, how fast the sprite is blinking (the bigger the number is, the faster the sprite is blinking)
|
||||
* **property**: the property of the **Sprite** you want to store a value for, like:
|
||||
>* ``x`` - how far up or down the sprite is on the screen (`0`-`4`)
|
||||
>* ``y`` - how far left or right the sprite is on the screen (`0`-`4`)
|
||||
>* ``direction`` - which way the sprite is pointing (this works the same way as the [turn](/reference/game/turn) function)
|
||||
>* ``brightness`` - how bright the LED sprite is (this works the same way as the [brightness](/reference/led/brightness) function)
|
||||
>* ``blink`` - how fast the sprite is blinking (the bigger the number is, the faster the sprite is blinking)
|
||||
|
||||
## Example
|
||||
|
||||
|
@ -3,15 +3,14 @@
|
||||
Turn the sprite as much as you say in the direction you say.
|
||||
|
||||
```sig
|
||||
let item: game.LedSprite = null;
|
||||
item.turn(Direction.Right, 45);
|
||||
game.createSprite(0, 2).turn(Direction.Right, 45);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
* a choice whether the sprite should turn **left** or **right**
|
||||
* a [number](/types/number) that means how much the sprite should turn.
|
||||
This number is in **degrees**, so a straight left or right turn is 90 degrees.
|
||||
* **direction**: a choice whether the sprite should turn **left** or **right**
|
||||
* **degrees**: a [number](/types/number) degrees of angle that the sprite should turn.
|
||||
A straight left or right turn is 90 degrees.
|
||||
|
||||
## Example
|
||||
|
||||
|
@ -19,7 +19,7 @@ serial.onDataReceived(",", () => {})
|
||||
```cards
|
||||
serial.redirect(SerialPin.P0, SerialPin.P0, BaudRate.BaudRate115200);
|
||||
serial.redirectToUSB();
|
||||
serial.writeBuffer(pins.createBuffer(0));
|
||||
serial.writeBuffer(serial.readBuffer(64));
|
||||
serial.readBuffer(64);
|
||||
serial.setRxBufferSize(64);
|
||||
serial.setTxBufferSize(64);
|
||||
|
@ -26,7 +26,7 @@ The need to pause for more data is set by the @boardname@ **[serial mode](https:
|
||||
|
||||
Read character data from the serial port one row at a time. Write the rows to an LED display connected to the I2C pins.
|
||||
|
||||
```blocks
|
||||
```typescript
|
||||
let rowData: Buffer = null;
|
||||
for (let i = 0; i < 24; i++) {
|
||||
rowData = serial.readBuffer(80);
|
||||
|
@ -16,7 +16,7 @@ You place your data characters into an existing buffer. All of the data, the len
|
||||
|
||||
Read some characters of data from a device connected to the I2C pins. Write the data to the serial port.
|
||||
|
||||
```blocks
|
||||
```typescript
|
||||
pins.i2cWriteNumber(132, NumberFormat.UInt8LE, 0);
|
||||
let i2cBuffer = pins.i2cReadBuffer(132, 16, false);
|
||||
serial.writeBuffer(i2cBuffer);
|
||||
|
@ -196,7 +196,7 @@ namespace serial {
|
||||
* Sets the size of the RX buffer in bytes
|
||||
* @param size length of the rx buffer in bytes, eg: 32
|
||||
*/
|
||||
//% help=serial/set-rx-buffer-size
|
||||
//% help=reference/serial/set-rx-buffer-size
|
||||
void setRxBufferSize(uint8_t size) {
|
||||
uBit.serial.setRxBufferSize(size);
|
||||
}
|
||||
@ -205,7 +205,7 @@ namespace serial {
|
||||
* Sets the size of the TX buffer in bytes
|
||||
* @param size length of the tx buffer in bytes, eg: 32
|
||||
*/
|
||||
//% help=serial/set-tx-buffer-size
|
||||
//% help=reference/serial/set-tx-buffer-size
|
||||
void setTxBufferSize(uint8_t size) {
|
||||
uBit.serial.setTxBufferSize(size);
|
||||
}
|
||||
|
4
libs/core/shims.d.ts
vendored
4
libs/core/shims.d.ts
vendored
@ -869,14 +869,14 @@ declare namespace serial {
|
||||
* Sets the size of the RX buffer in bytes
|
||||
* @param size length of the rx buffer in bytes, eg: 32
|
||||
*/
|
||||
//% help=serial/set-rx-buffer-size shim=serial::setRxBufferSize
|
||||
//% help=reference/serial/set-rx-buffer-size shim=serial::setRxBufferSize
|
||||
function setRxBufferSize(size: uint8): void;
|
||||
|
||||
/**
|
||||
* Sets the size of the TX buffer in bytes
|
||||
* @param size length of the tx buffer in bytes, eg: 32
|
||||
*/
|
||||
//% help=serial/set-tx-buffer-size shim=serial::setTxBufferSize
|
||||
//% help=reference/serial/set-tx-buffer-size shim=serial::setTxBufferSize
|
||||
function setTxBufferSize(size: uint8): void;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user