Remove td, remove field matrix, update radio blocks. Revert image literal changes.

This commit is contained in:
Sam El-Husseini
2018-05-09 10:56:48 -07:00
parent dc5ec79708
commit 8957bf0647
14 changed files with 150 additions and 367 deletions

View File

@ -230,7 +230,7 @@
"basic.pause|block": "pause (ms) %pause",
"basic.showArrow|block": "show arrow %i=device_arrow",
"basic.showIcon|block": "show icon %i",
"basic.showLeds|block": "show leds| %leds",
"basic.showLeds|block": "show leds",
"basic.showNumber|block": "show|number %number",
"basic.showString|block": "show|string %text",
"basic|block": "basic",
@ -266,8 +266,8 @@
"game|block": "game",
"images.arrowImage|block": "arrow image %i=device_arrow",
"images.arrowNumber|block": "%arrow",
"images.createBigImage|block": "create big image| %leds",
"images.createImage|block": "create image| %leds",
"images.createBigImage|block": "create big image",
"images.createImage|block": "create image",
"images.iconImage|block": "icon image %i",
"images|block": "images",
"input.acceleration|block": "acceleration (mg)|%NAME",

View File

@ -34,13 +34,10 @@ namespace basic {
*/
//% help=basic/show-leds
//% weight=95 blockGap=8
//% imageLiteral=0 async
//% leds.fieldEditor="matrix"
//% leds.fieldOptions.onParentBlock=true
//% leds.fieldOptions.decompileLiterals=true
//% imageLiteral=1 async
//% blockId=device_show_leds
//% block="show leds| %leds" icon="\uf00a"
//% parts="ledmatrix" blockExternalInputs=1
//% block="show leds" icon="\uf00a"
//% parts="ledmatrix"
void showLeds(ImageLiteral leds, int interval = 400) {
uBit.display.print(MicroBitImage(imageBytes(leds)), 0, 0, 0, interval);
}
@ -87,10 +84,7 @@ namespace basic {
* @param leds pattern of LEDs to turn on/off
* @param interval time in milliseconds between each redraw
*/
//% help=basic/show-animation imageLiteral=0 async
//% leds.fieldEditor="matrix"
//% leds.fieldOptions.onParentBlock=true
//% leds.fieldOptions.decompileLiterals=true
//% help=basic/show-animation imageLiteral=1 async
//% parts="ledmatrix"
void showAnimation(ImageLiteral leds, int interval = 400) {
uBit.display.animate(MicroBitImage(imageBytes(leds)), interval, 5, 0, 0);
@ -137,4 +131,4 @@ namespace basic {
void pause(int ms) {
fiber_sleep(ms);
}
}
}

View File

@ -10,11 +10,8 @@ namespace images {
* Creates an image that fits on the LED screen.
*/
//% weight=75 help=images/create-image
//% blockId=device_build_image block="create image| %leds"
//% leds.fieldEditor="matrix"
//% leds.fieldOptions.onParentBlock=true
//% leds.fieldOptions.decompileLiterals=true
//% parts="ledmatrix" imageLiteral=0 blockExternalInput=1
//% blockId=device_build_image block="create image"
//% parts="ledmatrix"
Image createImage(ImageLiteral leds) {
return MicroBitImage(imageBytes(leds)).clone().leakData();
}
@ -23,11 +20,7 @@ namespace images {
* Creates an image with 2 frames.
*/
//% weight=74 help=images/create-big-image
//% leds.fieldEditor="matrix"
//% leds.fieldOptions.onParentBlock=true
//% leds.fieldOptions.decompileLiterals=true
//% blockId=device_build_big_image block="create big image| %leds"
//% imageLiteral=0 blockExternalInput=1
//% blockId=device_build_big_image block="create big image" imageLiteral=2
//% parts="ledmatrix"
Image createBigImage(ImageLiteral leds) {
return createImage(leds);
@ -160,4 +153,4 @@ namespace ImageMethods {
void showFrame(Image i, int frame, int interval = 400) {
showImage(i, frame * 5, interval);
}
}
}

27
libs/core/shims.d.ts vendored
View File

@ -12,22 +12,15 @@ declare namespace images {
* Creates an image that fits on the LED screen.
*/
//% weight=75 help=images/create-image
//% blockId=device_build_image block="create image| %leds"
//% leds.fieldEditor="matrix"
//% leds.fieldOptions.onParentBlock=true
//% leds.fieldOptions.decompileLiterals=true
//% parts="ledmatrix" imageLiteral=0 blockExternalInput=1 shim=images::createImage
//% blockId=device_build_image block="create image"
//% parts="ledmatrix" imageLiteral=1 shim=images::createImage
function createImage(leds: string): Image;
/**
* Creates an image with 2 frames.
*/
//% weight=74 help=images/create-big-image
//% leds.fieldEditor="matrix"
//% leds.fieldOptions.onParentBlock=true
//% leds.fieldOptions.decompileLiterals=true
//% blockId=device_build_big_image block="create big image| %leds"
//% imageLiteral=0 blockExternalInput=1
//% blockId=device_build_big_image block="create big image" imageLiteral=2
//% parts="ledmatrix" shim=images::createBigImage
function createBigImage(leds: string): Image;
}
@ -154,13 +147,10 @@ declare namespace basic {
*/
//% help=basic/show-leds
//% weight=95 blockGap=8
//% imageLiteral=0 async
//% leds.fieldEditor="matrix"
//% leds.fieldOptions.onParentBlock=true
//% leds.fieldOptions.decompileLiterals=true
//% imageLiteral=1 async
//% blockId=device_show_leds
//% block="show leds| %leds" icon="\uf00a"
//% parts="ledmatrix" blockExternalInputs=1 interval.defl=400 shim=basic::showLeds
//% block="show leds" icon="\uf00a"
//% parts="ledmatrix" interval.defl=400 shim=basic::showLeds
function showLeds(leds: string, interval?: int32): void;
/**
@ -190,10 +180,7 @@ declare namespace basic {
* @param leds pattern of LEDs to turn on/off
* @param interval time in milliseconds between each redraw
*/
//% help=basic/show-animation imageLiteral=0 async
//% leds.fieldEditor="matrix"
//% leds.fieldOptions.onParentBlock=true
//% leds.fieldOptions.decompileLiterals=true
//% help=basic/show-animation imageLiteral=1 async
//% parts="ledmatrix" interval.defl=400 shim=basic::showAnimation
function showAnimation(leds: string, interval?: int32): void;