brick refactoring
This commit is contained in:
		@@ -10,6 +10,14 @@
 | 
			
		||||
  "MMap.slice": "Read a range of bytes into a buffer.",
 | 
			
		||||
  "MMap.write": "Perform write(2) on the underlaying file",
 | 
			
		||||
  "TouchSensorEvent": "Touch sensor interactions",
 | 
			
		||||
  "brick.print": "Show text on the screen.",
 | 
			
		||||
  "brick.print|param|text": "the text to print on the screen, eg: \"Hello world\"",
 | 
			
		||||
  "brick.print|param|x": "the starting position's x coordinate, eg: 0",
 | 
			
		||||
  "brick.print|param|y": "the starting position's x coordinate, eg: 0",
 | 
			
		||||
  "brick.setPixel": "Sets a pixel on or off",
 | 
			
		||||
  "brick.setPixel|param|on": "a value indicating if the pixel should be on or off",
 | 
			
		||||
  "brick.setPixel|param|x": "the starting position's x coordinate, eg: 0",
 | 
			
		||||
  "brick.setPixel|param|y": "the starting position's x coordinate, eg: 0",
 | 
			
		||||
  "control": "Program controls and events.",
 | 
			
		||||
  "control.allocateNotifyEvent": "Allocates the next user notification event",
 | 
			
		||||
  "control.deviceFirmwareVersion": "Determine the version of system software currently running.",
 | 
			
		||||
@@ -77,14 +85,6 @@
 | 
			
		||||
  "screen.clear": "Clear screen and reset font to normal.",
 | 
			
		||||
  "screen.doubleIcon": "Double size of an icon.",
 | 
			
		||||
  "screen.drawIcon": "Draw an icon on the screen.",
 | 
			
		||||
  "screen.print": "Show text on the screen.",
 | 
			
		||||
  "screen.print|param|text": "the text to print on the screen, eg: \"Hello world\"",
 | 
			
		||||
  "screen.print|param|x": "the starting position's x coordinate, eg: 0",
 | 
			
		||||
  "screen.print|param|y": "the starting position's x coordinate, eg: 0",
 | 
			
		||||
  "screen.setPixel": "Sets a pixel on or off",
 | 
			
		||||
  "screen.setPixel|param|on": "a value indicating if the pixel should be on or off",
 | 
			
		||||
  "screen.setPixel|param|x": "the starting position's x coordinate, eg: 0",
 | 
			
		||||
  "screen.setPixel|param|y": "the starting position's x coordinate, eg: 0",
 | 
			
		||||
  "serial": "Reading and writing data over a serial connection.",
 | 
			
		||||
  "serial.writeDmesg": "Send DMESG debug buffer over serial."
 | 
			
		||||
}
 | 
			
		||||
@@ -30,6 +30,9 @@
 | 
			
		||||
  "TouchSensorEvent.Bumped|block": "bumped",
 | 
			
		||||
  "TouchSensorEvent.Pressed|block": "pressed",
 | 
			
		||||
  "TouchSensorEvent.Released|block": "released",
 | 
			
		||||
  "brick.print|block": "print %text| at x: %x| y: %y",
 | 
			
		||||
  "brick.setPixel|block": "set pixel %on| at x: %x| y: %y",
 | 
			
		||||
  "brick|block": "brick",
 | 
			
		||||
  "control.raiseEvent|block": "raise event|from %src|with value %value",
 | 
			
		||||
  "control|block": "control",
 | 
			
		||||
  "input.Button.isPressed|block": "%button|is pressed",
 | 
			
		||||
@@ -102,8 +105,6 @@
 | 
			
		||||
  "motors.stopAllMotors|block": "stop all motors",
 | 
			
		||||
  "motors|block": "motors",
 | 
			
		||||
  "output|block": "output",
 | 
			
		||||
  "screen.print|block": "print %text| at x: %x| y: %y",
 | 
			
		||||
  "screen.setPixel|block": "set pixel %on| at x: %x| y: %y",
 | 
			
		||||
  "screen|block": "screen",
 | 
			
		||||
  "serial|block": "serial",
 | 
			
		||||
  "{id:category}Brick": "Brick",
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
namespace screen {
 | 
			
		||||
namespace brick {
 | 
			
		||||
    //% shim=screen::_setPixel
 | 
			
		||||
    function _setPixel(p0: uint32, p1: uint32, mode: Draw): void { }
 | 
			
		||||
 | 
			
		||||
@@ -85,7 +85,7 @@ namespace screen {
 | 
			
		||||
     * @param y the starting position's x coordinate, eg: 0
 | 
			
		||||
     */
 | 
			
		||||
    //% blockId=screen_setpixel block="set pixel %on| at x: %x| y: %y"
 | 
			
		||||
    //% weight=98 group="Brick" blockNamespace=brick
 | 
			
		||||
    //% weight=98 group="Brick"
 | 
			
		||||
    //% x.min=0 x.max=178 y.min=0 y.max=128 on.fieldEditor=toggleonoff
 | 
			
		||||
    export function setPixel(on: boolean, x: number, y: number) {
 | 
			
		||||
        x |= 0
 | 
			
		||||
@@ -101,7 +101,7 @@ namespace screen {
 | 
			
		||||
     * @param y the starting position's x coordinate, eg: 0
 | 
			
		||||
     */
 | 
			
		||||
    //% blockId=screen_print block="print %text| at x: %x| y: %y"
 | 
			
		||||
    //% weight=99 group="Brick" blockNamespace=brick inlineInputMode="inline"
 | 
			
		||||
    //% weight=99 group="Brick" inlineInputMode="inline"
 | 
			
		||||
    //% x.min=0 x.max=178 y.min=0 y.max=128
 | 
			
		||||
    export function print(text: string, x: number, y: number, mode = Draw.Normal) {
 | 
			
		||||
        x |= 0
 | 
			
		||||
@@ -127,7 +127,7 @@ namespace screen {
 | 
			
		||||
                iconBuf.fill(0, 2)
 | 
			
		||||
            else
 | 
			
		||||
                iconBuf.write(2, currFont.data.slice(idx, charSize))
 | 
			
		||||
            drawIcon(x, y, iconBuf, mode)
 | 
			
		||||
            screen.drawIcon(x, y, iconBuf, mode)
 | 
			
		||||
            x += double * currFont.charWidth
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user