Skip to content

Commit 725368d

Browse files
committed
Finished snippets and converted all optional values to captive commas for easy deletion
1 parent 8ceef64 commit 725368d

File tree

8 files changed

+285
-53
lines changed

8 files changed

+285
-53
lines changed

snippets/audio.json

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,20 @@
11
{
2-
"audio.musicsimple": {
3-
"prefix": "music",
4-
"scope": "pico8p8",
5-
"body": [
6-
"music(${1:pattern})",
7-
"$0"
8-
],
9-
"description": "Simple Play music (-1 = stop)"
10-
},
112
"audio.music": {
12-
"prefix": "musicf",
13-
"scope": "pico8p8",
14-
"body": [
15-
"music(${1:pattern},${2:fade_ms},${3:channel_mask})",
16-
"$0"
17-
],
18-
"description": "Full Play music (-1 = stop)"
19-
},
20-
"audio.sfxsimple": {
21-
"prefix": "sfx",
3+
"prefix": "music",
224
"scope": "pico8p8",
235
"body": [
24-
"sfx(${1:sfx_number})",
6+
"music(${1:pattern}${2:,optional_fade_ms}${3:,optional_channel_mask})",
257
"$0"
268
],
27-
"description": "Simple play sfx"
9+
"description": "Play music (-1 = stop)"
2810
},
2911
"audio.sfx": {
30-
"prefix": "sfxf",
12+
"prefix": "sfx",
3113
"scope": "pico8p8",
3214
"body": [
33-
"sfx(${1:sfx_number},${2:channel},${3:offset})",
15+
"sfx(${1:sfx_number}${2:,optional_channel}${3:,optional_offset})",
3416
"$0"
3517
],
36-
"description": "Full play sfx"
18+
"description": "Play sfx"
3719
}
3820
}

