@oidoid/void 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/public/index.js +7 -7
- package/dist/public/index.js.map +4 -4
- package/dist/public/{void-v0.1.5+20260105.39743a9.html → void-v0.1.7+20260106.c6b562a.html} +8 -8
- package/dist/src/demo/ents/cam.d.ts.map +1 -1
- package/dist/src/demo/ents/cam.js +2 -8
- package/dist/src/demo/ents/cam.js.map +1 -1
- package/dist/src/ents/cursor.d.ts.map +1 -1
- package/dist/src/ents/cursor.js +7 -2
- package/dist/src/ents/cursor.js.map +1 -1
- package/dist/src/ents/ent.d.ts +1 -1
- package/dist/src/ents/ent.d.ts.map +1 -1
- package/dist/src/ents/fps.d.ts +2 -1
- package/dist/src/ents/fps.d.ts.map +1 -1
- package/dist/src/ents/fps.js +5 -6
- package/dist/src/ents/fps.js.map +1 -1
- package/dist/src/ents/zoo.js +1 -2
- package/dist/src/ents/zoo.js.map +1 -1
- package/dist/src/graphics/cam.d.ts +1 -1
- package/dist/src/graphics/cam.d.ts.map +1 -1
- package/dist/src/input/gamepad.d.ts.map +1 -1
- package/dist/src/input/gamepad.js +5 -2
- package/dist/src/input/gamepad.js.map +1 -1
- package/dist/src/input/input.d.ts.map +1 -1
- package/dist/src/input/input.js +8 -5
- package/dist/src/input/input.js.map +1 -1
- package/dist/src/level/level-parser.js +1 -1
- package/dist/src/level/level-parser.js.map +1 -1
- package/dist/src/void.d.ts +2 -1
- package/dist/src/void.d.ts.map +1 -1
- package/dist/src/void.js +1 -0
- package/dist/src/void.js.map +1 -1
- package/dist/tools/bundle/bundle.d.ts.map +1 -1
- package/dist/tools/bundle/bundle.js +6 -4
- package/dist/tools/bundle/bundle.js.map +1 -1
- package/package.json +4 -3
- package/readme.md +1 -1
- package/schema/config-file.v0.json +83 -0
- package/schema/level-file.v0.json +443 -0
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://oidoid.github.io/void/level-file.v0.json",
|
|
4
|
+
"title": "void Level File Schema",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"description": "a JSON representation of a void level file.",
|
|
7
|
+
"$defs": {
|
|
8
|
+
"Border": {
|
|
9
|
+
"description": "border area config.",
|
|
10
|
+
"oneOf": [
|
|
11
|
+
{"type": "integer", "minimum": 0},
|
|
12
|
+
{"$ref": "#/$defs/XY", "unevaluatedProperties": false},
|
|
13
|
+
{
|
|
14
|
+
"type": "object",
|
|
15
|
+
"unevaluatedProperties": false,
|
|
16
|
+
"properties": {
|
|
17
|
+
"n": {
|
|
18
|
+
"type": "integer",
|
|
19
|
+
"description": "north border height.",
|
|
20
|
+
"minimum": 0
|
|
21
|
+
},
|
|
22
|
+
"s": {
|
|
23
|
+
"type": "integer",
|
|
24
|
+
"description": "south border height.",
|
|
25
|
+
"minimum": 0
|
|
26
|
+
},
|
|
27
|
+
"w": {
|
|
28
|
+
"type": "integer",
|
|
29
|
+
"description": "west border width.",
|
|
30
|
+
"minimum": 0
|
|
31
|
+
},
|
|
32
|
+
"e": {
|
|
33
|
+
"type": "integer",
|
|
34
|
+
"description": "east border width.",
|
|
35
|
+
"minimum": 0
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
"Button": {
|
|
42
|
+
"type": "object",
|
|
43
|
+
"description": "button config.",
|
|
44
|
+
"required": ["pressed", "selected"],
|
|
45
|
+
"properties": {
|
|
46
|
+
"pressed": {
|
|
47
|
+
"$ref": "#/$defs/SpriteProps",
|
|
48
|
+
"description": "pressed config.",
|
|
49
|
+
"unevaluatedProperties": false
|
|
50
|
+
},
|
|
51
|
+
"selected": {
|
|
52
|
+
"$ref": "#/$defs/SpriteProps",
|
|
53
|
+
"description": "selected config.",
|
|
54
|
+
"unevaluatedProperties": false
|
|
55
|
+
},
|
|
56
|
+
"type": {
|
|
57
|
+
"description": "whether to operate as push to engage or push to toggle.",
|
|
58
|
+
"enum": ["Button", "Toggle"]
|
|
59
|
+
},
|
|
60
|
+
"z": {"$ref": "#/$defs/Layer"}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"Cam": {
|
|
64
|
+
"type": "object",
|
|
65
|
+
"description": "cam config."
|
|
66
|
+
},
|
|
67
|
+
"CompassDir": {
|
|
68
|
+
"description": "cardinal and ordinal directions and center.",
|
|
69
|
+
"enum": ["Center", "N", "S", "W", "E", "NW", "NE", "SW", "SE"]
|
|
70
|
+
},
|
|
71
|
+
"Cursor": {
|
|
72
|
+
"type": "object",
|
|
73
|
+
"description": "cursor config.",
|
|
74
|
+
"properties": {
|
|
75
|
+
"keyboard": {
|
|
76
|
+
"$ref": "#/$defs/Speed",
|
|
77
|
+
"description": "if greater than zero, follow keyboard movement in pixels per second."
|
|
78
|
+
},
|
|
79
|
+
"pick": {
|
|
80
|
+
"$ref": "tags.json",
|
|
81
|
+
"description": "tag for click state. defaults to point tag."
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"DebugInput": {"type": "object", "description": "debug input config."},
|
|
86
|
+
"Draw": {"type": "object", "description": "draw config."},
|
|
87
|
+
"Ent": {
|
|
88
|
+
"type": "object",
|
|
89
|
+
"description": "ent config.",
|
|
90
|
+
"properties": {
|
|
91
|
+
"button": {"$ref": "#/$defs/Button", "unevaluatedProperties": false},
|
|
92
|
+
"cam": {"$ref": "#/$defs/Cam", "unevaluatedProperties": false},
|
|
93
|
+
"cursor": {"$ref": "#/$defs/Cursor", "unevaluatedProperties": false},
|
|
94
|
+
"debugInput": {
|
|
95
|
+
"$ref": "#/$defs/DebugInput",
|
|
96
|
+
"unevaluatedProperties": false
|
|
97
|
+
},
|
|
98
|
+
"draw": {"$ref": "#/$defs/Draw", "unevaluatedProperties": false},
|
|
99
|
+
"fps": {"$ref": "#/$defs/FPS", "unevaluatedProperties": false},
|
|
100
|
+
"hud": {"$ref": "#/$defs/HUD", "unevaluatedProperties": false},
|
|
101
|
+
"id": {"type": "string", "description": "unique lookup identifier."},
|
|
102
|
+
"name": {"type": "string", "description": "debug identifier."},
|
|
103
|
+
"ninePatch": {
|
|
104
|
+
"$ref": "#/$defs/NinePatch",
|
|
105
|
+
"unevaluatedProperties": false
|
|
106
|
+
},
|
|
107
|
+
"override": {
|
|
108
|
+
"$ref": "#/$defs/Override",
|
|
109
|
+
"unevaluatedProperties": false
|
|
110
|
+
},
|
|
111
|
+
"sprite": {"$ref": "#/$defs/Sprite", "unevaluatedProperties": false},
|
|
112
|
+
"text": {"$ref": "#/$defs/Text"},
|
|
113
|
+
"textWH": {"$ref": "#/$defs/TextWH", "unevaluatedProperties": false},
|
|
114
|
+
"textXY": {"$ref": "#/$defs/TextXY", "unevaluatedProperties": false}
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"EntList": {
|
|
118
|
+
"type": "array",
|
|
119
|
+
"description": "ents config.",
|
|
120
|
+
"items": {
|
|
121
|
+
"$ref": "schema.json#/$defs/Ent",
|
|
122
|
+
"unevaluatedProperties": false
|
|
123
|
+
},
|
|
124
|
+
"uniqueItemProperties": ["id"],
|
|
125
|
+
"$comment": "`uniqueItemProperties` is ajv-keywords only."
|
|
126
|
+
},
|
|
127
|
+
"FPS": {"type": "object", "description": "FPS config."},
|
|
128
|
+
"HUD": {
|
|
129
|
+
"type": "object",
|
|
130
|
+
"description": "HUD config.",
|
|
131
|
+
"required": ["origin"],
|
|
132
|
+
"properties": {
|
|
133
|
+
"fill": {
|
|
134
|
+
"$ref": "#/$defs/XYFlag",
|
|
135
|
+
"description": "whether to adjust the width or height to fill empty space."
|
|
136
|
+
},
|
|
137
|
+
"margin": {
|
|
138
|
+
"$ref": "#/$defs/Border",
|
|
139
|
+
"description": "spacing outside the sprite.",
|
|
140
|
+
"unevaluatedProperties": false
|
|
141
|
+
},
|
|
142
|
+
"modulo": {
|
|
143
|
+
"description": "mod margin. useful for snapping to tile.",
|
|
144
|
+
"oneOf": [
|
|
145
|
+
{"type": "integer", "minimum": 0},
|
|
146
|
+
{"$ref": "#/$defs/UIntXY", "unevaluatedProperties": false}
|
|
147
|
+
]
|
|
148
|
+
},
|
|
149
|
+
"origin": {
|
|
150
|
+
"$ref": "#/$defs/CompassDir",
|
|
151
|
+
"description": "position relative to."
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
"IntXY": {
|
|
156
|
+
"$ref": "#/$defs/XY",
|
|
157
|
+
"properties": {"x": {"type": "integer"}, "y": {"type": "integer"}}
|
|
158
|
+
},
|
|
159
|
+
"Layer": {
|
|
160
|
+
"description": "z.",
|
|
161
|
+
"enum": [
|
|
162
|
+
"Bottom",
|
|
163
|
+
"A",
|
|
164
|
+
"B",
|
|
165
|
+
"C",
|
|
166
|
+
"D",
|
|
167
|
+
"E",
|
|
168
|
+
"F",
|
|
169
|
+
"G",
|
|
170
|
+
"UIA",
|
|
171
|
+
"UIB",
|
|
172
|
+
"UIC",
|
|
173
|
+
"UID",
|
|
174
|
+
"UIE",
|
|
175
|
+
"UIF",
|
|
176
|
+
"UIG",
|
|
177
|
+
"Top"
|
|
178
|
+
]
|
|
179
|
+
},
|
|
180
|
+
"NinePatch": {
|
|
181
|
+
"type": "object",
|
|
182
|
+
"description": "nine patch config.",
|
|
183
|
+
"properties": {
|
|
184
|
+
"border": {
|
|
185
|
+
"$ref": "#/$defs/Border",
|
|
186
|
+
"description": "widths and heights of patches.",
|
|
187
|
+
"unevaluatedProperties": false
|
|
188
|
+
},
|
|
189
|
+
"pad": {
|
|
190
|
+
"$ref": "#/$defs/Border",
|
|
191
|
+
"description": "spacing between sprite and patches.",
|
|
192
|
+
"unevaluatedProperties": false
|
|
193
|
+
},
|
|
194
|
+
"patch": {
|
|
195
|
+
"type": "object",
|
|
196
|
+
"description": "sprite config.",
|
|
197
|
+
"unevaluatedProperties": false,
|
|
198
|
+
"properties": {
|
|
199
|
+
"center": {
|
|
200
|
+
"$ref": "#/$defs/SpriteProps",
|
|
201
|
+
"description": "center patch config.",
|
|
202
|
+
"unevaluatedProperties": false
|
|
203
|
+
},
|
|
204
|
+
"n": {
|
|
205
|
+
"$ref": "#/$defs/SpriteProps",
|
|
206
|
+
"description": "north patch config.",
|
|
207
|
+
"unevaluatedProperties": false
|
|
208
|
+
},
|
|
209
|
+
"s": {
|
|
210
|
+
"$ref": "#/$defs/SpriteProps",
|
|
211
|
+
"description": "south patch config.",
|
|
212
|
+
"unevaluatedProperties": false
|
|
213
|
+
},
|
|
214
|
+
"w": {
|
|
215
|
+
"$ref": "#/$defs/SpriteProps",
|
|
216
|
+
"description": "west patch config.",
|
|
217
|
+
"unevaluatedProperties": false
|
|
218
|
+
},
|
|
219
|
+
"e": {
|
|
220
|
+
"$ref": "#/$defs/SpriteProps",
|
|
221
|
+
"description": "east patch config.",
|
|
222
|
+
"unevaluatedProperties": false
|
|
223
|
+
},
|
|
224
|
+
"nw": {
|
|
225
|
+
"$ref": "#/$defs/SpriteProps",
|
|
226
|
+
"description": "northwest patch config.",
|
|
227
|
+
"unevaluatedProperties": false
|
|
228
|
+
},
|
|
229
|
+
"ne": {
|
|
230
|
+
"$ref": "#/$defs/SpriteProps",
|
|
231
|
+
"description": "northeast patch config.",
|
|
232
|
+
"unevaluatedProperties": false
|
|
233
|
+
},
|
|
234
|
+
"sw": {
|
|
235
|
+
"$ref": "#/$defs/SpriteProps",
|
|
236
|
+
"description": "southwest patch config.",
|
|
237
|
+
"unevaluatedProperties": false
|
|
238
|
+
},
|
|
239
|
+
"se": {
|
|
240
|
+
"$ref": "#/$defs/SpriteProps",
|
|
241
|
+
"description": "southeast patch config.",
|
|
242
|
+
"unevaluatedProperties": false
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
"Override": {
|
|
249
|
+
"type": "object",
|
|
250
|
+
"description": "override config.",
|
|
251
|
+
"properties": {
|
|
252
|
+
"invalid": {
|
|
253
|
+
"type": "boolean",
|
|
254
|
+
"description": "whether to recompute and render update."
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
"RGBA": {
|
|
259
|
+
"type": "string",
|
|
260
|
+
"description": "color (red, green, blue, alpha) in hex.",
|
|
261
|
+
"pattern": "^[A-Fa-f0-9]{8}$",
|
|
262
|
+
"examples": ["01234567"]
|
|
263
|
+
},
|
|
264
|
+
"Speed": {
|
|
265
|
+
"type": "number",
|
|
266
|
+
"description": "velocity in pixels per second."
|
|
267
|
+
},
|
|
268
|
+
"Sprite": {
|
|
269
|
+
"type": "object",
|
|
270
|
+
"description": "sprite config.",
|
|
271
|
+
"allOf": [
|
|
272
|
+
{"$ref": "#/$defs/SpriteProps"},
|
|
273
|
+
{"$ref": "#/$defs/WH"},
|
|
274
|
+
{"$ref": "#/$defs/XY"}
|
|
275
|
+
],
|
|
276
|
+
"properties": {
|
|
277
|
+
"scale": {
|
|
278
|
+
"oneOf": [
|
|
279
|
+
{"type": "integer", "minimum": 1},
|
|
280
|
+
{
|
|
281
|
+
"$ref": "#/$defs/UIntXY",
|
|
282
|
+
"unevaluatedProperties": false,
|
|
283
|
+
"properties": {"x": {"minimum": 1}, "y": {"minimum": 1}}
|
|
284
|
+
}
|
|
285
|
+
]
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
"SpritePool": {"type": "string", "description": "allocator pool."},
|
|
290
|
+
"SpriteProps": {
|
|
291
|
+
"description": "sprite config except box-related.",
|
|
292
|
+
"oneOf": [
|
|
293
|
+
{"$ref": "tags.json"},
|
|
294
|
+
{
|
|
295
|
+
"type": "object",
|
|
296
|
+
"properties": {
|
|
297
|
+
"flip": {"$ref": "#/$defs/XYFlag"},
|
|
298
|
+
"pool": {"$ref": "#/$defs/SpritePool"},
|
|
299
|
+
"stretch": {
|
|
300
|
+
"type": "boolean",
|
|
301
|
+
"description": "wrap texture (default) or stretch to width and height."
|
|
302
|
+
},
|
|
303
|
+
"tag": {"$ref": "tags.json"},
|
|
304
|
+
"visible": {
|
|
305
|
+
"type": "boolean",
|
|
306
|
+
"description": "whether sprite is rendered. defaults to true when tag is specified."
|
|
307
|
+
},
|
|
308
|
+
"z": {"$ref": "#/$defs/Layer"},
|
|
309
|
+
"zend": {
|
|
310
|
+
"type": "boolean",
|
|
311
|
+
"description": "z-order by top (default) or bottom of box."
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
]
|
|
316
|
+
},
|
|
317
|
+
"Text": {"type": "string", "description": "string."},
|
|
318
|
+
"TextWH": {
|
|
319
|
+
"type": "object",
|
|
320
|
+
"description": "text WH config.",
|
|
321
|
+
"properties": {
|
|
322
|
+
"maxW": {
|
|
323
|
+
"type": "integer",
|
|
324
|
+
"description": "maximum width.",
|
|
325
|
+
"minimum": 0,
|
|
326
|
+
"maximum": 4095
|
|
327
|
+
},
|
|
328
|
+
"origin": {
|
|
329
|
+
"$ref": "#/$defs/CompassDir",
|
|
330
|
+
"description": "position relative to."
|
|
331
|
+
},
|
|
332
|
+
"pad": {
|
|
333
|
+
"$ref": "#/$defs/Border",
|
|
334
|
+
"description": "spacing between sprite and patches.",
|
|
335
|
+
"unevaluatedProperties": false
|
|
336
|
+
},
|
|
337
|
+
"scale": {
|
|
338
|
+
"type": "integer",
|
|
339
|
+
"description": "text scalar.",
|
|
340
|
+
"minimum": 1
|
|
341
|
+
},
|
|
342
|
+
"trim": {
|
|
343
|
+
"enum": ["Leading", "Descender"],
|
|
344
|
+
"description": "whether to cut the trailing line leading and descenders."
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
"TextXY": {
|
|
349
|
+
"type": "object",
|
|
350
|
+
"description": "text XY config.",
|
|
351
|
+
"properties": {"z": {"$ref": "#/$defs/Layer"}}
|
|
352
|
+
},
|
|
353
|
+
"UIntXY": {
|
|
354
|
+
"$ref": "#/$defs/IntXY",
|
|
355
|
+
"properties": {"x": {"minimum": 0}, "y": {"minimum": 0}}
|
|
356
|
+
},
|
|
357
|
+
"UnboundedUInt": {
|
|
358
|
+
"oneOf": [{"type": "integer", "minimum": 0}, {"enum": ["Infinity"]}]
|
|
359
|
+
},
|
|
360
|
+
"WH": {
|
|
361
|
+
"type": "object",
|
|
362
|
+
"description": "area.",
|
|
363
|
+
"properties": {
|
|
364
|
+
"w": {
|
|
365
|
+
"type": "integer",
|
|
366
|
+
"description": "width.",
|
|
367
|
+
"minimum": 0,
|
|
368
|
+
"maximum": 4095
|
|
369
|
+
},
|
|
370
|
+
"h": {
|
|
371
|
+
"type": "integer",
|
|
372
|
+
"description": "height.",
|
|
373
|
+
"minimum": 0,
|
|
374
|
+
"maximum": 4095
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
"XY": {
|
|
379
|
+
"type": "object",
|
|
380
|
+
"description": "horizontal and vertical dimensions.",
|
|
381
|
+
"properties": {
|
|
382
|
+
"x": {
|
|
383
|
+
"type": "number",
|
|
384
|
+
"description": "horizontal dimension.",
|
|
385
|
+
"minimum": -131072,
|
|
386
|
+
"maximum": 131071.984375,
|
|
387
|
+
"multipleOf": 0.015625
|
|
388
|
+
},
|
|
389
|
+
"y": {
|
|
390
|
+
"type": "number",
|
|
391
|
+
"description": "vertical dimension.",
|
|
392
|
+
"minimum": -131072,
|
|
393
|
+
"maximum": 131071.984375,
|
|
394
|
+
"multipleOf": 0.015625
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
},
|
|
398
|
+
"XYFlag": {
|
|
399
|
+
"description": "horizontal and vertical state.",
|
|
400
|
+
"enum": ["XY", "X", "Y"]
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
"unevaluatedProperties": false,
|
|
404
|
+
"required": ["zoo"],
|
|
405
|
+
"properties": {
|
|
406
|
+
"$schema": {
|
|
407
|
+
"type": "string",
|
|
408
|
+
"description": "the configuration schema URI.",
|
|
409
|
+
"default": "https://oidoid.github.io/void/level-file.v0.json"
|
|
410
|
+
},
|
|
411
|
+
"background": {
|
|
412
|
+
"$ref": "#/$defs/RGBA",
|
|
413
|
+
"description": "render clear color."
|
|
414
|
+
},
|
|
415
|
+
"minScale": {
|
|
416
|
+
"type": "number",
|
|
417
|
+
"description": "min cam scale.",
|
|
418
|
+
"minimum": 1
|
|
419
|
+
},
|
|
420
|
+
"minWH": {
|
|
421
|
+
"$ref": "#/$defs/WH",
|
|
422
|
+
"description": "min cam dimensions. infinity always uses min scale. defaults to infinity.",
|
|
423
|
+
"unevaluatedProperties": false,
|
|
424
|
+
"properties": {
|
|
425
|
+
"w": {"$ref": "#/$defs/UnboundedUInt"},
|
|
426
|
+
"h": {"$ref": "#/$defs/UnboundedUInt"}
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
"zoo": {
|
|
430
|
+
"type": "object",
|
|
431
|
+
"description": "zoo config.",
|
|
432
|
+
"required": ["default"],
|
|
433
|
+
"unevaluatedProperties": false,
|
|
434
|
+
"properties": {"default": {"$ref": "#/$defs/EntList"}},
|
|
435
|
+
"patternProperties": {".+": {"$ref": "#/$defs/EntList"}}
|
|
436
|
+
},
|
|
437
|
+
"zoomOut": {
|
|
438
|
+
"type": "number",
|
|
439
|
+
"description": "cam zoom offset.",
|
|
440
|
+
"minimum": 0
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}
|