Add 'clear screen' block to brick category (#100)
This commit is contained in:
parent
6a4e64eac0
commit
e591bed6ad
@ -28,6 +28,7 @@
|
|||||||
"brick.buttonLeft": "Left button on the EV3 Brick.",
|
"brick.buttonLeft": "Left button on the EV3 Brick.",
|
||||||
"brick.buttonRight": "Right button on the EV3 Brick.",
|
"brick.buttonRight": "Right button on the EV3 Brick.",
|
||||||
"brick.buttonUp": "Up button on the EV3 Brick.",
|
"brick.buttonUp": "Up button on the EV3 Brick.",
|
||||||
|
"brick.clearScreen": "Clears the screen",
|
||||||
"brick.lightPattern": "Pattern block.",
|
"brick.lightPattern": "Pattern block.",
|
||||||
"brick.lightPattern|param|pattern": "the lights pattern to use. eg: LightsPattern.Green",
|
"brick.lightPattern|param|pattern": "the lights pattern to use. eg: LightsPattern.Green",
|
||||||
"brick.print": "Show text on the screen.",
|
"brick.print": "Show text on the screen.",
|
||||||
|
@ -34,11 +34,12 @@
|
|||||||
"brick.buttonLeft|block": "left",
|
"brick.buttonLeft|block": "left",
|
||||||
"brick.buttonRight|block": "right",
|
"brick.buttonRight|block": "right",
|
||||||
"brick.buttonUp|block": "up",
|
"brick.buttonUp|block": "up",
|
||||||
|
"brick.clearScreen|block": "`icons.brickDisplay` clear screen",
|
||||||
"brick.lightPattern|block": "%pattern",
|
"brick.lightPattern|block": "%pattern",
|
||||||
"brick.print|block": "`icons.brickDisplay` print %text| at x: %x| y: %y",
|
"brick.print|block": "`icons.brickDisplay` print %text| at x: %x| y: %y",
|
||||||
"brick.setPixel|block": "`icons.brickDisplay` set pixel %on| at x: %x| y: %y",
|
"brick.setPixel|block": "`icons.brickDisplay` set pixel %on| at x: %x| y: %y",
|
||||||
"brick.setStatusLight|block": "set `icons.brickButtons` to %pattern=led_pattern",
|
"brick.setStatusLight|block": "set `icons.brickButtons` to %pattern=led_pattern",
|
||||||
"brick.showImage|block": "`icons.brickDisplay` show image %image=scren_image_picker",
|
"brick.showImage|block": "`icons.brickDisplay` show image %image=screen_image_picker",
|
||||||
"brick|block": "brick",
|
"brick|block": "brick",
|
||||||
"control.raiseEvent|block": "raise event|from %src|with value %value",
|
"control.raiseEvent|block": "raise event|from %src|with value %value",
|
||||||
"control|block": "control",
|
"control|block": "control",
|
||||||
|
@ -137,7 +137,7 @@ namespace brick {
|
|||||||
* Shows an image on screen
|
* Shows an image on screen
|
||||||
* @param image image to draw
|
* @param image image to draw
|
||||||
*/
|
*/
|
||||||
//% blockId=screen_show_image block="`icons.brickDisplay` show image %image=scren_image_picker"
|
//% blockId=screen_show_image block="`icons.brickDisplay` show image %image=screen_image_picker"
|
||||||
//% weight=95 group="Screen" blockGap=8
|
//% weight=95 group="Screen" blockGap=8
|
||||||
export function showImage(image: Image, delay: number = 400) {
|
export function showImage(image: Image, delay: number = 400) {
|
||||||
if (!image) return;
|
if (!image) return;
|
||||||
@ -151,7 +151,7 @@ namespace brick {
|
|||||||
* An image
|
* An image
|
||||||
* @param image the image
|
* @param image the image
|
||||||
*/
|
*/
|
||||||
//% blockId=scren_image_picker block="%image" shim=TD_ID
|
//% blockId=screen_image_picker block="%image" shim=TD_ID
|
||||||
//% image.fieldEditor="imagedropdown"
|
//% image.fieldEditor="imagedropdown"
|
||||||
//% image.fieldOptions.columns=6
|
//% image.fieldOptions.columns=6
|
||||||
//% image.fieldOptions.hasSearchBar=true
|
//% image.fieldOptions.hasSearchBar=true
|
||||||
@ -160,6 +160,15 @@ namespace brick {
|
|||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears the screen
|
||||||
|
*/
|
||||||
|
//% blockId=screen_clear_screen block="`icons.brickDisplay` clear screen"
|
||||||
|
//% weight=94 group="Screen" blockGap=8
|
||||||
|
export function clearScreen() {
|
||||||
|
screen.clear();
|
||||||
|
}
|
||||||
|
|
||||||
export function drawRect(x: number, y: number, w: number, h: number, mode = Draw.Normal) {
|
export function drawRect(x: number, y: number, w: number, h: number, mode = Draw.Normal) {
|
||||||
x |= 0;
|
x |= 0;
|
||||||
y |= 0;
|
y |= 0;
|
||||||
|
@ -30,6 +30,7 @@ namespace pxsim {
|
|||||||
clear() {
|
clear() {
|
||||||
for (let i = 0; i < this.points.length; ++i)
|
for (let i = 0; i < this.points.length; ++i)
|
||||||
this.points[i] = 0;
|
this.points[i] = 0;
|
||||||
|
this.shouldUpdate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
blitLineCore(x: number, y: number, w: number, buf: RefBuffer, mode: Draw, offset = 0) {
|
blitLineCore(x: number, y: number, w: number, buf: RefBuffer, mode: Draw, offset = 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user