Map and clean deprecated functions (#175)

* add image and deprecated arrow functions

* update locales

* map basic.showArrow

* map arrow blocks

* map & remove arrow images

* remove arrow blocks

* update locales

* remove & patch:
rgbw -> rgb
button/pin pressed -> button/pin event
loudness -> soundLevel

* update ts mappings for arrows

* add wip ts patch rules

* update .blocks files

* use Click instead of Down as default in Documentation and tests

* patch test.blocks

* fix lowercase name tag

* update test.blocks

* update blocks test files

* update blocks test files

* format block files

* pass blocks file tests

* fix ts mapping

* fix color.defl value

closes https://github.com/microsoft/pxt-calliope/issues/136

* fix ts mappings

- add optional spacing at the end of rgbw()
- map up to v4.0.19

* add suggested changes

* replace innerText by textContent

Co-authored-by: JW <gitkraken@juriwolf.de>
Co-authored-by: Juri <info@juriwolf.de>
This commit is contained in:
Juri Wolf
2022-04-26 19:28:42 +02:00
committed by GitHub
parent 3b9d90e551
commit a93febb5b7
102 changed files with 1458 additions and 740 deletions

View File

@ -1,41 +0,0 @@
# arrow Image
Create an arrow shaped [image](/reference/images/image) for the [LED screen](/device/screen).
```sig
images.arrowImage(ArrowNames.North)
```
The arrow points in the direction of the arrow name you choose, like `North`.
## Parameters
* **i**: the arrow name to make an arrow [image](/reference/images/image) for. You can make an arrow image that points in one of these directions:
>* `North`
>* `NorthEast`
>* `East`
>* `SouthEast`
>* `South`
>* `SouthWest`
>* `West`
>* `NorthWest`
## Example
Display a left arrow when button A is pressed or a right arrow when button B is pressed.
```blocks
let arrowLeft = images.arrowImage(ArrowNames.West)
let arrowRight = images.arrowImage(ArrowNames.East)
input.onButtonPressed(Button.A, () => {
arrowLeft.showImage(0);
});
input.onButtonPressed(Button.B, () => {
arrowRight.showImage(0);
});
```
## See also
[arrow number](/reference/images/arrow-number)

View File

@ -1,33 +0,0 @@
# arrow Number
Get the number that matches an arrow image name.
```sig
images.arrowNumber(ArrowNames.North)
```
Each arrow image name has a number for it. You can find the number for any arrow name with ``||Images:arrow number||``.
## Parameters
* **arrow**: the arrow name to get an arrow number for. These are the arrow names:
>* `North`
* `NorthEast`
* `East`
* `SouthEast`
* `South`
* `SouthWest`
* `West`
* `NorthWest`
## Example
Get the arrow number for `ArrowNames.South`.
```blocks
let arrowSouthNumber = images.arrowNumber(ArrowNames.South)
```
## See also
[arrow image](/reference/images/arrow-image)

View File

@ -36,10 +36,10 @@ let arrows = images.createBigImage(`
. . # . . . # # # .
. . # . . . . # . .
`);
input.onButtonPressed(Button.A, () => {
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
arrows.showImage(0);
});
input.onButtonPressed(Button.B, () => {
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
arrows.showImage(5);
});
```

View File

@ -25,7 +25,7 @@ arrow and show it on the LED screen. If you press button `B`, the
program will show a picture of the arrow upside-down.
```blocks
input.onButtonPressed(Button.A, () => {
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
images.createImage(`
. . # . .
. # # # .
@ -34,7 +34,7 @@ input.onButtonPressed(Button.A, () => {
. . # . .
`).showImage(0);
});
input.onButtonPressed(Button.B, () => {
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
images.createImage(`
. . # . .
. . # . .

View File

@ -20,10 +20,10 @@ Show a happy face when button A is pressed or a sad face when button B is presse
let iamHappy = images.iconImage(IconNames.Happy)
let iamSad = images.iconImage(IconNames.Sad)
input.onButtonPressed(Button.A, () => {
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
iamHappy.showImage(0);
});
input.onButtonPressed(Button.B, () => {
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
iamSad.showImage(0);
});
```

View File

@ -31,10 +31,10 @@ let arrows = images.createBigImage(`
. . # . . . # # # .
. . # . . . . # . .
`);
input.onButtonPressed(Button.A, () => {
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
arrows.showImage(0);
});
input.onButtonPressed(Button.B, () => {
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
arrows.showImage(5);
});
```