@al8b/runtime 0.1.0

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.
Files changed (185) hide show
  1. package/README.md +87 -0
  2. package/dist/assets/constructors.d.mts +6 -0
  3. package/dist/assets/constructors.d.ts +6 -0
  4. package/dist/assets/constructors.js +40 -0
  5. package/dist/assets/constructors.js.map +1 -0
  6. package/dist/assets/constructors.mjs +12 -0
  7. package/dist/assets/constructors.mjs.map +1 -0
  8. package/dist/assets/index.d.mts +11 -0
  9. package/dist/assets/index.d.ts +11 -0
  10. package/dist/assets/index.js +276 -0
  11. package/dist/assets/index.js.map +1 -0
  12. package/dist/assets/index.mjs +247 -0
  13. package/dist/assets/index.mjs.map +1 -0
  14. package/dist/assets/loader.d.mts +83 -0
  15. package/dist/assets/loader.d.ts +83 -0
  16. package/dist/assets/loader.js +260 -0
  17. package/dist/assets/loader.js.map +1 -0
  18. package/dist/assets/loader.mjs +237 -0
  19. package/dist/assets/loader.mjs.map +1 -0
  20. package/dist/browser/index.js +16599 -0
  21. package/dist/browser/index.js.map +1 -0
  22. package/dist/browser/index.min.js +171 -0
  23. package/dist/constants.d.mts +16 -0
  24. package/dist/constants.d.ts +16 -0
  25. package/dist/constants.js +49 -0
  26. package/dist/constants.js.map +1 -0
  27. package/dist/constants.mjs +18 -0
  28. package/dist/constants.mjs.map +1 -0
  29. package/dist/core/api-factory.d.mts +63 -0
  30. package/dist/core/api-factory.d.ts +63 -0
  31. package/dist/core/api-factory.js +239 -0
  32. package/dist/core/api-factory.js.map +1 -0
  33. package/dist/core/api-factory.mjs +214 -0
  34. package/dist/core/api-factory.mjs.map +1 -0
  35. package/dist/core/assets-registry.d.mts +14 -0
  36. package/dist/core/assets-registry.d.ts +14 -0
  37. package/dist/core/assets-registry.js +64 -0
  38. package/dist/core/assets-registry.js.map +1 -0
  39. package/dist/core/assets-registry.mjs +41 -0
  40. package/dist/core/assets-registry.mjs.map +1 -0
  41. package/dist/core/controller.d.mts +109 -0
  42. package/dist/core/controller.d.ts +109 -0
  43. package/dist/core/controller.js +1782 -0
  44. package/dist/core/controller.js.map +1 -0
  45. package/dist/core/controller.mjs +1758 -0
  46. package/dist/core/controller.mjs.map +1 -0
  47. package/dist/core/debug-logger.d.mts +35 -0
  48. package/dist/core/debug-logger.d.ts +35 -0
  49. package/dist/core/debug-logger.js +177 -0
  50. package/dist/core/debug-logger.js.map +1 -0
  51. package/dist/core/debug-logger.mjs +154 -0
  52. package/dist/core/debug-logger.mjs.map +1 -0
  53. package/dist/core/error-handler.d.mts +25 -0
  54. package/dist/core/error-handler.d.ts +25 -0
  55. package/dist/core/error-handler.js +106 -0
  56. package/dist/core/error-handler.js.map +1 -0
  57. package/dist/core/error-handler.mjs +81 -0
  58. package/dist/core/error-handler.mjs.map +1 -0
  59. package/dist/core/index.d.mts +14 -0
  60. package/dist/core/index.d.ts +14 -0
  61. package/dist/core/index.js +1782 -0
  62. package/dist/core/index.js.map +1 -0
  63. package/dist/core/index.mjs +1757 -0
  64. package/dist/core/index.mjs.map +1 -0
  65. package/dist/hot-reload/index.d.mts +7 -0
  66. package/dist/hot-reload/index.d.ts +7 -0
  67. package/dist/hot-reload/index.js +103 -0
  68. package/dist/hot-reload/index.js.map +1 -0
  69. package/dist/hot-reload/index.mjs +78 -0
  70. package/dist/hot-reload/index.mjs.map +1 -0
  71. package/dist/hot-reload/updater.d.mts +33 -0
  72. package/dist/hot-reload/updater.d.ts +33 -0
  73. package/dist/hot-reload/updater.js +101 -0
  74. package/dist/hot-reload/updater.js.map +1 -0
  75. package/dist/hot-reload/updater.mjs +78 -0
  76. package/dist/hot-reload/updater.mjs.map +1 -0
  77. package/dist/index.d.mts +24 -0
  78. package/dist/index.d.ts +24 -0
  79. package/dist/index.js +1859 -0
  80. package/dist/index.js.map +1 -0
  81. package/dist/index.mjs +1817 -0
  82. package/dist/index.mjs.map +1 -0
  83. package/dist/input/index.d.mts +2 -0
  84. package/dist/input/index.d.ts +2 -0
  85. package/dist/input/index.js +79 -0
  86. package/dist/input/index.js.map +1 -0
  87. package/dist/input/index.mjs +54 -0
  88. package/dist/input/index.mjs.map +1 -0
  89. package/dist/input/manager.d.mts +37 -0
  90. package/dist/input/manager.d.ts +37 -0
  91. package/dist/input/manager.js +77 -0
  92. package/dist/input/manager.js.map +1 -0
  93. package/dist/input/manager.mjs +54 -0
  94. package/dist/input/manager.mjs.map +1 -0
  95. package/dist/loop/game-loop.d.mts +63 -0
  96. package/dist/loop/game-loop.d.ts +63 -0
  97. package/dist/loop/game-loop.js +156 -0
  98. package/dist/loop/game-loop.js.map +1 -0
  99. package/dist/loop/game-loop.mjs +131 -0
  100. package/dist/loop/game-loop.mjs.map +1 -0
  101. package/dist/loop/index.d.mts +1 -0
  102. package/dist/loop/index.d.ts +1 -0
  103. package/dist/loop/index.js +156 -0
  104. package/dist/loop/index.js.map +1 -0
  105. package/dist/loop/index.mjs +131 -0
  106. package/dist/loop/index.mjs.map +1 -0
  107. package/dist/storage/index.d.mts +1 -0
  108. package/dist/storage/index.d.ts +1 -0
  109. package/dist/storage/index.js +31 -0
  110. package/dist/storage/index.js.map +1 -0
  111. package/dist/storage/index.mjs +6 -0
  112. package/dist/storage/index.mjs.map +1 -0
  113. package/dist/system/api.d.mts +28 -0
  114. package/dist/system/api.d.ts +28 -0
  115. package/dist/system/api.js +126 -0
  116. package/dist/system/api.js.map +1 -0
  117. package/dist/system/api.mjs +101 -0
  118. package/dist/system/api.mjs.map +1 -0
  119. package/dist/system/index.d.mts +2 -0
  120. package/dist/system/index.d.ts +2 -0
  121. package/dist/system/index.js +126 -0
  122. package/dist/system/index.js.map +1 -0
  123. package/dist/system/index.mjs +101 -0
  124. package/dist/system/index.mjs.map +1 -0
  125. package/dist/types/assets.d.mts +43 -0
  126. package/dist/types/assets.d.ts +43 -0
  127. package/dist/types/assets.js +19 -0
  128. package/dist/types/assets.js.map +1 -0
  129. package/dist/types/assets.mjs +1 -0
  130. package/dist/types/assets.mjs.map +1 -0
  131. package/dist/types/bridge.d.mts +66 -0
  132. package/dist/types/bridge.d.ts +66 -0
  133. package/dist/types/bridge.js +19 -0
  134. package/dist/types/bridge.js.map +1 -0
  135. package/dist/types/bridge.mjs +1 -0
  136. package/dist/types/bridge.mjs.map +1 -0
  137. package/dist/types/index.d.mts +6 -0
  138. package/dist/types/index.d.ts +6 -0
  139. package/dist/types/index.js +19 -0
  140. package/dist/types/index.js.map +1 -0
  141. package/dist/types/index.mjs +1 -0
  142. package/dist/types/index.mjs.map +1 -0
  143. package/dist/types/runtime.d.mts +71 -0
  144. package/dist/types/runtime.d.ts +71 -0
  145. package/dist/types/runtime.js +19 -0
  146. package/dist/types/runtime.js.map +1 -0
  147. package/dist/types/runtime.mjs +1 -0
  148. package/dist/types/runtime.mjs.map +1 -0
  149. package/dist/types/vm.d.mts +1 -0
  150. package/dist/types/vm.d.ts +1 -0
  151. package/dist/types/vm.js +19 -0
  152. package/dist/types/vm.js.map +1 -0
  153. package/dist/types/vm.mjs +1 -0
  154. package/dist/types/vm.mjs.map +1 -0
  155. package/dist/utils/deep-clone.d.mts +14 -0
  156. package/dist/utils/deep-clone.d.ts +14 -0
  157. package/dist/utils/deep-clone.js +42 -0
  158. package/dist/utils/deep-clone.js.map +1 -0
  159. package/dist/utils/deep-clone.mjs +19 -0
  160. package/dist/utils/deep-clone.mjs.map +1 -0
  161. package/dist/utils/index.d.mts +3 -0
  162. package/dist/utils/index.d.ts +3 -0
  163. package/dist/utils/index.js +156 -0
  164. package/dist/utils/index.js.map +1 -0
  165. package/dist/utils/index.mjs +129 -0
  166. package/dist/utils/index.mjs.map +1 -0
  167. package/dist/utils/object-pool.d.mts +66 -0
  168. package/dist/utils/object-pool.d.ts +66 -0
  169. package/dist/utils/object-pool.js +113 -0
  170. package/dist/utils/object-pool.js.map +1 -0
  171. package/dist/utils/object-pool.mjs +90 -0
  172. package/dist/utils/object-pool.mjs.map +1 -0
  173. package/dist/utils/shallow-equal.d.mts +15 -0
  174. package/dist/utils/shallow-equal.d.ts +15 -0
  175. package/dist/utils/shallow-equal.js +53 -0
  176. package/dist/utils/shallow-equal.js.map +1 -0
  177. package/dist/utils/shallow-equal.mjs +30 -0
  178. package/dist/utils/shallow-equal.mjs.map +1 -0
  179. package/dist/vm/index.d.mts +1 -0
  180. package/dist/vm/index.d.ts +1 -0
  181. package/dist/vm/index.js +37 -0
  182. package/dist/vm/index.js.map +1 -0
  183. package/dist/vm/index.mjs +9 -0
  184. package/dist/vm/index.mjs.map +1 -0
  185. package/package.json +52 -0
