From ff7b229a3a8bfb9456f0f915374600816ad2ecdb Mon Sep 17 00:00:00 2001 From: Tom Ball Date: Mon, 30 Jan 2017 16:42:48 -0800 Subject: [PATCH] add one image to make it spiffy --- libs/core/_locales/core-strings.json | 3 +- libs/core/icons.ts | 56 ++++++++++++++-------------- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/libs/core/_locales/core-strings.json b/libs/core/_locales/core-strings.json index e0774809..a1ea640f 100644 --- a/libs/core/_locales/core-strings.json +++ b/libs/core/_locales/core-strings.json @@ -55,6 +55,7 @@ "Gesture.TiltLeft|block": "tilt left", "Gesture.TiltRight": "Raised when the screen is pointing right", "Gesture.TiltRight|block": "tilt right", + "IconNames.Heart|block": "heart", "LedSpriteProperty.Blink|block": "blink", "LedSpriteProperty.Brightness|block": "brightness", "LedSpriteProperty.Direction|block": "direction", @@ -121,7 +122,7 @@ "game|block": "game", "images.createBigImage|block": "create big image", "images.createImage|block": "create image", - "images|block": "happy", + "images|block": "images", "input.acceleration|block": "acceleration (mg)|%NAME", "input.buttonIsPressed|block": "button|%NAME|is pressed", "input.compassHeading|block": "compass heading (°)", diff --git a/libs/core/icons.ts b/libs/core/icons.ts index a3e4ac44..7f02d683 100644 --- a/libs/core/icons.ts +++ b/libs/core/icons.ts @@ -1,7 +1,5 @@ -// this doesn't work//% block=happy enumval=0 blockImage=1 -namespace images { - -export enum IconNames { +enum IconNames { + //% enumval=0 block="heart" blockImage=1 Heart = 0, SmallHeart, @@ -49,6 +47,32 @@ export enum IconNames { SmallSquare } +namespace basic { + + //% weight=50 + //% blockId=basic_show_arrow block="show arrow %i=device_arrow" + export function showArrow(i: number) { + let res = images.arrowImage(i) + res.showImage(0) + } + + //% weight=50 + //% blockId=basic_show_hour block="show hour %i=device_hour" + export function showHour(i: number) { + let res = images.hourImage(i) + 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 { North = 0, NorthEast, @@ -649,27 +673,3 @@ export enum HourNames { return res } } - -namespace basic { - - //% weight=50 - //% blockId=basic_show_arrow block="show arrow %i=device_arrow" - export function showArrow(i: number) { - let res = images.arrowImage(i) - res.showImage(0) - } - - //% weight=50 - //% blockId=basic_show_hour block="show hour %i=device_hour" - export function showHour(i: number) { - let res = images.hourImage(i) - res.showImage(0) - } - - //% weight=90 - //% blockId=basic_show_icon block="show icon %i" - export function showIcon(i: images.IconNames) { - let res = images.iconImage(i) - res.showImage(0) - } -}