snippets/basics.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@
2929
],
3030
"description": "For in all loop"
3131
},
32+
"for_pairs_loop": {
33+
"prefix": "forpair",
34+
"scope": "pico8p8",
35+
"body": [
36+
"for ${1:key},${2:value} in pairs(${3:table}) do",
37+
"\t$0",
38+
"end"
39+
],
40+
"description": "For in all pairs loop"
41+
},
3242
"while_loop": {
3343
"prefix": "while",
3444
"scope": "pico8p8",

snippets/graphics.json

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@
7272
"description": "Gets the sprite's flag"
7373
},
7474
"graphics.fset": {
75-
"prefix": "fget",
75+
"prefix": "fset",
7676
"scope": "pico8p8",
7777
"body": [
78-
"fget(${1:sprite_index},${2:optional_flag_index},${3:value})",
78+
"fset(${1:sprite_index},${2:optional_flag_index},${3:value})",
7979
"$0"
8080
],
8181
"description": "Sets the sprite's flag"
@@ -179,41 +179,23 @@
179179
],
180180
"description": "Sets the spritesheet value of the pixel at the given coords"
181181
},
182-
"graphics.sprsimple": {
182+
"graphics.spr": {
183183
"prefix": "spr",
184184
"scope": "pico8p8",
185185
"body": [
186-
"spr(${1:sprite_number},${2:x},${3:y})",
187-
"$0"
188-
],
189-
"description": "Simple draw sprite at given coords"
190-
},
191-
"graphics.sprfull": {
192-
"prefix": "sprf",
193-
"scope": "pico8p8",
194-
"body": [
195-
"spr(${1:sprite_number},${2:x},${3:y},${4:width},${5:height},${6:flip_x},${7:flip_y})",
186+
"spr(${1:sprite_number},${2:x},${3:y}${4:,optional_width}${5:,optional_height}${6:,optional_flip_x}${7:,optional_flip_y})",
196187
"$0"
197188
],
198189
"description": "Full draw sprite at given coords with given size and flip flags"
199190
},
200-
"graphics.ssprsimple": {
191+
"graphics.sspr": {
201192
"prefix": "sspr",
202193
"scope": "pico8p8",
203194
"body": [
204-
"sspr(${1:spritesheet_x},${2:spritesheet_y},${3:spritesheet_width},${4:spritesheet_height},${5:x},${6:y})",
205-
"$0"
206-
],
207-
"description": "Simple draw sprite sheet texture at given coords"
208-
},
209-
"graphics.ssprfull": {
210-
"prefix": "ssprf",
211-
"scope": "pico8p8",
212-
"body": [
213-
"sspr(${1:spritesheet_x},${2:spritesheet_y},${3:spritesheet_width},${4:spritesheet_height},${5:x},${6:y},${7:width},${8:height},${9:flip_x},${10:flip_y})",
195+
"sspr(${1:spritesheet_x},${2:spritesheet_y},${3:spritesheet_width},${4:spritesheet_height},${5:x},${6:y}${7:,optional_width}${8:,optional_height}${9:,optional_flip_x}${10:,optional_flip_y})",
214196
"$0"
215197
],
216-
"description": "Simple draw sprite sheet texture at given coords"
198+
"description": "Draw sprite sheet texture at given coords"
217199
},
218200
"graphics.fillp": {
219201
"prefix": "fillp",

snippets/input.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"prefix": "btn",
44
"scope": "pico8p8",
55
"body": [
6-
"btn(${1|left,right,up,down,fire1,fire2|},${2|1,2|})",
6+
"btn(${1|left,right,up,down,fire1,fire2|}${2,optional_player_number})",
77
"$0"
88
],
99
"description": "Get button state for given player (see pconsts for constants)"
@@ -12,7 +12,7 @@
1212
"prefix": "btnp",
1313
"scope": "pico8p8",
1414
"body": [
15-
"btnp(${1|left,right,up,down,fire1,fire2|},${2|1,2|})",
15+
"btnp(${1|left,right,up,down,fire1,fire2|}${2,optional_player_number})",
1616
"$0"
1717
],
1818
"description": "Get 'repeating' button state for given player (see pconsts for constants)"

snippets/math.json

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,103 @@
4040
"bxor(${1:x},${1:y})"
4141
],
4242
"description": "Bitwise XOR"
43+
},
44+
"math.flr": {
45+
"prefix": "flr",
46+
"body": [
47+
"flr(${1:x})"
48+
],
49+
"description": "Round down"
50+
},
51+
"math.round": {
52+
"prefix": "round",
53+
"body": [
54+
"flr(${1:x}+0.5)"
55+
],
56+
"description": "Round number"
57+
},
58+
"math.ceil": {
59+
"prefix": "ceil",
60+
"body": [
61+
"ceil(${1:x})"
62+
],
63+
"description": "Round up"
64+
},
65+
"math.min": {
66+
"prefix": "min",
67+
"body": [
68+
"min(${1:x},${2:y})"
69+
],
70+
"description": "Returns the lowest of the two values"
71+
},
72+
"math.max": {
73+
"prefix": "max",
74+
"body": [
75+
"max(${1:x},${2:y})"
76+
],
77+
"description": "Returns the highest of the two values"
78+
},
79+
"math.mid": {
80+
"prefix": "mid",
81+
"body": [
82+
"mid(${1:x},${2:y},${3:z})"
83+
],
84+
"description": "Returns the max, min or middle number e.g. x=mid(min_x, x, max_x) will make sure x is between the min and max values."
85+
},
86+
"math.srand": {
87+
"prefix": "srand",
88+
"body": [
89+
"srand(${1:x})"
90+
],
91+
"description": "Set random seed for rnd"
92+
},
93+
"math.rnd": {
94+
"prefix": "rnd",
95+
"body": [
96+
"rnd(${1:x})"
97+
],
98+
"description": "Returns a random number in the range 0-x (remember to round before using for array/sprite indexes!)"
99+
},
100+
"math.sgn": {
101+
"prefix": "sgn",
102+
"body": [
103+
"sgn(${1:x})"
104+
],
105+
"description": "Returns sign of x e.g. -1 or 1"
106+
},
107+
"math.shl": {
108+
"prefix": "shl",
109+
"body": [
110+
"shl(${1:x},${2:n})"
111+
],
112+
"description": "Bitwise shift x left n times"
113+
},
114+
"math.shr": {
115+
"prefix": "shr",
116+
"body": [
117+
"shr(${1:x},${2:n})"
118+
],
119+
"description": "Bitwise shift x right n times"
120+
},
121+
"math.sin": {
122+
"prefix": "sin",
123+
"body": [
124+
"sin(${1:x})"
125+
],
126+
"description": "Sine of x (inverted), returns a value between 0 and 1"
127+
},
128+
"math.cos": {
129+
"prefix": "cos",
130+
"body": [
131+
"cos(${1:x})"
132+
],
133+
"description": "Cosine of x, returns a value between 0 and 1"
134+
},
135+
"math.sqrt": {
136+
"prefix": "sqrt",
137+
"body": [
138+
"sqrt(${1:x})"
139+
],
140+
"description": "Square root of x"
43141
}
44142
}