@@ -0,0 +1,247 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // src/assets/constructors.ts
5
+ import { Sound } from "@al8b/audio";
6
+ import { TileMap } from "@al8b/map";
7
+ import { Image } from "@al8b/image";
8
+ import { Sprite } from "@al8b/sprites";
9
+
10
+ // src/assets/loader.ts
11
+ import { Sound as Sound2, Music } from "@al8b/audio";
12
+
13
+ // src/constants.ts
14
+ var DEFAULT_FPS = 60;
15
+ var FRAME_TIME_MS = 1e3 / DEFAULT_FPS;
16
+ var DEFAULT_BLOCK_SIZE = 16;
17
+ var LOADING_BAR_THROTTLE_MS = 16;
18
+ var ASSET_LOAD_TIMEOUT_MS = 3e4;
19
+
20
+ // src/assets/loader.ts
21
+ import { LoadMap } from "@al8b/map";
22
+ import { LoadSprite } from "@al8b/sprites";
23
+ function withTimeout(promise, ms) {
24
+ return Promise.race([
25
+ promise,
26
+ new Promise((_, reject) => setTimeout(() => reject(new Error(`Asset load timed out after ${ms}ms`)), ms))
27
+ ]);
28
+ }
29
+ __name(withTimeout, "withTimeout");
30
+ var AssetLoader = class {
31
+ static {
32
+ __name(this, "AssetLoader");
33
+ }
34
+ url;
35
+ resources;
36
+ collections;
37
+ loadingBarTime = null;
38
+ audioCore;
39
+ listener;
40
+ constructor(url, resources, audioCore, listener) {
41
+ this.url = url;
42
+ this.resources = resources;
43
+ this.audioCore = audioCore;
44
+ this.listener = listener;
45
+ this.collections = {
46
+ sprites: {},
47
+ maps: {},
48
+ sounds: {},
49
+ music: {},
50
+ assets: {}
51
+ };
52
+ }
53
+ /**
54
+ * Load all assets
55
+ */
56
+ async loadAll() {
57
+ await Promise.all([
58
+ this.loadSprites(),
59
+ this.loadMaps(),
60
+ this.loadSounds(),
61
+ this.loadMusic(),
62
+ this.loadGenericAssets()
63
+ ]);
64
+ return this.collections;
65
+ }
66
+ /**
67
+ * Load a set of callback-based assets (sprites or maps) with timeout and placeholder fallback.
68
+ */
69
+ async loadCallbackAssets(resources, urlPrefix, collectionKey, load, createPlaceholder) {
70
+ if (!resources) return;
71
+ const promises = resources.map((res) => new Promise((resolve) => {
72
+ const name = res.file.split(".")[0].replace(/-/g, "/");
73
+ const url = `${this.url}${urlPrefix}/${res.file}?v=${res.version || 0}`;
74
+ try {
75
+ const inner = new Promise((onReady) => {
76
+ this.collections[collectionKey][name] = load(url, res, onReady);
77
+ });
78
+ withTimeout(inner, ASSET_LOAD_TIMEOUT_MS).then(resolve).catch((err) => {
79
+ this.listener?.log?.(`[AssetLoader] Failed to load ${collectionKey.slice(0, -1)} "${name}": ${String(err)}`);
80
+ this.collections[collectionKey][name] = createPlaceholder(name, res);
81
+ resolve();
82
+ });
83
+ } catch (err) {
84
+ this.listener?.log?.(`[AssetLoader] Failed to load ${collectionKey.slice(0, -1)} "${name}": ${String(err)}`);
85
+ this.collections[collectionKey][name] = createPlaceholder(name, res);
86
+ resolve();
87
+ }
88
+ }));
89
+ await Promise.all(promises);
90
+ }
91
+ /**
92
+ * Load sprites
93
+ */
94
+ async loadSprites() {
95
+ await this.loadCallbackAssets(this.resources.images, "sprites", "sprites", (url, img, onReady) => LoadSprite(url, img.properties, onReady), (name, img) => ({
96
+ name,
97
+ ready: false,
98
+ frames: [],
99
+ fps: img.properties?.fps || 5,
100
+ width: 0,
101
+ height: 0
102
+ }));
103
+ }
104
+ /**
105
+ * Load maps
106
+ */
107
+ async loadMaps() {
108
+ await this.loadCallbackAssets(this.resources.maps, "maps", "maps", (url, _mapRes, onReady) => LoadMap(url, this.collections.sprites, onReady), (name) => ({
109
+ name,
110
+ ready: false,
111
+ width: 0,
112
+ height: 0,
113
+ block_width: DEFAULT_BLOCK_SIZE,
114
+ block_height: DEFAULT_BLOCK_SIZE,
115
+ data: []
116
+ }));
117
+ }
118
+ /**
119
+ * Load sounds
120
+ */
121
+ async loadSounds() {
122
+ if (!this.resources.sounds) return;
123
+ const promises = this.resources.sounds.map((sound) => {
124
+ return new Promise((resolve) => {
125
+ const name = sound.file.split(".")[0];
126
+ const url = `${this.url}sounds/${sound.file}?v=${sound.version || 0}`;
127
+ try {
128
+ const soundInstance = new Sound2(this.audioCore, url);
129
+ this.collections.sounds[name] = soundInstance;
130
+ resolve();
131
+ } catch (err) {
132
+ this.listener?.log?.(`[AssetLoader] Failed to load sound "${name}": ${String(err)}`);
133
+ this.collections.sounds[name] = new Sound2(this.audioCore, url);
134
+ resolve();
135
+ }
136
+ });
137
+ });
138
+ await Promise.all(promises);
139
+ }
140
+ /**
141
+ * Load music
142
+ */
143
+ async loadMusic() {
144
+ if (!this.resources.music) return;
145
+ const promises = this.resources.music.map((mus) => {
146
+ return new Promise((resolve) => {
147
+ const name = mus.file.split(".")[0];
148
+ const url = `${this.url}music/${mus.file}?v=${mus.version || 0}`;
149
+ try {
150
+ const musicInstance = new Music(this.audioCore, url);
151
+ this.collections.music[name] = musicInstance;
152
+ resolve();
153
+ } catch (err) {
154
+ this.listener?.log?.(`[AssetLoader] Failed to load music "${name}": ${String(err)}`);
155
+ this.collections.music[name] = new Music(this.audioCore, url);
156
+ resolve();
157
+ }
158
+ });
159
+ });
160
+ await Promise.all(promises);
161
+ }
162
+ /**
163
+ * Load generic assets
164
+ */
165
+ async loadGenericAssets() {
166
+ if (!this.resources.assets) return;
167
+ for (const asset of this.resources.assets) {
168
+ const name = asset.file.split(".")[0].replace(/-/g, "/");
169
+ this.collections.assets[name] = {
170
+ name,
171
+ file: asset.file,
172
+ version: asset.version
173
+ };
174
+ }
175
+ }
176
+ /**
177
+ * Check if all assets are ready
178
+ */
179
+ isReady() {
180
+ return this.countReady() === this.countTotal();
181
+ }
182
+ /**
183
+ * Get loading progress (0-1)
184
+ */
185
+ getProgress() {
186
+ const total = this.countTotal();
187
+ if (total === 0) return 1;
188
+ return this.countReady() / total;
189
+ }
190
+ /**
191
+ * Count total assets
192
+ */
193
+ countTotal() {
194
+ let count = 0;
195
+ count += Object.keys(this.collections.sprites).length;
196
+ count += Object.keys(this.collections.maps).length;
197
+ count += Object.keys(this.collections.sounds).length;
198
+ count += Object.keys(this.collections.music).length;
199
+ return count;
200
+ }
201
+ /**
202
+ * Count ready assets
203
+ */
204
+ countReady() {
205
+ let ready = 0;
206
+ for (const sprite of Object.values(this.collections.sprites)) {
207
+ if (sprite.ready) ready++;
208
+ }
209
+ for (const map of Object.values(this.collections.maps)) {
210
+ if (map.ready) ready++;
211
+ }
212
+ for (const sound of Object.values(this.collections.sounds)) {
213
+ if (sound.ready) ready++;
214
+ }
215
+ for (const mus of Object.values(this.collections.music)) {
216
+ if (mus.ready) ready++;
217
+ }
218
+ return ready;
219
+ }
220
+ /**
221
+ * Show loading bar on screen
222
+ */
223
+ showLoadingBar(screenInterface) {
224
+ if (this.loadingBarTime && Date.now() < this.loadingBarTime + LOADING_BAR_THROTTLE_MS) {
225
+ return;
226
+ }
227
+ this.loadingBarTime = Date.now();
228
+ const progress = this.getProgress();
229
+ screenInterface.clear("#000");
230
+ screenInterface.drawRect(0, 0, 100, 10, "#DDD");
231
+ screenInterface.fillRect(-(1 - progress) * 48, 0, progress * 96, 6, "#DDD");
232
+ }
233
+ /**
234
+ * Get loaded collections
235
+ */
236
+ getCollections() {
237
+ return this.collections;
238
+ }
239
+ };
240
+ export {
241
+ AssetLoader,
242
+ Image,
243
+ Sound,
244
+ Sprite,
245
+ TileMap
246
+ };
247
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/assets/constructors.ts","../../src/assets/loader.ts","../../src/constants.ts"],"sourcesContent":["/**\n * Dynamic asset constructors\n *\n * Provides constructors for creating assets at runtime\n */\n\nimport { Sound } from \"@al8b/audio\";\nimport { TileMap } from \"@al8b/map\";\nimport { Image } from \"@al8b/image\";\nimport { Sprite } from \"@al8b/sprites\";\n\n/**\n * Export constructors for game code\n */\nexport { Image, Sprite, TileMap, Sound };\n","/**\n * AssetLoader - Handles loading of game assets\n *\n * Responsibilities:\n * - Load sprites, maps, sounds, music\n * - Track loading progress\n * - Show loading bar\n */\n\nimport { AudioCore, Sound, Music } from \"@al8b/audio\";\nimport { ASSET_LOAD_TIMEOUT_MS, DEFAULT_BLOCK_SIZE, LOADING_BAR_THROTTLE_MS } from \"../constants\";\nimport { LoadMap } from \"@al8b/map\";\nimport { LoadSprite } from \"@al8b/sprites\";\nimport type { AssetCollections, ResourceFile, Resources } from \"../types\";\nimport type { RuntimeListener } from \"../types\";\n\n/**\n * Race a promise against a timeout.\n * Rejects with a descriptive error if `ms` elapses before the promise settles.\n */\nfunction withTimeout<T>(promise: Promise<T>, ms: number): Promise<T> {\n\treturn Promise.race([\n\t\tpromise,\n\t\tnew Promise<T>((_, reject) =>\n\t\t\tsetTimeout(() => reject(new Error(`Asset load timed out after ${ms}ms`)), ms),\n\t\t),\n\t]);\n}\n\nexport class AssetLoader {\n\tprivate url: string;\n\tprivate resources: Resources;\n\tprivate collections: AssetCollections;\n\tprivate loadingBarTime: number | null = null;\n\tprivate audioCore: AudioCore;\n\tprivate listener?: RuntimeListener;\n\n\tconstructor(url: string, resources: Resources, audioCore: AudioCore, listener?: RuntimeListener) {\n\t\tthis.url = url;\n\t\tthis.resources = resources;\n\t\tthis.audioCore = audioCore;\n\t\tthis.listener = listener;\n\t\tthis.collections = {\n\t\t\tsprites: {},\n\t\t\tmaps: {},\n\t\t\tsounds: {},\n\t\t\tmusic: {},\n\t\t\tassets: {},\n\t\t};\n\t}\n\n\t/**\n\t * Load all assets\n\t */\n\tasync loadAll(): Promise<AssetCollections> {\n\t\tawait Promise.all([\n\t\t\tthis.loadSprites(),\n\t\t\tthis.loadMaps(),\n\t\t\tthis.loadSounds(),\n\t\t\tthis.loadMusic(),\n\t\t\tthis.loadGenericAssets(),\n\t\t]);\n\n\t\treturn this.collections;\n\t}\n\n\t/**\n\t * Load a set of callback-based assets (sprites or maps) with timeout and placeholder fallback.\n\t */\n\tprivate async loadCallbackAssets<TRes extends ResourceFile>(\n\t\tresources: TRes[] | undefined,\n\t\turlPrefix: string,\n\t\tcollectionKey: \"sprites\" | \"maps\",\n\t\tload: (url: string, res: TRes, onReady: () => void) => any,\n\t\tcreatePlaceholder: (name: string, res: TRes) => any,\n\t): Promise<void> {\n\t\tif (!resources) return;\n\n\t\tconst promises = resources.map(\n\t\t\t(res) =>\n\t\t\t\tnew Promise<void>((resolve) => {\n\t\t\t\t\tconst name = res.file.split(\".\")[0].replace(/-/g, \"/\");\n\t\t\t\t\tconst url = `${this.url}${urlPrefix}/${res.file}?v=${res.version || 0}`;\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst inner = new Promise<void>((onReady) => {\n\t\t\t\t\t\t\tthis.collections[collectionKey][name] = load(url, res, onReady);\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\twithTimeout(inner, ASSET_LOAD_TIMEOUT_MS).then(resolve).catch((err) => {\n\t\t\t\t\t\t\tthis.listener?.log?.(`[AssetLoader] Failed to load ${collectionKey.slice(0, -1)} \"${name}\": ${String(err)}`);\n\t\t\t\t\t\t\tthis.collections[collectionKey][name] = createPlaceholder(name, res);\n\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tthis.listener?.log?.(`[AssetLoader] Failed to load ${collectionKey.slice(0, -1)} \"${name}\": ${String(err)}`);\n\t\t\t\t\t\tthis.collections[collectionKey][name] = createPlaceholder(name, res);\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t);\n\n\t\tawait Promise.all(promises);\n\t}\n\n\t/**\n\t * Load sprites\n\t */\n\tprivate async loadSprites(): Promise<void> {\n\t\tawait this.loadCallbackAssets(\n\t\t\tthis.resources.images,\n\t\t\t\"sprites\",\n\t\t\t\"sprites\",\n\t\t\t(url, img, onReady) => LoadSprite(url, img.properties, onReady),\n\t\t\t(name, img) => ({\n\t\t\t\tname,\n\t\t\t\tready: false,\n\t\t\t\tframes: [],\n\t\t\t\tfps: (img.properties as any)?.fps || 5,\n\t\t\t\twidth: 0,\n\t\t\t\theight: 0,\n\t\t\t}),\n\t\t);\n\t}\n\n\t/**\n\t * Load maps\n\t */\n\tprivate async loadMaps(): Promise<void> {\n\t\tawait this.loadCallbackAssets(\n\t\t\tthis.resources.maps,\n\t\t\t\"maps\",\n\t\t\t\"maps\",\n\t\t\t(url, _mapRes, onReady) => LoadMap(url, this.collections.sprites, onReady),\n\t\t\t(name) => ({\n\t\t\t\tname,\n\t\t\t\tready: false,\n\t\t\t\twidth: 0,\n\t\t\t\theight: 0,\n\t\t\t\tblock_width: DEFAULT_BLOCK_SIZE,\n\t\t\t\tblock_height: DEFAULT_BLOCK_SIZE,\n\t\t\t\tdata: [],\n\t\t\t}),\n\t\t);\n\t}\n\n\t/**\n\t * Load sounds\n\t */\n\tprivate async loadSounds(): Promise<void> {\n\t\tif (!this.resources.sounds) return;\n\n\t\tconst promises = this.resources.sounds.map((sound) => {\n\t\t\treturn new Promise<void>((resolve) => {\n\t\t\t\tconst name = sound.file.split(\".\")[0];\n\t\t\t\tconst url = `${this.url}sounds/${sound.file}?v=${sound.version || 0}`;\n\n\t\t\t\ttry {\n\t\t\t\t\t// Sound class handles loading via XMLHttpRequest and AudioBuffer internally.\n\t\t\t\t\t// Resolve immediately — readiness is polled via isReady()/getProgress() in the game loop.\n\t\t\t\t\tconst soundInstance = new Sound(this.audioCore, url);\n\t\t\t\t\tthis.collections.sounds[name] = soundInstance;\n\t\t\t\t\tresolve();\n\t\t\t\t} catch (err) {\n\t\t\t\t\tthis.listener?.log?.(`[AssetLoader] Failed to load sound \"${name}\": ${String(err)}`);\n\t\t\t\t\tthis.collections.sounds[name] = new Sound(this.audioCore, url);\n\t\t\t\t\tresolve();\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\tawait Promise.all(promises);\n\t}\n\n\t/**\n\t * Load music\n\t */\n\tprivate async loadMusic(): Promise<void> {\n\t\tif (!this.resources.music) return;\n\n\t\tconst promises = this.resources.music.map((mus) => {\n\t\t\treturn new Promise<void>((resolve) => {\n\t\t\t\tconst name = mus.file.split(\".\")[0];\n\t\t\t\tconst url = `${this.url}music/${mus.file}?v=${mus.version || 0}`;\n\n\t\t\t\ttry {\n\t\t\t\t\t// Music class handles HTML5 Audio internally (streaming — ready immediately).\n\t\t\t\t\tconst musicInstance = new Music(this.audioCore, url);\n\t\t\t\t\tthis.collections.music[name] = musicInstance;\n\t\t\t\t\tresolve();\n\t\t\t\t} catch (err) {\n\t\t\t\t\tthis.listener?.log?.(`[AssetLoader] Failed to load music \"${name}\": ${String(err)}`);\n\t\t\t\t\tthis.collections.music[name] = new Music(this.audioCore, url);\n\t\t\t\t\tresolve();\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\tawait Promise.all(promises);\n\t}\n\n\t/**\n\t * Load generic assets\n\t */\n\tprivate async loadGenericAssets(): Promise<void> {\n\t\tif (!this.resources.assets) return;\n\n\t\tfor (const asset of this.resources.assets) {\n\t\t\tconst name = asset.file.split(\".\")[0].replace(/-/g, \"/\");\n\t\t\tthis.collections.assets[name] = {\n\t\t\t\tname,\n\t\t\t\tfile: asset.file,\n\t\t\t\tversion: asset.version,\n\t\t\t};\n\t\t}\n\t}\n\n\t/**\n\t * Check if all assets are ready\n\t */\n\tisReady(): boolean {\n\t\treturn this.countReady() === this.countTotal();\n\t}\n\n\t/**\n\t * Get loading progress (0-1)\n\t */\n\tgetProgress(): number {\n\t\tconst total = this.countTotal();\n\t\tif (total === 0) return 1;\n\t\treturn this.countReady() / total;\n\t}\n\n\t/**\n\t * Count total assets\n\t */\n\tprivate countTotal(): number {\n\t\tlet count = 0;\n\t\tcount += Object.keys(this.collections.sprites).length;\n\t\tcount += Object.keys(this.collections.maps).length;\n\t\tcount += Object.keys(this.collections.sounds).length;\n\t\tcount += Object.keys(this.collections.music).length;\n\t\treturn count;\n\t}\n\n\t/**\n\t * Count ready assets\n\t */\n\tprivate countReady(): number {\n\t\tlet ready = 0;\n\n\t\tfor (const sprite of Object.values(this.collections.sprites)) {\n\t\t\tif (sprite.ready) ready++;\n\t\t}\n\t\tfor (const map of Object.values(this.collections.maps)) {\n\t\t\tif (map.ready) ready++;\n\t\t}\n\t\tfor (const sound of Object.values(this.collections.sounds)) {\n\t\t\tif (sound.ready) ready++;\n\t\t}\n\t\tfor (const mus of Object.values(this.collections.music)) {\n\t\t\tif (mus.ready) ready++;\n\t\t}\n\n\t\treturn ready;\n\t}\n\n\t/**\n\t * Show loading bar on screen\n\t */\n\tshowLoadingBar(screenInterface: any): void {\n\t\t// Throttle redraws\n\t\tif (this.loadingBarTime && Date.now() < this.loadingBarTime + LOADING_BAR_THROTTLE_MS) {\n\t\t\treturn;\n\t\t}\n\t\tthis.loadingBarTime = Date.now();\n\n\t\tconst progress = this.getProgress();\n\t\tscreenInterface.clear(\"#000\");\n\t\tscreenInterface.drawRect(0, 0, 100, 10, \"#DDD\");\n\t\tscreenInterface.fillRect(-(1 - progress) * 48, 0, progress * 96, 6, \"#DDD\");\n\t}\n\n\t/**\n\t * Get loaded collections\n\t */\n\tgetCollections(): AssetCollections {\n\t\treturn this.collections;\n\t}\n}\n","/** Default frames per second */\nexport const DEFAULT_FPS = 60;\n\n/** Default update rate (updates per second) */\nexport const DEFAULT_UPDATE_RATE = 60;\n\n/** Frame time in milliseconds at 60 FPS */\nexport const FRAME_TIME_MS = 1000 / DEFAULT_FPS;\n\n/** Threshold in ms to detect long pauses (tab switch, etc.) */\nexport const PAUSE_THRESHOLD_MS = 160;\n\n/** Default tile/block size in pixels */\nexport const DEFAULT_BLOCK_SIZE = 16;\n\n/** Minimum interval between loading bar redraws in ms (~60fps) */\nexport const LOADING_BAR_THROTTLE_MS = 16;\n\n/** Timeout in ms for individual asset loads (sprite/map HTTP requests) */\nexport const ASSET_LOAD_TIMEOUT_MS = 30_000;\n"],"mappings":";;;;AAMA,SAASA,aAAa;AACtB,SAASC,eAAe;AACxB,SAASC,aAAa;AACtB,SAASC,cAAc;;;ACAvB,SAAoBC,SAAAA,QAAOC,aAAa;;;ACRjC,IAAMC,cAAc;AAMpB,IAAMC,gBAAgB,MAAOC;AAM7B,IAAMC,qBAAqB;AAG3B,IAAMC,0BAA0B;AAGhC,IAAMC,wBAAwB;;;ADRrC,SAASC,eAAe;AACxB,SAASC,kBAAkB;AAQ3B,SAASC,YAAeC,SAAqBC,IAAU;AACtD,SAAOC,QAAQC,KAAK;IACnBH;IACA,IAAIE,QAAW,CAACE,GAAGC,WAClBC,WAAW,MAAMD,OAAO,IAAIE,MAAM,8BAA8BN,EAAAA,IAAM,CAAA,GAAIA,EAAAA,CAAAA;GAE3E;AACF;AAPSF;AASF,IAAMS,cAAN,MAAMA;EA7Bb,OA6BaA;;;EACJC;EACAC;EACAC;EACAC,iBAAgC;EAChCC;EACAC;EAER,YAAYL,KAAaC,WAAsBG,WAAsBC,UAA4B;AAChG,SAAKL,MAAMA;AACX,SAAKC,YAAYA;AACjB,SAAKG,YAAYA;AACjB,SAAKC,WAAWA;AAChB,SAAKH,cAAc;MAClBI,SAAS,CAAC;MACVC,MAAM,CAAC;MACPC,QAAQ,CAAC;MACTC,OAAO,CAAC;MACRC,QAAQ,CAAC;IACV;EACD;;;;EAKA,MAAMC,UAAqC;AAC1C,UAAMlB,QAAQmB,IAAI;MACjB,KAAKC,YAAW;MAChB,KAAKC,SAAQ;MACb,KAAKC,WAAU;MACf,KAAKC,UAAS;MACd,KAAKC,kBAAiB;KACtB;AAED,WAAO,KAAKf;EACb;;;;E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ap","LoadSprite","withTimeout","promise","ms","Promise","race","_","reject","setTimeout","Error","AssetLoader","url","resources","collections","loadingBarTime","audioCore","listener","sprites","maps","sounds","music","assets","loadAll","all","loadSprites","loadMaps","loadSounds","loadMusic","loadGenericAssets","loadCallbackAssets","urlPrefix","collectionKey","load","createPlaceholder","promises","map","res","resolve","name","file","split","replace","version","inner","onReady","ASSET_LOAD_TIMEOUT_MS","then","catch","err","log","slice","String","images","img","LoadSprite","properties","ready","frames","fps","width","height","_mapRes","LoadMap","block_width","DEFAULT_BLOCK_SIZE","block_height","data","sound","soundInstance","Sound","mus","musicInstance","Music","asset","isReady","countReady","countTotal","getProgress","total","count","Object","keys","length","sprite","values","showLoadingBar","screenInterface","Date","now","LOADING_BAR_THROTTLE_MS","progress","clear","drawRect","fillRect","getCollections"]}
@@ -0,0 +1,83 @@
1
+ import { AudioCore } from '@al8b/audio';
2
+ import '@al8b/map';
3
+ import '@al8b/image';
4
+ import '@al8b/sprites';
5
+ import { Resources, AssetCollections } from '../types/assets.mjs';
6
+ import { RuntimeListener } from '../types/runtime.mjs';
7
+ import '@al8b/framework-shared';
8
+ import '@al8b/vm';
9
+ import '../types/bridge.mjs';
10
+ import '@al8b/time';
11
+
12
+ /**
13
+ * AssetLoader - Handles loading of game assets
14
+ *
15
+ * Responsibilities:
16
+ * - Load sprites, maps, sounds, music
17
+ * - Track loading progress
18
+ * - Show loading bar
19
+ */
20
+
21
+ declare class AssetLoader {
22
+ private url;
23
+ private resources;
24
+ private collections;
25
+ private loadingBarTime;
26
+ private audioCore;
27
+ private listener?;
28
+ constructor(url: string, resources: Resources, audioCore: AudioCore, listener?: RuntimeListener);
29
+ /**
30
+ * Load all assets
31
+ */
32
+ loadAll(): Promise<AssetCollections>;
33
+ /**
34
+ * Load a set of callback-based assets (sprites or maps) with timeout and placeholder fallback.
35
+ */
36
+ private loadCallbackAssets;
37
+ /**
38
+ * Load sprites
39
+ */
40
+ private loadSprites;
41
+ /**
42
+ * Load maps
43
+ */
44
+ private loadMaps;
45
+ /**
46
+ * Load sounds
47
+ */
48
+ private loadSounds;
49
+ /**
50
+ * Load music
51
+ */
52
+ private loadMusic;
53
+ /**
54
+ * Load generic assets
55
+ */
56
+ private loadGenericAssets;
57
+ /**
58
+ * Check if all assets are ready
59
+ */
60
+ isReady(): boolean;
61
+ /**
62
+ * Get loading progress (0-1)
63
+ */
64
+ getProgress(): number;
65
+ /**
66
+ * Count total assets
67
+ */
68
+ private countTotal;
69
+ /**
70
+ * Count ready assets
71
+ */
72
+ private countReady;
73
+ /**
74
+ * Show loading bar on screen
75
+ */
76
+ showLoadingBar(screenInterface: any): void;
77
+ /**
78
+ * Get loaded collections
79
+ */
80
+ getCollections(): AssetCollections;
81
+ }
82
+
83
+ export { AssetLoader };
@@ -0,0 +1,83 @@
1
+ import { AudioCore } from '@al8b/audio';
2
+ import '@al8b/map';
3
+ import '@al8b/image';
4
+ import '@al8b/sprites';
5
+ import { Resources, AssetCollections } from '../types/assets.js';
6
+ import { RuntimeListener } from '../types/runtime.js';
7
+ import '@al8b/framework-shared';
8
+ import '@al8b/vm';
9
+ import '../types/bridge.js';
10
+ import '@al8b/time';
11
+
12
+ /**
13
+ * AssetLoader - Handles loading of game assets
14
+ *
15
+ * Responsibilities:
16
+ * - Load sprites, maps, sounds, music
17
+ * - Track loading progress
18
+ * - Show loading bar
19
+ */
20
+
21
+ declare class AssetLoader {
22
+ private url;
23
+ private resources;
24
+ private collections;
25
+ private loadingBarTime;
26
+ private audioCore;
27
+ private listener?;
28
+ constructor(url: string, resources: Resources, audioCore: AudioCore, listener?: RuntimeListener);
29
+ /**
30
+ * Load all assets
31
+ */
32
+ loadAll(): Promise<AssetCollections>;
33
+ /**
34
+ * Load a set of callback-based assets (sprites or maps) with timeout and placeholder fallback.
35
+ */
36
+ private loadCallbackAssets;
37
+ /**
38
+ * Load sprites
39
+ */
40
+ private loadSprites;
41
+ /**
42
+ * Load maps
43
+ */
44
+ private loadMaps;
45
+ /**
46
+ * Load sounds
47
+ */
48
+ private loadSounds;
49
+ /**
50
+ * Load music
51
+ */
52
+ private loadMusic;
53
+ /**
54
+ * Load generic assets
55
+ */
56
+ private loadGenericAssets;
57
+ /**
58
+ * Check if all assets are ready
59
+ */
60
+ isReady(): boolean;
61
+ /**
62
+ * Get loading progress (0-1)
63
+ */
64
+ getProgress(): number;
65
+ /**
66
+ * Count total assets
67
+ */
68
+ private countTotal;
69
+ /**
70
+ * Count ready assets
71
+ */
72
+ private countReady;
73
+ /**
74
+ * Show loading bar on screen
75
+ */
76
+ showLoadingBar(screenInterface: any): void;
77
+ /**
78
+ * Get loaded collections
79
+ */
80
+ getCollections(): AssetCollections;
81
+ }
82
+
83
+ export { AssetLoader };