@oidoid/void 0.1.4 → 0.1.6
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 +8 -8
- package/dist/public/index.js.map +4 -4
- package/dist/public/void-v0.1.6+20260105.c98baee.html +115 -0
- package/dist/schema/config-file.v0.json +16 -72
- package/dist/schema/level-file.v0.json +76 -56
- package/dist/src/demo/assets/void.game.json +2 -7
- package/dist/src/demo/ents/render-toggle.d.ts.map +1 -1
- package/dist/src/demo/ents/render-toggle.js +1 -0
- package/dist/src/demo/ents/render-toggle.js.map +1 -1
- package/dist/src/demo/index.js +3 -4
- package/dist/src/demo/index.js.map +1 -1
- package/dist/src/demo/level/level-file.v0.json +443 -0
- package/dist/src/demo/level/level-parser.d.ts +0 -2
- package/dist/src/demo/level/level-parser.d.ts.map +1 -1
- package/dist/src/demo/level/level-parser.js +0 -4
- package/dist/src/demo/level/level-parser.js.map +1 -1
- package/dist/src/demo/level/loader.d.ts +7 -0
- package/dist/src/demo/level/loader.d.ts.map +1 -0
- package/dist/src/demo/level/loader.js +55 -0
- package/dist/src/demo/level/loader.js.map +1 -0
- package/dist/src/demo/level/schema.json +24 -0
- package/dist/src/demo/level/tags.json +148 -0
- package/dist/src/demo/types/decl.d.ts +0 -3
- package/dist/src/demo/types/decl.d.ts.map +1 -1
- package/dist/src/demo/void.json +6 -6
- package/dist/src/ents/button.js +2 -2
- package/dist/src/ents/button.js.map +1 -1
- package/dist/src/ents/ent-query.d.ts +1 -1
- package/dist/src/ents/ent-query.d.ts.map +1 -1
- package/dist/src/ents/ent-query.js +1 -1
- package/dist/src/ents/ent-query.js.map +1 -1
- package/dist/src/ents/ent.d.ts +1 -4
- package/dist/src/ents/ent.d.ts.map +1 -1
- package/dist/src/ents/sys.d.ts +0 -1
- package/dist/src/ents/sys.d.ts.map +1 -1
- package/dist/src/ents/zoo.d.ts +9 -18
- package/dist/src/ents/zoo.d.ts.map +1 -1
- package/dist/src/ents/zoo.js +35 -98
- package/dist/src/ents/zoo.js.map +1 -1
- package/dist/src/graphics/atlas-parser.d.ts +1 -1
- package/dist/src/graphics/atlas.d.ts +4 -0
- package/dist/src/graphics/atlas.d.ts.map +1 -1
- package/dist/src/graphics/layer.d.ts +1 -1
- package/dist/src/graphics/layer.d.ts.map +1 -1
- package/dist/src/graphics/layer.js +1 -1
- package/dist/src/graphics/layer.js.map +1 -1
- package/dist/src/graphics/renderer.d.ts +2 -2
- package/dist/src/graphics/renderer.d.ts.map +1 -1
- package/dist/src/graphics/renderer.js +13 -13
- package/dist/src/graphics/renderer.js.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/level/level-parser.d.ts.map +1 -1
- package/dist/src/level/level-parser.js +8 -3
- package/dist/src/level/level-parser.js.map +1 -1
- package/dist/src/level/level-schema.d.ts +17 -12
- package/dist/src/level/level-schema.d.ts.map +1 -1
- package/dist/src/level/level.d.ts +6 -4
- package/dist/src/level/level.d.ts.map +1 -1
- package/dist/src/level/loader.d.ts +7 -0
- package/dist/src/level/loader.d.ts.map +1 -0
- package/dist/src/{ents → level}/loader.js.map +1 -1
- package/dist/src/types/{game-config.d.ts → void-config.d.ts} +4 -11
- package/dist/src/types/void-config.d.ts.map +1 -0
- package/dist/src/types/void-config.js +2 -0
- package/dist/src/types/void-config.js.map +1 -0
- package/dist/src/utils/dom-util.d.ts +1 -1
- package/dist/src/utils/dom-util.d.ts.map +1 -1
- package/dist/src/utils/dom-util.js +1 -3
- package/dist/src/utils/dom-util.js.map +1 -1
- package/dist/src/void.d.ts +14 -11
- package/dist/src/void.d.ts.map +1 -1
- package/dist/src/void.js +43 -31
- package/dist/src/void.js.map +1 -1
- package/dist/tools/atlas-pack/atlas-pack.d.ts +1 -1
- package/dist/tools/atlas-pack/atlas-pack.d.ts.map +1 -1
- package/dist/tools/atlas-pack/atlas-pack.js +0 -2
- package/dist/tools/atlas-pack/atlas-pack.js.map +1 -1
- package/dist/tools/bundle/bundle.js +22 -10
- package/dist/tools/bundle/bundle.js.map +1 -1
- package/dist/tools/types/config-file.d.ts +13 -16
- package/dist/tools/types/config-file.d.ts.map +1 -1
- package/dist/tools/types/config-file.js +7 -17
- package/dist/tools/types/config-file.js.map +1 -1
- package/dist/tools/types/config.d.ts +6 -4
- package/dist/tools/types/config.d.ts.map +1 -1
- package/dist/tools/types/config.js +5 -3
- package/dist/tools/types/config.js.map +1 -1
- package/package.json +5 -4
- package/readme.md +3 -1
- package/schema/config-file.v0.json +83 -0
- package/schema/level-file.v0.json +443 -0
- package/dist/public/void-v0.1.4+20260103.39142b2.html +0 -115
- package/dist/src/demo/ents/loader.d.ts +0 -6
- package/dist/src/demo/ents/loader.d.ts.map +0 -1
- package/dist/src/demo/ents/loader.js +0 -45
- package/dist/src/demo/ents/loader.js.map +0 -1
- package/dist/src/demo/level/level-file.json +0 -50
- package/dist/src/ents/loader.d.ts +0 -3
- package/dist/src/ents/loader.d.ts.map +0 -1
- package/dist/src/types/game-config.d.ts.map +0 -1
- package/dist/src/types/game-config.js +0 -2
- package/dist/src/types/game-config.js.map +0 -1
- /package/dist/public/{preload-atlas.webp → atlas.webp} +0 -0
- /package/dist/src/{ents → level}/loader.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-toggle.js","sourceRoot":"","sources":["../../../../src/demo/ents/render-toggle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAA;AAInC,MAAM,OAAO,eAAe;IACjB,KAAK,GAAG,gCAAgC,CAAA;IAEjD,MAAM,CAAC,GAAoB,EAAE,CAAS;QACpC,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;IACrC,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"render-toggle.js","sourceRoot":"","sources":["../../../../src/demo/ents/render-toggle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAA;AAInC,MAAM,OAAO,eAAe;IACjB,KAAK,GAAG,gCAAgC,CAAA;IAEjD,MAAM,CAAC,GAAoB,EAAE,CAAS;QACpC,2EAA2E;QAC3E,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;IACrC,CAAC;CACF"}
|
package/dist/src/demo/index.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import * as V from "../index.js";
|
|
2
2
|
import { description } from './assets/manifest.json'; // non-standard import to treeshake.
|
|
3
3
|
import config from './assets/void.game.json' with { type: 'json' };
|
|
4
|
-
import {
|
|
4
|
+
import { Loader } from "./level/loader.js";
|
|
5
5
|
console.debug(`void v${V.bundle.version}+${V.bundle.published}.${V.bundle.hash} ───oidoid>°──`);
|
|
6
6
|
const v = new V.Void({
|
|
7
|
+
atlas: document.querySelector('#atlas'),
|
|
7
8
|
config: config,
|
|
8
9
|
description,
|
|
9
|
-
|
|
10
|
-
loader: { loader: { level: undefined } },
|
|
11
|
-
loaderSys: new LoaderSys()
|
|
10
|
+
loader: new Loader()
|
|
12
11
|
});
|
|
13
12
|
v.setPoller(((V.debug?.seconds ? 1 : 60) * 1000), () => V.millisUntilNext(new Date(), V.debug?.seconds ? 'Sec' : 'Min'));
|
|
14
13
|
await v.register('add');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/demo/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,aAAa,CAAA;AAChC,OAAO,EAAC,WAAW,EAAC,MAAM,wBAAwB,CAAA,CAAC,oCAAoC;AACvF,OAAO,MAAM,MAAM,yBAAyB,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAA;AAChE,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/demo/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,aAAa,CAAA;AAChC,OAAO,EAAC,WAAW,EAAC,MAAM,wBAAwB,CAAA,CAAC,oCAAoC;AACvF,OAAO,MAAM,MAAM,yBAAyB,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAA;AAChE,OAAO,EAAC,MAAM,EAAC,MAAM,mBAAmB,CAAA;AAExC,OAAO,CAAC,KAAK,CACX,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,gBAAgB,CACjF,CAAA;AAED,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC;IACnB,KAAK,EAAE,QAAQ,CAAC,aAAa,CAAmB,QAAQ,CAAC;IACzD,MAAM,EAAE,MAAsB;IAC9B,WAAW;IACX,MAAM,EAAE,IAAI,MAAM,EAAE;CACrB,CAAC,CAAA;AACF,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAa,EAAE,GAAG,EAAE,CACjE,CAAC,CAAC,eAAe,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAChE,CAAA;AACD,MAAM,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA"}
|
|
@@ -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
|
+
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import * as V from '../../index.ts';
|
|
2
|
-
export declare function parseLevel(json: Readonly<V.LevelSchema>, pools: Readonly<V.PoolMap>, atlas: Readonly<V.Atlas>): V.Level;
|
|
3
|
-
/** @internal */
|
|
4
2
|
export declare const parseComponent: V.ComponentHook;
|
|
5
3
|
//# sourceMappingURL=level-parser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"level-parser.d.ts","sourceRoot":"","sources":["../../../../src/demo/level/level-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAA;AAEnC,
|
|
1
|
+
{"version":3,"file":"level-parser.d.ts","sourceRoot":"","sources":["../../../../src/demo/level/level-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAA;AAEnC,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,aAY9B,CAAA"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import * as V from "../../index.js";
|
|
2
|
-
export function parseLevel(json, pools, atlas) {
|
|
3
|
-
return V.parseLevel(json, pools, parseComponent, atlas);
|
|
4
|
-
}
|
|
5
|
-
/** @internal */
|
|
6
2
|
export const parseComponent = (ent, json, k) => {
|
|
7
3
|
if (json[k] == null)
|
|
8
4
|
throw Error('no component val');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"level-parser.js","sourceRoot":"","sources":["../../../../src/demo/level/level-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAA;AAEnC,MAAM,
|
|
1
|
+
{"version":3,"file":"level-parser.js","sourceRoot":"","sources":["../../../../src/demo/level/level-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAA;AAEnC,MAAM,CAAC,MAAM,cAAc,GAAoB,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE;IAC9D,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI;QAAE,MAAM,KAAK,CAAC,kBAAkB,CAAC,CAAA;IACpD,QAAQ,CAAC,EAAE,CAAC;QACV,KAAK,OAAO;YACV,OAAO,IAAI,CAAC,CAAC,CAA2B,CAAA;QAC1C,KAAK,cAAc;YACjB,IAAI,CAAC,GAAG,CAAC,MAAM;gBAAE,MAAM,KAAK,CAAC,4BAA4B,CAAC,CAAA;YAC1D,CAAC,CAAC,WAAW,CAAC,GAAkB,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,QAAQ,CAAC,CAAA;YAC/D,OAAO,IAAI,CAAC,CAAC,CAA2B,CAAA;QAC1C,KAAK,OAAO;YACV,OAAO,EAAC,OAAO,EAAE,CAAC,EAA2B,CAAA;IACjD,CAAC;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../src/demo/level/loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAA;AASnC,qBAAa,MAAO,YAAW,CAAC,CAAC,MAAM;;IACrC,MAAM,EAAE,CAAC,CAAC,SAAS,GAAG,SAAS,CAAA;IAqB/B,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,GAAG,IAAI;CA6BxB"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as V from "../../index.js";
|
|
2
|
+
import levelJSON from '../assets/init.level.jsonc' with { type: 'json' };
|
|
3
|
+
import { CamSys } from "../ents/cam.js";
|
|
4
|
+
import { ClockSys } from "../ents/clock.js";
|
|
5
|
+
import { DrawSys } from "../ents/draw.js";
|
|
6
|
+
import { RenderToggleSys } from "../ents/render-toggle.js";
|
|
7
|
+
import { TallySys } from "../ents/tally.js";
|
|
8
|
+
import { parseComponent } from "./level-parser.js";
|
|
9
|
+
export class Loader {
|
|
10
|
+
cursor;
|
|
11
|
+
#lvl;
|
|
12
|
+
#systems = {
|
|
13
|
+
button: new V.ButtonSys(),
|
|
14
|
+
cursor: new V.CursorSys(),
|
|
15
|
+
debugInput: new V.DebutInputSys(),
|
|
16
|
+
fps: new V.FPSSys(),
|
|
17
|
+
hud: new V.HUDSys(),
|
|
18
|
+
ninePatch: new V.NinePatchSys(),
|
|
19
|
+
override: new V.OverrideSys(),
|
|
20
|
+
sprite: new V.SpriteSys(),
|
|
21
|
+
textWH: new V.TextWHSys(),
|
|
22
|
+
textXY: new V.TextXYSys(),
|
|
23
|
+
cam: new CamSys(),
|
|
24
|
+
clock: new ClockSys(),
|
|
25
|
+
draw: new DrawSys(),
|
|
26
|
+
renderToggle: new RenderToggleSys(),
|
|
27
|
+
tally: new TallySys()
|
|
28
|
+
};
|
|
29
|
+
#zoo = { default: new Set() };
|
|
30
|
+
update(v) {
|
|
31
|
+
switch (this.#lvl) {
|
|
32
|
+
case undefined:
|
|
33
|
+
this.#init(v);
|
|
34
|
+
break;
|
|
35
|
+
case 'Init':
|
|
36
|
+
break;
|
|
37
|
+
default:
|
|
38
|
+
this.#lvl;
|
|
39
|
+
}
|
|
40
|
+
for (const zoo of Object.values(this.#zoo))
|
|
41
|
+
V.zooUpdate(zoo, this.#systems, v);
|
|
42
|
+
}
|
|
43
|
+
#init(v) {
|
|
44
|
+
v.pool.overlay = V.SpritePool({
|
|
45
|
+
atlas: v.atlas.default,
|
|
46
|
+
looper: v.looper,
|
|
47
|
+
pageBlocks: 10
|
|
48
|
+
});
|
|
49
|
+
v.setPoller(((V.debug?.seconds ? 1 : 60) * 1000), () => V.millisUntilNext(new Date(), V.debug?.seconds ? 'Sec' : 'Min'));
|
|
50
|
+
this.#zoo = v.loadLevel(levelJSON, 'default', parseComponent);
|
|
51
|
+
this.cursor = V.zooFindByID(this.#zoo.default, 'Cursor');
|
|
52
|
+
this.#lvl = 'Init';
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../../../src/demo/level/loader.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$defs": {
|
|
4
|
+
"Clock": { "type": "object", "description": "clock config." },
|
|
5
|
+
"Ent": {
|
|
6
|
+
"allOf": [
|
|
7
|
+
{ "$ref": "level-file.v0.json#/$defs/Ent" },
|
|
8
|
+
{
|
|
9
|
+
"type": "object",
|
|
10
|
+
"properties": {
|
|
11
|
+
"clock": { "$ref": "#/$defs/Clock", "unevaluatedProperties": false },
|
|
12
|
+
"renderToggle": {
|
|
13
|
+
"$ref": "#/$defs/RenderToggle",
|
|
14
|
+
"unevaluatedProperties": false
|
|
15
|
+
},
|
|
16
|
+
"tally": { "$ref": "#/$defs/Tally", "unevaluatedProperties": false }
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
"RenderToggle": { "type": "object", "description": "render toggle config." },
|
|
22
|
+
"Tally": { "type": "object", "description": "tally config." }
|
|
23
|
+
}
|
|
24
|
+
}
|