Add images back (#176)
* add image and deprecated arrow functions * update locales Co-authored-by: JW <gitkraken@juriwolf.de> Co-authored-by: Juri <info@juriwolf.de>
This commit is contained in:
parent
e2b28e7847
commit
3b9d90e551
@ -266,6 +266,9 @@
|
||||
"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.showArrow": "Draws an arrow on the LED screen",
|
||||
"basic.showArrow|param|direction": "the direction of the arrow",
|
||||
"basic.showArrow|param|interval": "the amount of time (milliseconds) to show the icon. Default is 600.",
|
||||
"basic.showCompass": "Draws needle on the screen which always points to north",
|
||||
"basic.showCompass|param|interval": "the amount of time (milliseconds) to show the needle. Default is 600.",
|
||||
"basic.showIcon": "Draws the selected icon on the LED screen",
|
||||
|
@ -22,6 +22,14 @@
|
||||
"Array.shift|block": "get and remove first value from %list",
|
||||
"Array.unshift|block": "%list| insert %value| at beginning",
|
||||
"Array|block": "Array",
|
||||
"ArrowNames.East|block": "East",
|
||||
"ArrowNames.NorthEast|block": "North East",
|
||||
"ArrowNames.NorthWest|block": "North West",
|
||||
"ArrowNames.North|block": "North",
|
||||
"ArrowNames.SouthEast|block": "South East",
|
||||
"ArrowNames.SouthWest|block": "South West",
|
||||
"ArrowNames.South|block": "South",
|
||||
"ArrowNames.West|block": "West",
|
||||
"BaudRate.BaudRate115200|block": "115200",
|
||||
"BaudRate.BaudRate1200|block": "1200",
|
||||
"BaudRate.BaudRate14400|block": "14400",
|
||||
@ -109,16 +117,43 @@
|
||||
"IconNames.ArrowSouth|block": "arrow south",
|
||||
"IconNames.ArrowWest|block": "arrow west",
|
||||
"IconNames.Asleep|block": "asleep",
|
||||
"IconNames.Butterfly|block": "butterfly",
|
||||
"IconNames.Chessboard|block": "chess board",
|
||||
"IconNames.Confused|block": "confused",
|
||||
"IconNames.Cow|block": "cow",
|
||||
"IconNames.Diamond|block": "diamond",
|
||||
"IconNames.Duck|block": "duck",
|
||||
"IconNames.EigthNote|block": "eigth note",
|
||||
"IconNames.Fabulous|block": "fabulous",
|
||||
"IconNames.Ghost|block": "ghost",
|
||||
"IconNames.Giraffe|block": "giraffe",
|
||||
"IconNames.Happy|block": "happy",
|
||||
"IconNames.Heart|block": "heart",
|
||||
"IconNames.House|block": "house",
|
||||
"IconNames.LeftTriangle|block": "left triangle",
|
||||
"IconNames.Meh|block": "meh",
|
||||
"IconNames.No|block": "no",
|
||||
"IconNames.Pitchfork|block": "pitchfork",
|
||||
"IconNames.QuarterNote|block": "quarter note",
|
||||
"IconNames.Rabbit|block": "rabbit",
|
||||
"IconNames.Rollerskate|block": "roller skate",
|
||||
"IconNames.Sad|block": "sad",
|
||||
"IconNames.Scissors|block": "scissors",
|
||||
"IconNames.Silly|block": "silly",
|
||||
"IconNames.Skull|block": "skull",
|
||||
"IconNames.SmallDiamond|block": "small diamond",
|
||||
"IconNames.SmallHeart|block": "small heart",
|
||||
"IconNames.SmallSquare|block": "small square",
|
||||
"IconNames.Snake|block": "snake",
|
||||
"IconNames.Square|block": "square",
|
||||
"IconNames.StickFigure|block": "stick figure",
|
||||
"IconNames.Surprised|block": "surprised",
|
||||
"IconNames.Sword|block": "sword",
|
||||
"IconNames.TShirt|block": "t-shirt",
|
||||
"IconNames.Target|block": "target",
|
||||
"IconNames.Tortoise|block": "tortoise",
|
||||
"IconNames.Triangle|block": "triangle",
|
||||
"IconNames.Umbrella|block": "umbrella",
|
||||
"IconNames.Yes|block": "yes",
|
||||
"Image.scrollImage|block": "scroll image %sprite(myImage)|with offset %frameoffset|and interval (ms) %delay",
|
||||
"Image.showImage|block": "show image %sprite(myImage)|at offset %offset ||and interval (ms) %interval",
|
||||
@ -244,6 +279,7 @@
|
||||
"basic.rgbw|block": "red %red|green %green|blue %blue|white %white",
|
||||
"basic.rgb|block": "red %red|green %green|blue %blue",
|
||||
"basic.setLedColor|block": "set led to %color=colorNumberPicker",
|
||||
"basic.showArrow|block": "show arrow %i=device_arrow",
|
||||
"basic.showCompass|block": "show compass needle for $interval|ms",
|
||||
"basic.showIcon|block": "show icon %i || for %interval ms",
|
||||
"basic.showLeds|block": "show leds",
|
||||
@ -292,6 +328,8 @@
|
||||
"game.setScore|block": "set score %points",
|
||||
"game.startCountdown|block": "start countdown|(ms) %duration",
|
||||
"game|block": "game",
|
||||
"images.arrowImage|block": "arrow image %i",
|
||||
"images.arrowNumber|block": "%arrow",
|
||||
"images.createBigImage|block": "create big image",
|
||||
"images.createImage|block": "create image",
|
||||
"images.iconImage|block": "icon image %i",
|
||||
|
@ -65,6 +65,87 @@ enum IconNames {
|
||||
//% block="meh"
|
||||
//% jres=icons.meh
|
||||
Meh,
|
||||
//% block="t-shirt"
|
||||
//% jres=icons.tshirt
|
||||
TShirt,
|
||||
//% block="roller skate"
|
||||
//% jres=icons.rollerskate
|
||||
Rollerskate,
|
||||
//% block="duck"
|
||||
//% jres=icons.duck
|
||||
Duck,
|
||||
//% block="house"
|
||||
//% jres=icons.house
|
||||
House,
|
||||
//% block="tortoise"
|
||||
//% jres=icons.tortoise
|
||||
Tortoise,
|
||||
//% block="butterfly"
|
||||
//% jres=icons.butterfly
|
||||
Butterfly,
|
||||
//% block="stick figure"
|
||||
//% jres=icons.stickfigure
|
||||
StickFigure,
|
||||
//% block="ghost"
|
||||
//% jres=icons.ghost
|
||||
Ghost,
|
||||
//% block="sword"
|
||||
//% jres=icons.sword
|
||||
Sword,
|
||||
//% block="giraffe"
|
||||
//% jres=icons.giraffe
|
||||
Giraffe,
|
||||
//% block="skull"
|
||||
//% jres=icons.skull
|
||||
Skull,
|
||||
//% block="umbrella"
|
||||
//% jres=icons.umbrella
|
||||
Umbrella,
|
||||
//% block="snake"
|
||||
//% jres=icons.snake
|
||||
Snake,
|
||||
//% block="rabbit"
|
||||
//% jres=icons.rabbit
|
||||
Rabbit,
|
||||
//% block="cow"
|
||||
//% jres=icons.cow
|
||||
Cow,
|
||||
//% block="quarter note"
|
||||
//% jres=icons.quarternote
|
||||
QuarterNote,
|
||||
//% block="eigth note"
|
||||
//% jres=icons.eigthnote
|
||||
EigthNote,
|
||||
//% block="pitchfork"
|
||||
//% jres=icons.pitchfork
|
||||
Pitchfork,
|
||||
//% block="target"
|
||||
//% jres=icons.target
|
||||
Target,
|
||||
//% block="triangle"
|
||||
//% jres=icons.triangle
|
||||
Triangle,
|
||||
//% block="left triangle"
|
||||
//% jres=icons.lefttriangle
|
||||
LeftTriangle,
|
||||
//% block="chess board"
|
||||
//% jres=icons.chessboard
|
||||
Chessboard,
|
||||
//% block="diamond"
|
||||
//% jres=icons.diamond
|
||||
Diamond,
|
||||
//% block="small diamond"
|
||||
//% jres=icons.smalldiamond
|
||||
SmallDiamond,
|
||||
//% block="square"
|
||||
//% jres=icons.square
|
||||
Square,
|
||||
//% block="small square"
|
||||
//% jres=icons.smallsquare
|
||||
SmallSquare,
|
||||
//% block="scissors"
|
||||
//% jres=icons.scissors
|
||||
Scissors,
|
||||
//% block="arrow north"
|
||||
//% jres=icons.arrownorth
|
||||
ArrowNorth,
|
||||
@ -91,6 +172,24 @@ enum IconNames {
|
||||
ArrowNorthWest
|
||||
}
|
||||
|
||||
enum ArrowNames {
|
||||
//% blockIdentity=images.arrowNumber block="North"
|
||||
North = 0,
|
||||
//% blockIdentity=images.arrowNumber block="North East"
|
||||
NorthEast,
|
||||
//% blockIdentity=images.arrowNumber block="East"
|
||||
East,
|
||||
//% blockIdentity=images.arrowNumber block="South East"
|
||||
SouthEast,
|
||||
//% blockIdentity=images.arrowNumber block="South"
|
||||
South,
|
||||
//% blockIdentity=images.arrowNumber block="South West"
|
||||
SouthWest,
|
||||
//% blockIdentity=images.arrowNumber block="West"
|
||||
West,
|
||||
//% blockIdentity=images.arrowNumber block="North West"
|
||||
NorthWest
|
||||
}
|
||||
|
||||
namespace basic {
|
||||
|
||||
@ -116,11 +215,92 @@ namespace basic {
|
||||
res.showImage(0, interval)
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws an arrow on the LED screen
|
||||
* @param direction the direction of the arrow
|
||||
* @param interval the amount of time (milliseconds) to show the icon. Default is 600.
|
||||
*/
|
||||
//% weight=50 blockGap=8
|
||||
//% blockId=basic_show_arrow
|
||||
//% block="show arrow %i=device_arrow"
|
||||
//% parts="ledmatrix"
|
||||
//% advanced=true
|
||||
//% help=basic/show-arrow
|
||||
//% deprecated=true
|
||||
export function showArrow(direction: number, interval = 600) {
|
||||
let res = images.arrowImage(direction)
|
||||
res.showImage(0, interval)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace images {
|
||||
|
||||
//% weight=50 blockGap=8
|
||||
//% help=images/arrow-image
|
||||
//% blockId=builtin_arrow_image block="arrow image %i"
|
||||
//% deprecated=true
|
||||
export function arrowImage(i: ArrowNames): Image {
|
||||
switch (i) {
|
||||
// compass directions
|
||||
case ArrowNames.North: return images.createImage(`
|
||||
. . # . .
|
||||
. # # # .
|
||||
# . # . #
|
||||
. . # . .
|
||||
. . # . .`);
|
||||
case ArrowNames.NorthEast: return images.createImage(`
|
||||
. . # # #
|
||||
. . . # #
|
||||
. . # . #
|
||||
. # . . .
|
||||
# . . . .`);
|
||||
case ArrowNames.East: return images.createImage(`
|
||||
. . # . .
|
||||
. . . # .
|
||||
# # # # #
|
||||
. . . # .
|
||||
. . # . .`);
|
||||
case ArrowNames.SouthEast: return images.createImage(`
|
||||
# . . . .
|
||||
. # . . .
|
||||
. . # . #
|
||||
. . . # #
|
||||
. . # # #`);
|
||||
case ArrowNames.South: return images.createImage(`
|
||||
. . # . .
|
||||
. . # . .
|
||||
# . # . #
|
||||
. # # # .
|
||||
. . # . .`);
|
||||
case ArrowNames.SouthWest: return images.createImage(`
|
||||
. . . . #
|
||||
. . . # .
|
||||
# . # . .
|
||||
# # . . .
|
||||
# # # . .`);
|
||||
case ArrowNames.West: return images.createImage(`
|
||||
. . # . .
|
||||
. # . . .
|
||||
# # # # #
|
||||
. # . . .
|
||||
. . # . .`);
|
||||
case ArrowNames.NorthWest: return images.createImage(`
|
||||
# # # . .
|
||||
# # . . .
|
||||
# . # . .
|
||||
. . . # .
|
||||
. . . . #`);
|
||||
default: return images.createImage(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
`);
|
||||
}
|
||||
}
|
||||
|
||||
//% weight=50 blockGap=8
|
||||
//% help=images/icon-image
|
||||
//% blockId=builtin_image block="icon image %i"
|
||||
@ -210,6 +390,173 @@ namespace images {
|
||||
. . # . .
|
||||
. # . # .
|
||||
# . . . #`);
|
||||
case IconNames.Triangle: return images.createImage(`
|
||||
. . . . .
|
||||
. . # . .
|
||||
. # . # .
|
||||
# # # # #
|
||||
. . . . .`);
|
||||
case IconNames.LeftTriangle: return images.createImage(`
|
||||
# . . . .
|
||||
# # . . .
|
||||
# . # . .
|
||||
# . . # .
|
||||
# # # # #`);
|
||||
case IconNames.Chessboard: return images.createImage(`
|
||||
. # . # .
|
||||
# . # . #
|
||||
. # . # .
|
||||
# . # . #
|
||||
. # . # .`);
|
||||
case IconNames.Diamond: return images.createImage(`
|
||||
. . # . .
|
||||
. # . # .
|
||||
# . . . #
|
||||
. # . # .
|
||||
. . # . .`);
|
||||
case IconNames.SmallDiamond: return images.createImage(`
|
||||
. . . . .
|
||||
. . # . .
|
||||
. # . # .
|
||||
. . # . .
|
||||
. . . . .`);
|
||||
case IconNames.Square: return images.createImage(`
|
||||
# # # # #
|
||||
# . . . #
|
||||
# . . . #
|
||||
# . . . #
|
||||
# # # # #`);
|
||||
case IconNames.SmallSquare: return images.createImage(`
|
||||
. . . . .
|
||||
. # # # .
|
||||
. # . # .
|
||||
. # # # .
|
||||
. . . . .`);
|
||||
|
||||
case IconNames.Scissors: return images.createImage(`
|
||||
# # . . #
|
||||
# # . # .
|
||||
. . # . .
|
||||
# # . # .
|
||||
# # . . #`);
|
||||
// The following images were designed by Abbie Brooks.
|
||||
case IconNames.TShirt: return images.createImage(`
|
||||
# # . # #
|
||||
# # # # #
|
||||
. # # # .
|
||||
. # # # .
|
||||
. # # # .`);
|
||||
case IconNames.Rollerskate: return images.createImage(`
|
||||
. . . # #
|
||||
. . . # #
|
||||
# # # # #
|
||||
# # # # #
|
||||
. # . # .`);
|
||||
case IconNames.Duck: return images.createImage(`
|
||||
. # # . .
|
||||
# # # . .
|
||||
. # # # #
|
||||
. # # # .
|
||||
. . . . .`);
|
||||
case IconNames.House: return images.createImage(`
|
||||
. . # . .
|
||||
. # # # .
|
||||
# # # # #
|
||||
. # # # .
|
||||
. # . # .`);
|
||||
case IconNames.Tortoise: return images.createImage(`
|
||||
. . . . .
|
||||
. # # # .
|
||||
# # # # #
|
||||
. # . # .
|
||||
. . . . .`);
|
||||
case IconNames.Butterfly: return images.createImage(`
|
||||
# # . # #
|
||||
# # # # #
|
||||
. . # . .
|
||||
# # # # #
|
||||
# # . # #`);
|
||||
case IconNames.StickFigure: return images.createImage(`
|
||||
. . # . .
|
||||
# # # # #
|
||||
. . # . .
|
||||
. # . # .
|
||||
# . . . #`);
|
||||
case IconNames.Ghost: return images.createImage(`
|
||||
. # # # .
|
||||
# . # . #
|
||||
# # # # #
|
||||
# # # # #
|
||||
# . # . #`);
|
||||
case IconNames.Sword: return images.createImage(`
|
||||
. . # . .
|
||||
. . # . .
|
||||
. . # . .
|
||||
. # # # .
|
||||
. . # . .`);
|
||||
case IconNames.Giraffe: return images.createImage(`
|
||||
# # . . .
|
||||
. # . . .
|
||||
. # . . .
|
||||
. # # # .
|
||||
. # . # .`);
|
||||
case IconNames.Skull: return images.createImage(`
|
||||
. # # # .
|
||||
# . # . #
|
||||
# # # # #
|
||||
. # # # .
|
||||
. # # # .`);
|
||||
case IconNames.Umbrella: return images.createImage(`
|
||||
. # # # .
|
||||
# # # # #
|
||||
. . # . .
|
||||
# . # . .
|
||||
# # # . .`);
|
||||
case IconNames.Snake: return images.createImage(`
|
||||
# # . . .
|
||||
# # . # #
|
||||
. # . # .
|
||||
. # # # .
|
||||
. . . . .`);
|
||||
// animals
|
||||
case IconNames.Rabbit: return images.createImage(`
|
||||
# . # . .
|
||||
# . # . .
|
||||
# # # # .
|
||||
# # . # .
|
||||
# # # # .`);
|
||||
case IconNames.Cow: return images.createImage(`
|
||||
# . . . #
|
||||
# . . . #
|
||||
# # # # #
|
||||
. # # # .
|
||||
. . # . .`);
|
||||
// musical notes
|
||||
case IconNames.QuarterNote: return images.createImage(`
|
||||
. . # . .
|
||||
. . # . .
|
||||
. . # . .
|
||||
# # # . .
|
||||
# # # . .`);
|
||||
case IconNames.EigthNote: return images.createImage(`
|
||||
. . # . .
|
||||
. . # # .
|
||||
. . # . #
|
||||
# # # . .
|
||||
# # # . .`);
|
||||
// other icons
|
||||
case IconNames.Pitchfork: return images.createImage(`
|
||||
# . # . #
|
||||
# . # . #
|
||||
# # # # #
|
||||
. . # . .
|
||||
. . # . .`);
|
||||
case IconNames.Target: return images.createImage(`
|
||||
. . # . .
|
||||
. # # # .
|
||||
# # . # #
|
||||
. # # # .
|
||||
. . # . .`);
|
||||
// arrows
|
||||
case IconNames.ArrowNorth: return images.createImage(`
|
||||
. . # . .
|
||||
@ -269,4 +616,12 @@ namespace images {
|
||||
}
|
||||
}
|
||||
|
||||
//% weight=50 blockGap=8
|
||||
//% help=images/arrow-number
|
||||
//% blockId=device_arrow block="%arrow"
|
||||
//% shim=TD_ID
|
||||
//% deprecated=true
|
||||
export function arrowNumber(arrow: ArrowNames): number {
|
||||
return arrow;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user