diff --git a/libs/core/_locales/core-jsdoc-strings.json b/libs/core/_locales/core-jsdoc-strings.json index e56a3a95..7bb81781 100644 --- a/libs/core/_locales/core-jsdoc-strings.json +++ b/libs/core/_locales/core-jsdoc-strings.json @@ -36,6 +36,7 @@ "basic.showAnimation": "Shows a sequence of LED screens as an animation.", "basic.showAnimation|param|interval": "time in milliseconds between each redraw", "basic.showAnimation|param|leds": "pattern of LEDs to turn on/off", + "basic.showIcon": "Draws the selected icon on the LED screen", "basic.showLeds": "Draws an image on the LED screen.", "basic.showLeds|param|interval": "time in milliseconds to pause after drawing", "basic.showLeds|param|leds": "the pattern of LED to turn on/off", diff --git a/libs/core/_locales/core-strings.json b/libs/core/_locales/core-strings.json index a1ea640f..c5ec1059 100644 --- a/libs/core/_locales/core-strings.json +++ b/libs/core/_locales/core-strings.json @@ -97,6 +97,7 @@ "basic.clearScreen|block": "clear screen", "basic.forever|block": "forever", "basic.pause|block": "pause (ms) %pause", + "basic.showIcon|block": "show icon %i", "basic.showLeds|block": "show leds", "basic.showNumber|block": "show|number %number", "basic.showString|block": "show|string %text", diff --git a/libs/core/icons.ts b/libs/core/icons.ts index d012bb9d..e41997b8 100644 --- a/libs/core/icons.ts +++ b/libs/core/icons.ts @@ -76,6 +76,18 @@ enum IconNames { namespace basic { + /** + * Draws the selected icon on the LED screen + */ + //% weight=90 blockGap=8 + //% blockId=basic_show_icon + //% block="show icon %i" icon="\uf00a" + //% parts="ledmatrix" + export function showIcon(icon: IconNames) { + let res = images.iconImage(icon) + res.showImage(0) + } + //% weight=50 //% blockId=basic_show_arrow block="show arrow %i=device_arrow" export function showArrow(i: number) { @@ -90,14 +102,9 @@ namespace basic { res.showImage(0) } - //% weight=90 - //% blockId=basic_show_icon block="show icon %i" - export function showIcon(i: IconNames) { - let res = images.iconImage(i) - res.showImage(0) - } } + namespace images { export enum ArrowNames {