snippets/memory.json

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,48 @@
11
{
2-
2+
"memory.cstore": {
3+
"prefix": "cstore",
4+
"body": [
5+
"cstore(${1:dest_address},${2:src_address},${3:length}${4:,optional_filename})",
6+
"$0"
7+
],
8+
"description": "Copy bytes from ram to filename"
9+
},
10+
"memory.memcpy": {
11+
"prefix": "memcpy",
12+
"body": [
13+
"memcpy(${1:dest_address},${2:source_address},${3:length})",
14+
"$0"
15+
],
16+
"description": "Copy memory"
17+
},
18+
"memory.memset": {
19+
"prefix": "memset",
20+
"body": [
21+
"memset(${1:dest_address},${2:value},${3:length})",
22+
"$0"
23+
],
24+
"description": "Set memory to value from dest_address for length bytes"
25+
},
26+
"memory.peek": {
27+
"prefix": "peek",
28+
"body": [
29+
"peek(${1:address})"
30+
],
31+
"description": "Read byte from RAM"
32+
},
33+
"memory.poke": {
34+
"prefix": "poke",
35+
"body": [
36+
"poke(${1:address},${1:value})"
37+
],
38+
"description": "Write byte to RAM"
39+
},
40+
"memory.reload": {
41+
"prefix": "reload",
42+
"body": [
43+
"reload(${1:dest_address},${2:src_address},${3:length}${4:,optional_filename})",
44+
"$0"
45+
],
46+
"description": "Load a section of cartridge into RAM"
47+
}
348
}

snippets/peekpoke.json

Lines changed: 98 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,100 @@
11
{
2-
2+
"peekpoke.gpiow": {
3+
"prefix": "gpiow",
4+
"body": [
5+
"poke(0x5f80+${1:pin_index},${2:value})"
6+
],
7+
"description": "Write to GPIO"
8+
},
9+
"peekpoke.gpior": {
10+
"prefix": "gpior",
11+
"body": [
12+
"peek(0x5f80+${1:pin_index})"
13+
],
14+
"description": "Read from GPIO"
15+
},
16+
"peekpoke.memgfx": {
17+
"prefix": "memgfx",
18+
"body": [
19+
"0x0"
20+
],
21+
"description": "Base address for graphics (sprite sheet) memory"
22+
},
23+
"peekpoke.memgfx2": {
24+
"prefix": "memgfx2",
25+
"body": [
26+
"0x1000"
27+
],
28+
"description": "Base address for graphics/map shared memory"
29+
},
30+
"peekpoke.memmap": {
31+
"prefix": "memmap",
32+
"body": [
33+
"0x2000"
34+
],
35+
"description": "Base address for map memory"
36+
},
37+
"peekpoke.memgfxprops": {
38+
"prefix": "memgfxprops",
39+
"body": [
40+
"0x3000"
41+
],
42+
"description": "Base address for graphics props memory"
43+
},
44+
"peekpoke.memsong": {
45+
"prefix": "memsong",
46+
"body": [
47+
"0x3100"
48+
],
49+
"description": "Base address for song memory"
50+
},
51+
"peekpoke.memsfx": {
52+
"prefix": "memsfx",
53+
"body": [
54+
"0x3200"
55+
],
56+
"description": "Base address for sfx memory"
57+
},
58+
"peekpoke.memud": {
59+
"prefix": "memud",
60+
"body": [
61+
"0x4300"
62+
],
63+
"description": "Base address for user data memory"
64+
},
65+
"peekpoke.memcd": {
66+
"prefix": "memcd",
67+
"body": [
68+
"0x5e00"
69+
],
70+
"description": "Base address for persistent cart data memory"
71+
},
72+
"peekpoke.memds": {
73+
"prefix": "memds",
74+
"body": [
75+
"0x5f00"
76+
],
77+
"description": "Base address for draw state memory"
78+
},
79+
"peekpoke.memhs": {
80+
"prefix": "memhs",
81+
"body": [
82+
"0x5f40"
83+
],
84+
"description": "Base address for hardware state memory"
85+
},
86+
"peekpoke.memgpio": {
87+
"prefix": "memgpio",
88+
"body": [
89+
"0x5f80"
90+
],
91+
"description": "Base address for gpio pin memory"
92+
},
93+
"peekpoke.memscr": {
94+
"prefix": "memscr",
95+
"body": [
96+
"0x6000"
97+
],
98+
"description": "Base address for screen memory"
99+
}
3100
}

0 commit comments

Comments
 (0)