-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfieldeditors.ts
81 lines (75 loc) · 2.54 KB
/
fieldeditors.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/**
* Bitmap manipulation blocks
*/
namespace bitmaps {
//% blockNamespace="drawing"
//% blockId=bitmapCreate
//% block="create bitmap width $width height $height"
//% weight=78
//% group="Create"
//% blockAliasFor="bitmaps.create"
//% help=github:display-shield/docs/create
//% width.defl=16
//% height.defl=16
export function _create(width: number, height: number): Bitmap {
return bitmaps.create(width, height);
}
/**
* A bitmap
* @param bitmap the bitmap
*/
//% blockId=bitmap_assign block="$bitmap" shim=TD_ID
//% bitmap.fieldEditor="sprite"
//% bitmap.fieldOptions.taggedTemplate="bmp"
//% bitmap.fieldOptions.decompileArgumentAsString="true"
//% weight=90
//% group="Create"
//% blockSetVariable=bitmap
//% blockNamespace="drawing"
export function __bitmap(bitmap: Bitmap): Bitmap {
return bitmap;
}
/**
* A bitmap
* @param bitmap the bitmap
*/
//% blockId=bitmap_picker block="$bitmap" shim=TD_ID
//% bitmap.fieldEditor="sprite"
//% bitmap.fieldOptions.taggedTemplate="bmp"
//% bitmap.fieldOptions.decompileArgumentAsString="true"
//% weight=85
//% group="Create"
//% help=github:display-shield/docs/bitmap
//% blockAliasFor="bitmaps.create"
//% blockNamespace="drawing"
export function _bitmap(bitmap: Bitmap): Bitmap {
return bitmap;
}
//% blockId=colorindexpicker block="$index" blockHidden=true shim=TD_ID
//% index.fieldEditor="colornumber"
//% index.fieldOptions.valueMode="index"
//% index.fieldOptions.colours='["#000000","#ffffff","#ff2121","#ff93c4","#ff8135","#fff609","#249ca3","#78dc52","#003fad","#87f2ff","#8e2ec4","#a4839f","#5c406c","#e5cdc4","#91463d","#000000"]'
//% index.fieldOptions.decompileLiterals="true"
export function __colorIndexPicker(index: number) {
return index;
}
}
//% blockIdentity=bitmaps._bitmap
const defaultBitmap: Bitmap = bmp`
. . . . . . . . . . . . . . . .
. 1 1 1 1 1 1 1 1 1 1 1 1 1 1 .
. 1 . . . . . . . . . . . . 1 .
. 1 . . . . . . . . . . . . 1 .
. 1 . . . . . . . . . . . . 1 .
. 1 . . . . . . . . . . . . 1 .
. 1 . . . . . . . . . . . . 1 .
. 1 . . . . . . . . . . . . 1 .
. 1 . . . . . . . . . . . . 1 .
. 1 . . . . . . . . . . . . 1 .
. 1 . . . . . . . . . . . . 1 .
. 1 . . . . . . . . . . . . 1 .
. 1 . . . . . . . . . . . . 1 .
. 1 . . . . . . . . . . . . 1 .
. 1 1 1 1 1 1 1 1 1 1 1 1 1 1 .
. . . . . . . . . . . . . . . .
`