@zylem/game-lib 0.5.0 → 0.6.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 (441) hide show
  1. package/README.md +23 -41
  2. package/dist/actions.d.ts +25 -0
  3. package/dist/actions.js +287 -8
  4. package/dist/actions.js.map +1 -0
  5. package/dist/behaviors.d.ts +106 -0
  6. package/dist/behaviors.js +396 -6
  7. package/dist/behaviors.js.map +1 -0
  8. package/dist/blueprints-BOCc3Wve.d.ts +26 -0
  9. package/dist/{src/lib/camera/zylem-camera.d.ts → camera-CpbDr4-V.d.ts} +48 -27
  10. package/dist/camera.d.ts +5 -0
  11. package/dist/camera.js +608 -4
  12. package/dist/camera.js.map +1 -0
  13. package/dist/core-CZhozNRH.d.ts +466 -0
  14. package/dist/core.d.ts +10 -0
  15. package/dist/core.js +5761 -9
  16. package/dist/core.js.map +1 -0
  17. package/dist/entities-BAxfJOkk.d.ts +307 -0
  18. package/dist/entities.d.ts +6 -0
  19. package/dist/entities.js +2284 -17
  20. package/dist/entities.js.map +1 -0
  21. package/dist/{src/lib/interfaces/entity.d.ts → entity-Bq_eNEDI.d.ts} +8 -6
  22. package/dist/entity-COvRtFNG.d.ts +395 -0
  23. package/dist/main.d.ts +211 -0
  24. package/dist/main.js +7600 -56
  25. package/dist/main.js.map +1 -0
  26. package/dist/moveable-B_vyA6cw.d.ts +67 -0
  27. package/dist/stage-types-CD21XoIU.d.ts +338 -0
  28. package/dist/stage.d.ts +46 -0
  29. package/dist/stage.js +2765 -4
  30. package/dist/stage.js.map +1 -0
  31. package/dist/transformable-CUhvyuYO.d.ts +67 -0
  32. package/package.json +11 -47
  33. package/dist/.vite/manifest.json +0 -716
  34. package/dist/assets/zylem-logo.png +0 -0
  35. package/dist/examples/00-readme-example.d.ts +0 -2
  36. package/dist/examples/00-readme-example.d.ts.map +0 -1
  37. package/dist/examples/01-basic.d.ts +0 -2
  38. package/dist/examples/01-basic.d.ts.map +0 -1
  39. package/dist/examples/01.1-basic-ball.d.ts +0 -9
  40. package/dist/examples/01.1-basic-ball.d.ts.map +0 -1
  41. package/dist/examples/01.2-ricochet-test.d.ts +0 -2
  42. package/dist/examples/01.2-ricochet-test.d.ts.map +0 -1
  43. package/dist/examples/01.3-rect.d.ts +0 -2
  44. package/dist/examples/01.3-rect.d.ts.map +0 -1
  45. package/dist/examples/02-input.d.ts +0 -2
  46. package/dist/examples/02-input.d.ts.map +0 -1
  47. package/dist/examples/03-stage-test/03-stage-test.d.ts +0 -2
  48. package/dist/examples/03-stage-test/03-stage-test.d.ts.map +0 -1
  49. package/dist/examples/03-stage-test/stage0.d.ts +0 -2
  50. package/dist/examples/03-stage-test/stage0.d.ts.map +0 -1
  51. package/dist/examples/03-stage-test/stage1.d.ts +0 -2
  52. package/dist/examples/03-stage-test/stage1.d.ts.map +0 -1
  53. package/dist/examples/03-stage-test/stage2.d.ts +0 -2
  54. package/dist/examples/03-stage-test/stage2.d.ts.map +0 -1
  55. package/dist/examples/03-stage-test/stage3.d.ts +0 -2
  56. package/dist/examples/03-stage-test/stage3.d.ts.map +0 -1
  57. package/dist/examples/03.1-stage-variable.d.ts +0 -2
  58. package/dist/examples/03.1-stage-variable.d.ts.map +0 -1
  59. package/dist/examples/04-vessel-test.d.ts +0 -18
  60. package/dist/examples/04-vessel-test.d.ts.map +0 -1
  61. package/dist/examples/05-camera-test.d.ts +0 -2
  62. package/dist/examples/05-camera-test.d.ts.map +0 -1
  63. package/dist/examples/06-entity-test.d.ts +0 -2
  64. package/dist/examples/06-entity-test.d.ts.map +0 -1
  65. package/dist/examples/07-behaviors.d.ts +0 -2
  66. package/dist/examples/07-behaviors.d.ts.map +0 -1
  67. package/dist/examples/07.01-behavior-context.d.ts +0 -2
  68. package/dist/examples/07.01-behavior-context.d.ts.map +0 -1
  69. package/dist/examples/08-pong.d.ts +0 -2
  70. package/dist/examples/08-pong.d.ts.map +0 -1
  71. package/dist/examples/08.01-breakout.d.ts +0 -2
  72. package/dist/examples/08.01-breakout.d.ts.map +0 -1
  73. package/dist/examples/09-space-invaders.d.ts +0 -2
  74. package/dist/examples/09-space-invaders.d.ts.map +0 -1
  75. package/dist/examples/10-asteroids.d.ts +0 -2
  76. package/dist/examples/10-asteroids.d.ts.map +0 -1
  77. package/dist/examples/11-2d-platformer.d.ts +0 -2
  78. package/dist/examples/11-2d-platformer.d.ts.map +0 -1
  79. package/dist/examples/12-3d-platformer.d.ts +0 -2
  80. package/dist/examples/12-3d-platformer.d.ts.map +0 -1
  81. package/dist/examples/13-fps.d.ts +0 -2
  82. package/dist/examples/13-fps.d.ts.map +0 -1
  83. package/dist/examples/14-strategy.d.ts +0 -2
  84. package/dist/examples/14-strategy.d.ts.map +0 -1
  85. package/dist/examples/15-zylem-planet-demo.d.ts +0 -2
  86. package/dist/examples/15-zylem-planet-demo.d.ts.map +0 -1
  87. package/dist/examples/16-timbotron.d.ts +0 -2
  88. package/dist/examples/16-timbotron.d.ts.map +0 -1
  89. package/dist/examples/17-stress-test.d.ts +0 -2
  90. package/dist/examples/17-stress-test.d.ts.map +0 -1
  91. package/dist/examples/architecture-test.d.ts +0 -2
  92. package/dist/examples/architecture-test.d.ts.map +0 -1
  93. package/dist/examples/utils.d.ts +0 -10
  94. package/dist/examples/utils.d.ts.map +0 -1
  95. package/dist/lib/actions/behaviors/actions.js +0 -35
  96. package/dist/lib/actions/behaviors/boundaries/boundary.js +0 -40
  97. package/dist/lib/actions/behaviors/ricochet/ricochet-2d-collision.js +0 -100
  98. package/dist/lib/actions/behaviors/ricochet/ricochet-2d-in-bounds.js +0 -37
  99. package/dist/lib/actions/behaviors/ricochet/ricochet.js +0 -6
  100. package/dist/lib/actions/capabilities/moveable.js +0 -108
  101. package/dist/lib/actions/capabilities/rotatable.js +0 -82
  102. package/dist/lib/actions/capabilities/transformable.js +0 -9
  103. package/dist/lib/actions/global-change.js +0 -40
  104. package/dist/lib/camera/camera.js +0 -19
  105. package/dist/lib/camera/fixed-2d.js +0 -30
  106. package/dist/lib/camera/perspective.js +0 -10
  107. package/dist/lib/camera/third-person.js +0 -42
  108. package/dist/lib/camera/zylem-camera.js +0 -208
  109. package/dist/lib/collision/collision-builder.js +0 -46
  110. package/dist/lib/collision/collision-delegate.js +0 -6
  111. package/dist/lib/collision/utils.js +0 -24
  112. package/dist/lib/collision/world.js +0 -77
  113. package/dist/lib/core/base-node.js +0 -61
  114. package/dist/lib/core/entity-asset-loader.js +0 -54
  115. package/dist/lib/core/lifecycle-base.js +0 -20
  116. package/dist/lib/core/preset-shader.js +0 -26
  117. package/dist/lib/core/three-addons/Timer.js +0 -103
  118. package/dist/lib/core/utility/nodes.js +0 -31
  119. package/dist/lib/core/utility/strings.js +0 -14
  120. package/dist/lib/core/utility/vector.js +0 -8
  121. package/dist/lib/core/vessel.js +0 -26
  122. package/dist/lib/debug/console/console-state.js +0 -11
  123. package/dist/lib/debug/debug-state.js +0 -40
  124. package/dist/lib/device/aspect-ratio.js +0 -44
  125. package/dist/lib/entities/actor.js +0 -122
  126. package/dist/lib/entities/box.js +0 -68
  127. package/dist/lib/entities/builder.js +0 -79
  128. package/dist/lib/entities/create.js +0 -31
  129. package/dist/lib/entities/delegates/animation.js +0 -58
  130. package/dist/lib/entities/delegates/debug.js +0 -71
  131. package/dist/lib/entities/delegates/loader.js +0 -19
  132. package/dist/lib/entities/destroy.js +0 -15
  133. package/dist/lib/entities/entity-factory.js +0 -24
  134. package/dist/lib/entities/entity.js +0 -121
  135. package/dist/lib/entities/plane.js +0 -81
  136. package/dist/lib/entities/rect.js +0 -160
  137. package/dist/lib/entities/sphere.js +0 -68
  138. package/dist/lib/entities/sprite.js +0 -125
  139. package/dist/lib/entities/text.js +0 -140
  140. package/dist/lib/entities/zone.js +0 -103
  141. package/dist/lib/game/game-canvas.js +0 -57
  142. package/dist/lib/game/game-config.js +0 -78
  143. package/dist/lib/game/game-default.js +0 -23
  144. package/dist/lib/game/game-retro-resolutions.js +0 -80
  145. package/dist/lib/game/game-state.js +0 -17
  146. package/dist/lib/game/game.js +0 -131
  147. package/dist/lib/game/zylem-game.js +0 -140
  148. package/dist/lib/graphics/geometries/XZPlaneGeometry.js +0 -34
  149. package/dist/lib/graphics/material.js +0 -64
  150. package/dist/lib/graphics/mesh.js +0 -14
  151. package/dist/lib/graphics/render-pass.js +0 -56
  152. package/dist/lib/graphics/shaders/fragment/debug.glsl.js +0 -23
  153. package/dist/lib/graphics/shaders/fragment/fire.glsl.js +0 -52
  154. package/dist/lib/graphics/shaders/fragment/standard.glsl.js +0 -11
  155. package/dist/lib/graphics/shaders/fragment/stars.glsl.js +0 -44
  156. package/dist/lib/graphics/shaders/vertex/debug.glsl.js +0 -15
  157. package/dist/lib/graphics/shaders/vertex/object-shader.glsl.js +0 -11
  158. package/dist/lib/graphics/shaders/vertex/standard.glsl.js +0 -9
  159. package/dist/lib/graphics/zylem-scene.js +0 -75
  160. package/dist/lib/input/gamepad-provider.js +0 -58
  161. package/dist/lib/input/input-manager.js +0 -70
  162. package/dist/lib/input/keyboard-provider.js +0 -120
  163. package/dist/lib/stage/debug-entity-cursor.js +0 -53
  164. package/dist/lib/stage/entity-spawner.js +0 -27
  165. package/dist/lib/stage/stage-debug-delegate.js +0 -100
  166. package/dist/lib/stage/stage-default.js +0 -32
  167. package/dist/lib/stage/stage-factory.js +0 -22
  168. package/dist/lib/stage/stage-manager.js +0 -49
  169. package/dist/lib/stage/stage-state.js +0 -36
  170. package/dist/lib/stage/stage.js +0 -67
  171. package/dist/lib/stage/zylem-stage.js +0 -268
  172. package/dist/lib/systems/transformable.system.js +0 -43
  173. package/dist/node_modules/.pnpm/idb-keyval@6.2.2/node_modules/idb-keyval/dist/index.js +0 -34
  174. package/dist/node_modules/.pnpm/msgpackr@1.11.5/node_modules/msgpackr/pack.js +0 -520
  175. package/dist/node_modules/.pnpm/msgpackr@1.11.5/node_modules/msgpackr/unpack.js +0 -672
  176. package/dist/src/api/actions.d.ts +0 -5
  177. package/dist/src/api/actions.d.ts.map +0 -1
  178. package/dist/src/api/behaviors.d.ts +0 -4
  179. package/dist/src/api/behaviors.d.ts.map +0 -1
  180. package/dist/src/api/camera.d.ts +0 -4
  181. package/dist/src/api/camera.d.ts.map +0 -1
  182. package/dist/src/api/core.d.ts +0 -6
  183. package/dist/src/api/core.d.ts.map +0 -1
  184. package/dist/src/api/entities.d.ts +0 -9
  185. package/dist/src/api/entities.d.ts.map +0 -1
  186. package/dist/src/api/main.d.ts +0 -32
  187. package/dist/src/api/main.d.ts.map +0 -1
  188. package/dist/src/api/stage.d.ts +0 -5
  189. package/dist/src/api/stage.d.ts.map +0 -1
  190. package/dist/src/lib/actions/behaviors/actions.d.ts +0 -11
  191. package/dist/src/lib/actions/behaviors/actions.d.ts.map +0 -1
  192. package/dist/src/lib/actions/behaviors/behavior.d.ts +0 -6
  193. package/dist/src/lib/actions/behaviors/behavior.d.ts.map +0 -1
  194. package/dist/src/lib/actions/behaviors/boundaries/boundary.d.ts +0 -37
  195. package/dist/src/lib/actions/behaviors/boundaries/boundary.d.ts.map +0 -1
  196. package/dist/src/lib/actions/behaviors/character-controller.d.ts +0 -6
  197. package/dist/src/lib/actions/behaviors/character-controller.d.ts.map +0 -1
  198. package/dist/src/lib/actions/behaviors/debug/debug-collision.d.ts +0 -6
  199. package/dist/src/lib/actions/behaviors/debug/debug-collision.d.ts.map +0 -1
  200. package/dist/src/lib/actions/behaviors/debug/debug-update.d.ts +0 -5
  201. package/dist/src/lib/actions/behaviors/debug/debug-update.d.ts.map +0 -1
  202. package/dist/src/lib/actions/behaviors/debug/debug.d.ts +0 -10
  203. package/dist/src/lib/actions/behaviors/debug/debug.d.ts.map +0 -1
  204. package/dist/src/lib/actions/behaviors/movement/movement-sequence-2d.d.ts +0 -24
  205. package/dist/src/lib/actions/behaviors/movement/movement-sequence-2d.d.ts.map +0 -1
  206. package/dist/src/lib/actions/behaviors/ricochet/ricochet-2d-collision.d.ts +0 -11
  207. package/dist/src/lib/actions/behaviors/ricochet/ricochet-2d-collision.d.ts.map +0 -1
  208. package/dist/src/lib/actions/behaviors/ricochet/ricochet-2d-in-bounds.d.ts +0 -12
  209. package/dist/src/lib/actions/behaviors/ricochet/ricochet-2d-in-bounds.d.ts.map +0 -1
  210. package/dist/src/lib/actions/behaviors/ricochet/ricochet.d.ts +0 -44
  211. package/dist/src/lib/actions/behaviors/ricochet/ricochet.d.ts.map +0 -1
  212. package/dist/src/lib/actions/behaviors/zylem-behavior.d.ts +0 -2
  213. package/dist/src/lib/actions/behaviors/zylem-behavior.d.ts.map +0 -1
  214. package/dist/src/lib/actions/capabilities/moveable.d.ts +0 -125
  215. package/dist/src/lib/actions/capabilities/moveable.d.ts.map +0 -1
  216. package/dist/src/lib/actions/capabilities/rotatable.d.ts +0 -111
  217. package/dist/src/lib/actions/capabilities/rotatable.d.ts.map +0 -1
  218. package/dist/src/lib/actions/capabilities/transformable.d.ts +0 -7
  219. package/dist/src/lib/actions/capabilities/transformable.d.ts.map +0 -1
  220. package/dist/src/lib/actions/global-change.d.ts +0 -23
  221. package/dist/src/lib/actions/global-change.d.ts.map +0 -1
  222. package/dist/src/lib/camera/camera.d.ts +0 -16
  223. package/dist/src/lib/camera/camera.d.ts.map +0 -1
  224. package/dist/src/lib/camera/fixed-2d.d.ts +0 -32
  225. package/dist/src/lib/camera/fixed-2d.d.ts.map +0 -1
  226. package/dist/src/lib/camera/perspective.d.ts +0 -9
  227. package/dist/src/lib/camera/perspective.d.ts.map +0 -1
  228. package/dist/src/lib/camera/third-person.d.ts +0 -32
  229. package/dist/src/lib/camera/third-person.d.ts.map +0 -1
  230. package/dist/src/lib/camera/zylem-camera.d.ts.map +0 -1
  231. package/dist/src/lib/collision/collision-builder.d.ts +0 -17
  232. package/dist/src/lib/collision/collision-builder.d.ts.map +0 -1
  233. package/dist/src/lib/collision/collision-delegate.d.ts +0 -6
  234. package/dist/src/lib/collision/collision-delegate.d.ts.map +0 -1
  235. package/dist/src/lib/collision/collision-group.d.ts +0 -11
  236. package/dist/src/lib/collision/collision-group.d.ts.map +0 -1
  237. package/dist/src/lib/collision/collision-mask.d.ts +0 -18
  238. package/dist/src/lib/collision/collision-mask.d.ts.map +0 -1
  239. package/dist/src/lib/collision/collision.d.ts +0 -19
  240. package/dist/src/lib/collision/collision.d.ts.map +0 -1
  241. package/dist/src/lib/collision/utils.d.ts +0 -15
  242. package/dist/src/lib/collision/utils.d.ts.map +0 -1
  243. package/dist/src/lib/collision/world.d.ts +0 -23
  244. package/dist/src/lib/collision/world.d.ts.map +0 -1
  245. package/dist/src/lib/core/asset-manager.d.ts +0 -2
  246. package/dist/src/lib/core/asset-manager.d.ts.map +0 -1
  247. package/dist/src/lib/core/base-node-life-cycle.d.ts +0 -54
  248. package/dist/src/lib/core/base-node-life-cycle.d.ts.map +0 -1
  249. package/dist/src/lib/core/base-node.d.ts +0 -36
  250. package/dist/src/lib/core/base-node.d.ts.map +0 -1
  251. package/dist/src/lib/core/blueprints.d.ts +0 -22
  252. package/dist/src/lib/core/blueprints.d.ts.map +0 -1
  253. package/dist/src/lib/core/entity-asset-loader.d.ts +0 -16
  254. package/dist/src/lib/core/entity-asset-loader.d.ts.map +0 -1
  255. package/dist/src/lib/core/errors.d.ts +0 -5
  256. package/dist/src/lib/core/errors.d.ts.map +0 -1
  257. package/dist/src/lib/core/flags.d.ts +0 -3
  258. package/dist/src/lib/core/flags.d.ts.map +0 -1
  259. package/dist/src/lib/core/index.d.ts +0 -5
  260. package/dist/src/lib/core/index.d.ts.map +0 -1
  261. package/dist/src/lib/core/interfaces.d.ts +0 -25
  262. package/dist/src/lib/core/interfaces.d.ts.map +0 -1
  263. package/dist/src/lib/core/lazy-loader.d.ts +0 -80
  264. package/dist/src/lib/core/lazy-loader.d.ts.map +0 -1
  265. package/dist/src/lib/core/lifecycle-base.d.ts +0 -17
  266. package/dist/src/lib/core/lifecycle-base.d.ts.map +0 -1
  267. package/dist/src/lib/core/node-interface.d.ts +0 -12
  268. package/dist/src/lib/core/node-interface.d.ts.map +0 -1
  269. package/dist/src/lib/core/preset-shader.d.ts +0 -8
  270. package/dist/src/lib/core/preset-shader.d.ts.map +0 -1
  271. package/dist/src/lib/core/three-addons/Timer.d.ts +0 -92
  272. package/dist/src/lib/core/three-addons/Timer.d.ts.map +0 -1
  273. package/dist/src/lib/core/utility/nodes.d.ts +0 -13
  274. package/dist/src/lib/core/utility/nodes.d.ts.map +0 -1
  275. package/dist/src/lib/core/utility/strings.d.ts +0 -3
  276. package/dist/src/lib/core/utility/strings.d.ts.map +0 -1
  277. package/dist/src/lib/core/utility/vector.d.ts +0 -8
  278. package/dist/src/lib/core/utility/vector.d.ts.map +0 -1
  279. package/dist/src/lib/core/vector.d.ts +0 -4
  280. package/dist/src/lib/core/vector.d.ts.map +0 -1
  281. package/dist/src/lib/core/vessel.d.ts +0 -13
  282. package/dist/src/lib/core/vessel.d.ts.map +0 -1
  283. package/dist/src/lib/debug/console/console-state.d.ts +0 -20
  284. package/dist/src/lib/debug/console/console-state.d.ts.map +0 -1
  285. package/dist/src/lib/debug/console/console-store.d.ts +0 -6
  286. package/dist/src/lib/debug/console/console-store.d.ts.map +0 -1
  287. package/dist/src/lib/debug/debug-state.d.ts +0 -38
  288. package/dist/src/lib/debug/debug-state.d.ts.map +0 -1
  289. package/dist/src/lib/debug/debug-store.d.ts +0 -15
  290. package/dist/src/lib/debug/debug-store.d.ts.map +0 -1
  291. package/dist/src/lib/debug/state-based-debug-loader.d.ts +0 -8
  292. package/dist/src/lib/debug/state-based-debug-loader.d.ts.map +0 -1
  293. package/dist/src/lib/device/aspect-ratio.d.ts +0 -38
  294. package/dist/src/lib/device/aspect-ratio.d.ts.map +0 -1
  295. package/dist/src/lib/device/desktop.d.ts +0 -2
  296. package/dist/src/lib/device/desktop.d.ts.map +0 -1
  297. package/dist/src/lib/device/mobile.d.ts +0 -2
  298. package/dist/src/lib/device/mobile.d.ts.map +0 -1
  299. package/dist/src/lib/device/tablet.d.ts +0 -2
  300. package/dist/src/lib/device/tablet.d.ts.map +0 -1
  301. package/dist/src/lib/entities/actor.d.ts +0 -44
  302. package/dist/src/lib/entities/actor.d.ts.map +0 -1
  303. package/dist/src/lib/entities/box.d.ts +0 -27
  304. package/dist/src/lib/entities/box.d.ts.map +0 -1
  305. package/dist/src/lib/entities/builder.d.ts +0 -28
  306. package/dist/src/lib/entities/builder.d.ts.map +0 -1
  307. package/dist/src/lib/entities/create.d.ts +0 -15
  308. package/dist/src/lib/entities/create.d.ts.map +0 -1
  309. package/dist/src/lib/entities/delegates/animation.d.ts +0 -33
  310. package/dist/src/lib/entities/delegates/animation.d.ts.map +0 -1
  311. package/dist/src/lib/entities/delegates/debug.d.ts +0 -29
  312. package/dist/src/lib/entities/delegates/debug.d.ts.map +0 -1
  313. package/dist/src/lib/entities/delegates/loader.d.ts +0 -12
  314. package/dist/src/lib/entities/delegates/loader.d.ts.map +0 -1
  315. package/dist/src/lib/entities/destroy.d.ts +0 -4
  316. package/dist/src/lib/entities/destroy.d.ts.map +0 -1
  317. package/dist/src/lib/entities/entity-factory.d.ts +0 -10
  318. package/dist/src/lib/entities/entity-factory.d.ts.map +0 -1
  319. package/dist/src/lib/entities/entity.d.ts +0 -98
  320. package/dist/src/lib/entities/entity.d.ts.map +0 -1
  321. package/dist/src/lib/entities/index.d.ts +0 -12
  322. package/dist/src/lib/entities/index.d.ts.map +0 -1
  323. package/dist/src/lib/entities/plane.d.ts +0 -36
  324. package/dist/src/lib/entities/plane.d.ts.map +0 -1
  325. package/dist/src/lib/entities/rect.d.ts +0 -63
  326. package/dist/src/lib/entities/rect.d.ts.map +0 -1
  327. package/dist/src/lib/entities/sphere.d.ts +0 -29
  328. package/dist/src/lib/entities/sphere.d.ts.map +0 -1
  329. package/dist/src/lib/entities/sprite.d.ts +0 -54
  330. package/dist/src/lib/entities/sprite.d.ts.map +0 -1
  331. package/dist/src/lib/entities/text.d.ts +0 -49
  332. package/dist/src/lib/entities/text.d.ts.map +0 -1
  333. package/dist/src/lib/entities/zone.d.ts +0 -54
  334. package/dist/src/lib/entities/zone.d.ts.map +0 -1
  335. package/dist/src/lib/game/game-blueprint.d.ts +0 -38
  336. package/dist/src/lib/game/game-blueprint.d.ts.map +0 -1
  337. package/dist/src/lib/game/game-canvas.d.ts +0 -35
  338. package/dist/src/lib/game/game-canvas.d.ts.map +0 -1
  339. package/dist/src/lib/game/game-config.d.ts +0 -59
  340. package/dist/src/lib/game/game-config.d.ts.map +0 -1
  341. package/dist/src/lib/game/game-default.d.ts +0 -14
  342. package/dist/src/lib/game/game-default.d.ts.map +0 -1
  343. package/dist/src/lib/game/game-interfaces.d.ts +0 -29
  344. package/dist/src/lib/game/game-interfaces.d.ts.map +0 -1
  345. package/dist/src/lib/game/game-retro-resolutions.d.ts +0 -25
  346. package/dist/src/lib/game/game-retro-resolutions.d.ts.map +0 -1
  347. package/dist/src/lib/game/game-state.d.ts +0 -11
  348. package/dist/src/lib/game/game-state.d.ts.map +0 -1
  349. package/dist/src/lib/game/game.d.ts +0 -39
  350. package/dist/src/lib/game/game.d.ts.map +0 -1
  351. package/dist/src/lib/game/zylem-game.d.ts +0 -58
  352. package/dist/src/lib/game/zylem-game.d.ts.map +0 -1
  353. package/dist/src/lib/graphics/geometries/XZPlaneGeometry.d.ts +0 -8
  354. package/dist/src/lib/graphics/geometries/XZPlaneGeometry.d.ts.map +0 -1
  355. package/dist/src/lib/graphics/material.d.ts +0 -29
  356. package/dist/src/lib/graphics/material.d.ts.map +0 -1
  357. package/dist/src/lib/graphics/mesh.d.ts +0 -19
  358. package/dist/src/lib/graphics/mesh.d.ts.map +0 -1
  359. package/dist/src/lib/graphics/render-pass.d.ts +0 -17
  360. package/dist/src/lib/graphics/render-pass.d.ts.map +0 -1
  361. package/dist/src/lib/graphics/zylem-scene.d.ts +0 -50
  362. package/dist/src/lib/graphics/zylem-scene.d.ts.map +0 -1
  363. package/dist/src/lib/input/gamepad-provider.d.ts +0 -14
  364. package/dist/src/lib/input/gamepad-provider.d.ts.map +0 -1
  365. package/dist/src/lib/input/input-manager.d.ts +0 -15
  366. package/dist/src/lib/input/input-manager.d.ts.map +0 -1
  367. package/dist/src/lib/input/input-provider.d.ts +0 -7
  368. package/dist/src/lib/input/input-provider.d.ts.map +0 -1
  369. package/dist/src/lib/input/input.d.ts +0 -48
  370. package/dist/src/lib/input/input.d.ts.map +0 -1
  371. package/dist/src/lib/input/keyboard-provider.d.ts +0 -21
  372. package/dist/src/lib/input/keyboard-provider.d.ts.map +0 -1
  373. package/dist/src/lib/interfaces/entity.d.ts.map +0 -1
  374. package/dist/src/lib/sounds/index.d.ts +0 -3
  375. package/dist/src/lib/sounds/index.d.ts.map +0 -1
  376. package/dist/src/lib/sounds/ping-pong-sound.d.ts +0 -5
  377. package/dist/src/lib/sounds/ping-pong-sound.d.ts.map +0 -1
  378. package/dist/src/lib/sounds/ricochet-sound.d.ts +0 -5
  379. package/dist/src/lib/sounds/ricochet-sound.d.ts.map +0 -1
  380. package/dist/src/lib/stage/debug-entity-cursor.d.ts +0 -24
  381. package/dist/src/lib/stage/debug-entity-cursor.d.ts.map +0 -1
  382. package/dist/src/lib/stage/entity-spawner.d.ts +0 -9
  383. package/dist/src/lib/stage/entity-spawner.d.ts.map +0 -1
  384. package/dist/src/lib/stage/stage-camera-debug-delegate.d.ts +0 -14
  385. package/dist/src/lib/stage/stage-camera-debug-delegate.d.ts.map +0 -1
  386. package/dist/src/lib/stage/stage-debug-delegate.d.ts +0 -26
  387. package/dist/src/lib/stage/stage-debug-delegate.d.ts.map +0 -1
  388. package/dist/src/lib/stage/stage-default.d.ts +0 -3
  389. package/dist/src/lib/stage/stage-default.d.ts.map +0 -1
  390. package/dist/src/lib/stage/stage-factory.d.ts +0 -6
  391. package/dist/src/lib/stage/stage-factory.d.ts.map +0 -1
  392. package/dist/src/lib/stage/stage-manager.d.ts +0 -30
  393. package/dist/src/lib/stage/stage-manager.d.ts.map +0 -1
  394. package/dist/src/lib/stage/stage-state.d.ts +0 -14
  395. package/dist/src/lib/stage/stage-state.d.ts.map +0 -1
  396. package/dist/src/lib/stage/stage.d.ts +0 -35
  397. package/dist/src/lib/stage/stage.d.ts.map +0 -1
  398. package/dist/src/lib/stage/zylem-stage.d.ts +0 -128
  399. package/dist/src/lib/stage/zylem-stage.d.ts.map +0 -1
  400. package/dist/src/lib/systems/test-system.d.ts +0 -2
  401. package/dist/src/lib/systems/test-system.d.ts.map +0 -1
  402. package/dist/src/lib/systems/transformable.system.d.ts +0 -25
  403. package/dist/src/lib/systems/transformable.system.d.ts.map +0 -1
  404. package/dist/src/lib/types/entity-types.d.ts +0 -24
  405. package/dist/src/lib/types/entity-types.d.ts.map +0 -1
  406. package/dist/src/lib/types/index.d.ts +0 -3
  407. package/dist/src/lib/types/index.d.ts.map +0 -1
  408. package/dist/src/lib/types/stage-types.d.ts +0 -26
  409. package/dist/src/lib/types/stage-types.d.ts.map +0 -1
  410. package/dist/src/lib/ui/Debug.d.ts +0 -6
  411. package/dist/src/lib/ui/Debug.d.ts.map +0 -1
  412. package/dist/src/lib/ui/console/Console.d.ts +0 -7
  413. package/dist/src/lib/ui/console/Console.d.ts.map +0 -1
  414. package/dist/src/lib/ui/debug-panel/AccordionMenu.d.ts +0 -7
  415. package/dist/src/lib/ui/debug-panel/AccordionMenu.d.ts.map +0 -1
  416. package/dist/src/lib/ui/debug-panel/Menu.d.ts +0 -6
  417. package/dist/src/lib/ui/debug-panel/Menu.d.ts.map +0 -1
  418. package/dist/src/lib/ui/debug-panel/sections/EntitiesSection.d.ts +0 -4
  419. package/dist/src/lib/ui/debug-panel/sections/EntitiesSection.d.ts.map +0 -1
  420. package/dist/src/lib/ui/debug-panel/sections/GameSection.d.ts +0 -3
  421. package/dist/src/lib/ui/debug-panel/sections/GameSection.d.ts.map +0 -1
  422. package/dist/src/lib/ui/debug-panel/sections/StagesSection.d.ts +0 -3
  423. package/dist/src/lib/ui/debug-panel/sections/StagesSection.d.ts.map +0 -1
  424. package/dist/src/lib/ui/debug-panel/sections/all.d.ts +0 -4
  425. package/dist/src/lib/ui/debug-panel/sections/all.d.ts.map +0 -1
  426. package/dist/src/lib/ui/toolbar/Toolbar.d.ts +0 -6
  427. package/dist/src/lib/ui/toolbar/Toolbar.d.ts.map +0 -1
  428. package/dist/tests/e2e/basic-game.spec.d.ts +0 -2
  429. package/dist/tests/e2e/basic-game.spec.d.ts.map +0 -1
  430. package/dist/tests/integration/debug.sim.spec.d.ts +0 -2
  431. package/dist/tests/integration/debug.sim.spec.d.ts.map +0 -1
  432. package/dist/tests/unit/collision/collision.spec.d.ts +0 -2
  433. package/dist/tests/unit/collision/collision.spec.d.ts.map +0 -1
  434. package/dist/tests/unit/core/base-node.spec.d.ts +0 -2
  435. package/dist/tests/unit/core/base-node.spec.d.ts.map +0 -1
  436. package/dist/tests/unit/core/game.spec.d.ts +0 -2
  437. package/dist/tests/unit/core/game.spec.d.ts.map +0 -1
  438. package/dist/tests/unit/core/stage.spec.d.ts +0 -2
  439. package/dist/tests/unit/core/stage.spec.d.ts.map +0 -1
  440. package/dist/tests/unit/core/vessel.spec.d.ts +0 -2
  441. package/dist/tests/unit/core/vessel.spec.d.ts.map +0 -1
@@ -1,125 +0,0 @@
1
- import { ColliderDesc as h } from "@dimforge/rapier3d-compat";
2
- import { Color as d, Vector3 as p, TextureLoader as f, SpriteMaterial as y, Sprite as A, Group as x, Quaternion as I, Euler as g } from "three";
3
- import { GameEntity as S } from "./entity.js";
4
- import { EntityCollisionBuilder as w, EntityBuilder as b } from "./builder.js";
5
- import { createEntity as z } from "./create.js";
6
- import { DebugDelegate as E } from "./delegates/debug.js";
7
- const l = {
8
- size: new p(1, 1, 1),
9
- position: new p(0, 0, 0),
10
- collision: {
11
- static: !1
12
- },
13
- material: {
14
- color: new d("#ffffff"),
15
- shader: "standard"
16
- },
17
- images: [],
18
- animations: []
19
- };
20
- class C extends w {
21
- collider(t) {
22
- const i = t.collisionSize || t.size || new p(1, 1, 1), e = { x: i.x / 2, y: i.y / 2, z: i.z / 2 };
23
- return h.cuboid(e.x, e.y, e.z);
24
- }
25
- }
26
- class D extends b {
27
- createEntity(t) {
28
- return new o(t);
29
- }
30
- }
31
- const T = Symbol("Sprite");
32
- class o extends S {
33
- static type = T;
34
- sprites = [];
35
- spriteMap = /* @__PURE__ */ new Map();
36
- currentSpriteIndex = 0;
37
- animations = /* @__PURE__ */ new Map();
38
- currentAnimation = null;
39
- currentAnimationFrame = "";
40
- currentAnimationIndex = 0;
41
- currentAnimationTime = 0;
42
- constructor(t) {
43
- super(), this.options = { ...l, ...t }, this.createSpritesFromImages(t?.images || []), this.createAnimations(t?.animations || []), this.lifeCycleDelegate = {
44
- update: [this.spriteUpdate.bind(this)],
45
- destroy: [this.spriteDestroy.bind(this)]
46
- };
47
- }
48
- createSpritesFromImages(t) {
49
- const i = new f();
50
- t.forEach((e, s) => {
51
- const n = i.load(e.file), r = new y({
52
- map: n,
53
- transparent: !0
54
- }), a = new A(r);
55
- a.position.normalize(), this.sprites.push(a), this.spriteMap.set(e.name, s);
56
- }), this.group = new x(), this.group.add(...this.sprites);
57
- }
58
- createAnimations(t) {
59
- t.forEach((i) => {
60
- const { name: e, frames: s, loop: n = !1, speed: r = 1 } = i, a = {
61
- frames: s.map((u, m) => ({
62
- key: u,
63
- index: m,
64
- time: (typeof r == "number" ? r : r[m]) * (m + 1),
65
- duration: typeof r == "number" ? r : r[m]
66
- })),
67
- loop: n
68
- };
69
- this.animations.set(e, a);
70
- });
71
- }
72
- setSprite(t) {
73
- const e = this.spriteMap.get(t) ?? 0;
74
- this.currentSpriteIndex = e, this.sprites.forEach((s, n) => {
75
- s.visible = this.currentSpriteIndex === n;
76
- });
77
- }
78
- setAnimation(t, i) {
79
- const e = this.animations.get(t);
80
- if (!e)
81
- return;
82
- const { loop: s, frames: n } = e, r = n[this.currentAnimationIndex];
83
- t === this.currentAnimation ? (this.currentAnimationFrame = r.key, this.currentAnimationTime += i, this.setSprite(this.currentAnimationFrame)) : this.currentAnimation = t, this.currentAnimationTime > r.time && this.currentAnimationIndex++, this.currentAnimationIndex >= n.length && (s ? (this.currentAnimationIndex = 0, this.currentAnimationTime = 0) : this.currentAnimationTime = n[this.currentAnimationIndex].time);
84
- }
85
- async spriteUpdate(t) {
86
- this.sprites.forEach((i) => {
87
- if (i.material) {
88
- const e = this.body?.rotation();
89
- if (e) {
90
- const s = new I(e.x, e.y, e.z, e.w), n = new g().setFromQuaternion(s, "XYZ");
91
- i.material.rotation = n.z;
92
- }
93
- i.scale.set(this.options.size?.x ?? 1, this.options.size?.y ?? 1, this.options.size?.z ?? 1);
94
- }
95
- });
96
- }
97
- async spriteDestroy(t) {
98
- this.sprites.forEach((i) => {
99
- i.removeFromParent();
100
- }), this.group?.remove(...this.sprites), this.group?.removeFromParent();
101
- }
102
- buildInfo() {
103
- return {
104
- ...new E(this).buildDebugInfo(),
105
- type: String(o.type)
106
- };
107
- }
108
- }
109
- async function q(...c) {
110
- return z({
111
- args: c,
112
- defaultConfig: l,
113
- EntityClass: o,
114
- BuilderClass: D,
115
- CollisionBuilderClass: C,
116
- entityType: o.type
117
- });
118
- }
119
- export {
120
- T as SPRITE_TYPE,
121
- D as SpriteBuilder,
122
- C as SpriteCollisionBuilder,
123
- o as ZylemSprite,
124
- q as sprite
125
- };
@@ -1,140 +0,0 @@
1
- import { Vector2 as m, Group as v, CanvasTexture as d, LinearFilter as l, SpriteMaterial as y, Sprite as T, ClampToEdgeWrapping as _, Color as f } from "three";
2
- import { GameEntity as S } from "./entity.js";
3
- import { EntityBuilder as F } from "./builder.js";
4
- import { createEntity as R } from "./create.js";
5
- import { DebugDelegate as H } from "./delegates/debug.js";
6
- const u = {
7
- position: void 0,
8
- text: "",
9
- fontFamily: 'Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',
10
- fontSize: 18,
11
- fontColor: "#FFFFFF",
12
- backgroundColor: null,
13
- padding: 4,
14
- stickToViewport: !0,
15
- screenPosition: new m(24, 24),
16
- zDistance: 1
17
- };
18
- class k extends F {
19
- createEntity(t) {
20
- return new c(t);
21
- }
22
- }
23
- const b = Symbol("Text");
24
- class c extends S {
25
- static type = b;
26
- _sprite = null;
27
- _texture = null;
28
- _canvas = null;
29
- _ctx = null;
30
- _cameraRef = null;
31
- _lastCanvasW = 0;
32
- _lastCanvasH = 0;
33
- constructor(t) {
34
- super(), this.options = { ...u, ...t }, this.group = new v(), this.createSprite(), this.lifeCycleDelegate = {
35
- setup: [this.textSetup.bind(this)],
36
- update: [this.textUpdate.bind(this)]
37
- };
38
- }
39
- createSprite() {
40
- this._canvas = document.createElement("canvas"), this._ctx = this._canvas.getContext("2d"), this._texture = new d(this._canvas), this._texture.minFilter = l, this._texture.magFilter = l;
41
- const t = new y({
42
- map: this._texture,
43
- transparent: !0,
44
- depthTest: !1,
45
- depthWrite: !1,
46
- alphaTest: 0.5
47
- });
48
- this._sprite = new T(t), this.group?.add(this._sprite), this.redrawText(this.options.text ?? "");
49
- }
50
- measureAndResizeCanvas(t, e, s, a) {
51
- if (!this._canvas || !this._ctx)
52
- return { sizeChanged: !1 };
53
- this._ctx.font = `${e}px ${s}`;
54
- const i = this._ctx.measureText(t), n = Math.ceil(i.width), r = Math.ceil(e * 1.4), o = Math.max(2, n + a * 2), h = Math.max(2, r + a * 2), p = o !== this._lastCanvasW || h !== this._lastCanvasH;
55
- return this._canvas.width = o, this._canvas.height = h, this._lastCanvasW = o, this._lastCanvasH = h, { sizeChanged: p };
56
- }
57
- drawCenteredText(t, e, s) {
58
- !this._canvas || !this._ctx || (this._ctx.font = `${e}px ${s}`, this._ctx.textAlign = "center", this._ctx.textBaseline = "middle", this._ctx.clearRect(0, 0, this._canvas.width, this._canvas.height), this.options.backgroundColor && (this._ctx.fillStyle = this.toCssColor(this.options.backgroundColor), this._ctx.fillRect(0, 0, this._canvas.width, this._canvas.height)), this._ctx.fillStyle = this.toCssColor(this.options.fontColor ?? "#FFFFFF"), this._ctx.fillText(t, this._canvas.width / 2, this._canvas.height / 2));
59
- }
60
- updateTexture(t) {
61
- !this._texture || !this._canvas || (t && (this._texture.dispose(), this._texture = new d(this._canvas), this._texture.minFilter = l, this._texture.magFilter = l, this._texture.wrapS = _, this._texture.wrapT = _), this._texture.image = this._canvas, this._texture.needsUpdate = !0, this._sprite && this._sprite.material && (this._sprite.material.map = this._texture, this._sprite.material.needsUpdate = !0));
62
- }
63
- redrawText(t) {
64
- if (!this._canvas || !this._ctx)
65
- return;
66
- const e = this.options.fontSize ?? 18, s = this.options.fontFamily ?? u.fontFamily, a = this.options.padding ?? 4, { sizeChanged: i } = this.measureAndResizeCanvas(t, e, s, a);
67
- this.drawCenteredText(t, e, s), this.updateTexture(!!i), this.options.stickToViewport && this._cameraRef && this.updateStickyTransform();
68
- }
69
- toCssColor(t) {
70
- return typeof t == "string" ? t : `#${(t instanceof f ? t : new f(t)).getHexString()}`;
71
- }
72
- textSetup(t) {
73
- this._cameraRef = t.camera, this.options.stickToViewport && this._cameraRef && (this._cameraRef.camera.add(this.group), this.updateStickyTransform());
74
- }
75
- textUpdate(t) {
76
- this._sprite && this.options.stickToViewport && this._cameraRef && this.updateStickyTransform();
77
- }
78
- getResolution() {
79
- return {
80
- width: this._cameraRef?.screenResolution.x ?? 1,
81
- height: this._cameraRef?.screenResolution.y ?? 1
82
- };
83
- }
84
- getScreenPixels(t, e, s) {
85
- const a = t.x >= 0 && t.x <= 1, i = t.y >= 0 && t.y <= 1;
86
- return {
87
- px: a ? t.x * e : t.x,
88
- py: i ? t.y * s : t.y
89
- };
90
- }
91
- computeWorldExtents(t, e) {
92
- let s = 1, a = 1;
93
- if (t.isPerspectiveCamera) {
94
- const i = t, n = Math.tan(i.fov * Math.PI / 180 / 2) * e;
95
- s = n * i.aspect, a = n;
96
- } else if (t.isOrthographicCamera) {
97
- const i = t;
98
- s = (i.right - i.left) / 2, a = (i.top - i.bottom) / 2;
99
- }
100
- return { worldHalfW: s, worldHalfH: a };
101
- }
102
- updateSpriteScale(t, e) {
103
- if (!this._canvas || !this._sprite)
104
- return;
105
- const a = t * 2 / e, i = this._canvas.height, n = Math.max(1e-4, i * a), r = this._canvas.width / this._canvas.height, o = n * r;
106
- this._sprite.scale.set(o, n, 1);
107
- }
108
- updateStickyTransform() {
109
- if (!this._sprite || !this._cameraRef)
110
- return;
111
- const t = this._cameraRef.camera, { width: e, height: s } = this.getResolution(), a = this.options.screenPosition ?? new m(24, 24), { px: i, py: n } = this.getScreenPixels(a, e, s), r = Math.max(1e-3, this.options.zDistance ?? 1), { worldHalfW: o, worldHalfH: h } = this.computeWorldExtents(t, r), p = i / e * 2 - 1, g = 1 - n / s * 2, w = p * o, C = g * h;
112
- this.group?.position.set(w, C, -r), this.updateSpriteScale(h, s);
113
- }
114
- updateText(t) {
115
- this.options.text = t, this.redrawText(t), this.options.stickToViewport && this._cameraRef && this.updateStickyTransform();
116
- }
117
- buildInfo() {
118
- return {
119
- ...new H(this).buildDebugInfo(),
120
- type: String(c.type),
121
- text: this.options.text ?? "",
122
- sticky: this.options.stickToViewport
123
- };
124
- }
125
- }
126
- async function D(...x) {
127
- return R({
128
- args: x,
129
- defaultConfig: { ...u },
130
- EntityClass: c,
131
- BuilderClass: k,
132
- entityType: c.type
133
- });
134
- }
135
- export {
136
- b as TEXT_TYPE,
137
- k as TextBuilder,
138
- c as ZylemText,
139
- D as text
140
- };
@@ -1,103 +0,0 @@
1
- import { ColliderDesc as a, ActiveCollisionTypes as h } from "@dimforge/rapier3d-compat";
2
- import { Vector3 as l } from "three";
3
- import { GameEntity as u } from "./entity.js";
4
- import { EntityCollisionBuilder as c, EntityBuilder as p } from "./builder.js";
5
- import { createEntity as E } from "./create.js";
6
- import { state as o } from "../game/game-state.js";
7
- const d = {
8
- size: new l(1, 1, 1),
9
- position: new l(0, 0, 0),
10
- collision: {
11
- static: !0
12
- },
13
- material: {
14
- shader: "standard"
15
- }
16
- };
17
- class f extends c {
18
- collider(e) {
19
- const t = e.size || new l(1, 1, 1), i = { x: t.x / 2, y: t.y / 2, z: t.z / 2 };
20
- let s = a.cuboid(i.x, i.y, i.z);
21
- return s.setSensor(!0), s.activeCollisionTypes = h.KINEMATIC_FIXED, s;
22
- }
23
- }
24
- class x extends p {
25
- createEntity(e) {
26
- return new r(e);
27
- }
28
- }
29
- const Z = Symbol("Zone");
30
- class r extends u {
31
- static type = Z;
32
- _enteredZone = /* @__PURE__ */ new Map();
33
- _exitedZone = /* @__PURE__ */ new Map();
34
- _zoneEntities = /* @__PURE__ */ new Map();
35
- constructor(e) {
36
- super(), this.options = { ...d, ...e };
37
- }
38
- handlePostCollision({ delta: e }) {
39
- return this._enteredZone.forEach((t, i) => {
40
- this.exited(e, i);
41
- }), this._enteredZone.size > 0;
42
- }
43
- handleIntersectionEvent({ other: e, delta: t }) {
44
- this._enteredZone.get(e.uuid) ? this.held(t, e) : (this.entered(e), this._zoneEntities.set(e.uuid, e));
45
- }
46
- onEnter(e) {
47
- return this.options.onEnter = e, this;
48
- }
49
- onHeld(e) {
50
- return this.options.onHeld = e, this;
51
- }
52
- onExit(e) {
53
- return this.options.onExit = e, this;
54
- }
55
- entered(e) {
56
- this._enteredZone.set(e.uuid, 1), this.options.onEnter && this.options.onEnter({
57
- self: this,
58
- visitor: e,
59
- globals: o.globals
60
- });
61
- }
62
- exited(e, t) {
63
- const i = this._exitedZone.get(t);
64
- if (i && i > 1 + e) {
65
- this._exitedZone.delete(t), this._enteredZone.delete(t);
66
- const s = this._zoneEntities.get(t);
67
- this.options.onExit && this.options.onExit({
68
- self: this,
69
- visitor: s,
70
- globals: o.globals
71
- });
72
- return;
73
- }
74
- this._exitedZone.set(t, 1 + e);
75
- }
76
- held(e, t) {
77
- const i = this._enteredZone.get(t.uuid) ?? 0;
78
- this._enteredZone.set(t.uuid, i + e), this._exitedZone.set(t.uuid, 1), this.options.onHeld && this.options.onHeld({
79
- delta: e,
80
- self: this,
81
- visitor: t,
82
- globals: o.globals,
83
- heldTime: i
84
- });
85
- }
86
- }
87
- async function b(...n) {
88
- return E({
89
- args: n,
90
- defaultConfig: d,
91
- EntityClass: r,
92
- BuilderClass: x,
93
- CollisionBuilderClass: f,
94
- entityType: r.type
95
- });
96
- }
97
- export {
98
- Z as ZONE_TYPE,
99
- x as ZoneBuilder,
100
- f as ZoneCollisionBuilder,
101
- r as ZylemZone,
102
- b as zone
103
- };
@@ -1,57 +0,0 @@
1
- import { AspectRatioDelegate as s } from "../device/aspect-ratio.js";
2
- class o {
3
- id;
4
- container;
5
- canvas;
6
- bodyBackground;
7
- fullscreen;
8
- aspectRatio;
9
- ratioDelegate = null;
10
- constructor(t) {
11
- this.id = t.id, this.container = this.ensureContainer(t.containerId ?? t.id, t.container), this.canvas = t.canvas ?? document.createElement("canvas"), this.bodyBackground = t.bodyBackground, this.fullscreen = !!t.fullscreen, this.aspectRatio = (typeof t.aspectRatio == "number", t.aspectRatio);
12
- }
13
- applyBodyBackground() {
14
- this.bodyBackground && (document.body.style.background = this.bodyBackground);
15
- }
16
- mountCanvas() {
17
- for (; this.container.firstChild; )
18
- this.container.removeChild(this.container.firstChild);
19
- this.container.appendChild(this.canvas);
20
- }
21
- mountRenderer(t, a) {
22
- for (; this.container.firstChild; )
23
- this.container.removeChild(this.container.firstChild);
24
- this.container.appendChild(t), this.canvas = t, this.attachAspectRatio(a);
25
- }
26
- centerIfFullscreen() {
27
- if (!this.fullscreen)
28
- return;
29
- const t = this.container.style;
30
- t.display = "flex", t.alignItems = "center", t.justifyContent = "center", t.position = "fixed", t.inset = "0";
31
- }
32
- attachAspectRatio(t) {
33
- this.ratioDelegate ? (this.ratioDelegate.canvas = this.canvas, this.ratioDelegate.onResize = t, this.ratioDelegate.aspectRatio = this.aspectRatio, this.ratioDelegate.apply()) : (this.ratioDelegate = new s({
34
- container: this.container,
35
- canvas: this.canvas,
36
- aspectRatio: this.aspectRatio,
37
- onResize: t
38
- }), this.ratioDelegate.attach());
39
- }
40
- destroy() {
41
- this.ratioDelegate?.detach(), this.ratioDelegate = null;
42
- }
43
- ensureContainer(t, a) {
44
- if (a)
45
- return a;
46
- if (t) {
47
- const i = document.getElementById(t);
48
- if (i)
49
- return i;
50
- }
51
- const n = t || this.id || "zylem-root", e = document.createElement("main");
52
- return e.setAttribute("id", n), e.style.position = "relative", e.style.width = "100%", e.style.height = "100%", document.body.appendChild(e), e;
53
- }
54
- }
55
- export {
56
- o as GameCanvas
57
- };
@@ -1,78 +0,0 @@
1
- import { AspectRatio as p } from "../device/aspect-ratio.js";
2
- import { getDisplayAspect as b, parseResolution as y, getPresetResolution as R } from "./game-retro-resolutions.js";
3
- class f {
4
- id;
5
- globals;
6
- stages;
7
- debug;
8
- time;
9
- input;
10
- aspectRatio;
11
- internalResolution;
12
- fullscreen;
13
- bodyBackground;
14
- container;
15
- containerId;
16
- canvas;
17
- constructor(i, o, n, e, l, d, r, a, g, c, s, h, m) {
18
- this.id = i, this.globals = o, this.stages = n, this.debug = e, this.time = l, this.input = d, this.aspectRatio = r, this.internalResolution = a, this.fullscreen = g, this.bodyBackground = c, this.container = s, this.containerId = h, this.canvas = m;
19
- }
20
- }
21
- function u(t, i) {
22
- if (i)
23
- return i;
24
- if (t) {
25
- const e = document.getElementById(t);
26
- if (e)
27
- return e;
28
- }
29
- const o = t || "zylem-root", n = document.createElement("main");
30
- return n.setAttribute("id", o), n.style.position = "relative", n.style.width = "100%", n.style.height = "100%", document.body.appendChild(n), n;
31
- }
32
- function B(t) {
33
- const i = t?.id ?? "zylem", o = u(i);
34
- return new f(i, t?.globals ?? {}, t?.stages ?? [], !!t?.debug, t?.time ?? 0, t?.input, p.SixteenByNine, void 0, !0, "#000000", o, i, void 0);
35
- }
36
- function C(t) {
37
- const i = B({
38
- id: t?.id ?? "zylem",
39
- debug: !!t?.debug,
40
- time: t?.time ?? 0,
41
- input: t?.input,
42
- stages: t?.stages ?? [],
43
- globals: t?.globals ?? {}
44
- }), o = t?.containerId ?? i.containerId, n = u(o, t?.container ?? null), e = t?.aspectRatio;
45
- let l = i.aspectRatio;
46
- if (typeof e == "number" || e && typeof e == "string")
47
- l = typeof e == "number" ? e : p[e] ?? i.aspectRatio;
48
- else if (t?.preset)
49
- try {
50
- l = b(t.preset) || i.aspectRatio;
51
- } catch {
52
- l = i.aspectRatio;
53
- }
54
- const d = t?.fullscreen ?? i.fullscreen, r = t?.bodyBackground ?? i.bodyBackground;
55
- let a;
56
- if (t?.resolution) {
57
- if (typeof t.resolution == "string") {
58
- const c = y(t.resolution);
59
- if (c && (a = c), !a && t.preset) {
60
- const s = R(t.preset, t.resolution);
61
- s && (a = { width: s.width, height: s.height });
62
- }
63
- } else if (typeof t.resolution == "object") {
64
- const c = t.resolution.width, s = t.resolution.height;
65
- Number.isFinite(c) && Number.isFinite(s) && (a = { width: c, height: s });
66
- }
67
- }
68
- const g = t?.canvas ?? void 0;
69
- return new f(t?.id ?? i.id, t?.globals ?? i.globals, t?.stages ?? i.stages, !!(t?.debug ?? i.debug), t?.time ?? i.time, t?.input ?? i.input, l, a, d, r, n, o, g);
70
- }
71
- function k(t) {
72
- return { ...t };
73
- }
74
- export {
75
- f as GameConfig,
76
- k as gameConfig,
77
- C as resolveGameConfig
78
- };
@@ -1,23 +0,0 @@
1
- import { proxy as i } from "valtio/vanilla";
2
- import { createStage as e } from "../stage/stage.js";
3
- const a = () => ({
4
- id: "zylem",
5
- globals: {},
6
- stages: [e()],
7
- debug: !1,
8
- time: 0,
9
- input: void 0
10
- }), t = i({ ...a() });
11
- function g() {
12
- return {
13
- id: t.id ?? "zylem",
14
- globals: t.globals ?? {},
15
- stages: t.stages ?? [e()],
16
- debug: t.debug,
17
- time: t.time,
18
- input: t.input
19
- };
20
- }
21
- export {
22
- g as getGameDefaultConfig
23
- };
@@ -1,80 +0,0 @@
1
- const n = {
2
- NES: {
3
- displayAspect: 1.3333333333333333,
4
- resolutions: [
5
- { key: "256x240", width: 256, height: 240, notes: "Standard NTSC; effective 240p." }
6
- ]
7
- },
8
- SNES: {
9
- displayAspect: 1.3333333333333333,
10
- resolutions: [
11
- { key: "256x224", width: 256, height: 224, notes: "Common 240p-equivalent mode." },
12
- { key: "512x448", width: 512, height: 448, notes: "Hi-res interlaced (480i)." }
13
- ]
14
- },
15
- N64: {
16
- displayAspect: 1.3333333333333333,
17
- resolutions: [
18
- { key: "320x240", width: 320, height: 240, notes: "Common 240p mode." },
19
- { key: "640x480", width: 640, height: 480, notes: "Higher resolution (480i)." }
20
- ]
21
- },
22
- PS1: {
23
- displayAspect: 1.3333333333333333,
24
- resolutions: [
25
- { key: "320x240", width: 320, height: 240, notes: "Progressive 240p common." },
26
- { key: "640x480", width: 640, height: 480, notes: "Interlaced 480i for higher detail." }
27
- ]
28
- },
29
- PS2: {
30
- displayAspect: 1.3333333333333333,
31
- resolutions: [
32
- { key: "640x480", width: 640, height: 480, notes: "480i/480p baseline." },
33
- { key: "720x480", width: 720, height: 480, notes: "480p (widescreen capable in some titles)." },
34
- { key: "1280x720", width: 1280, height: 720, notes: "720p (select titles)." }
35
- ]
36
- },
37
- PS5: {
38
- displayAspect: 1.7777777777777777,
39
- resolutions: [
40
- { key: "720x480", width: 720, height: 480, notes: "Legacy compatibility." },
41
- { key: "1280x720", width: 1280, height: 720, notes: "720p." },
42
- { key: "1920x1080", width: 1920, height: 1080, notes: "1080p." },
43
- { key: "2560x1440", width: 2560, height: 1440, notes: "1440p." },
44
- { key: "3840x2160", width: 3840, height: 2160, notes: "4K (up to 120Hz)." },
45
- { key: "7680x4320", width: 7680, height: 4320, notes: "8K (limited)." }
46
- ]
47
- },
48
- XboxOne: {
49
- displayAspect: 1.7777777777777777,
50
- resolutions: [
51
- { key: "1280x720", width: 1280, height: 720, notes: "720p (original)." },
52
- { key: "1920x1080", width: 1920, height: 1080, notes: "1080p (original)." },
53
- { key: "3840x2160", width: 3840, height: 2160, notes: "4K UHD (S/X models)." }
54
- ]
55
- }
56
- };
57
- function h(e) {
58
- return n[e].displayAspect;
59
- }
60
- function r(e, o) {
61
- const t = n[e]?.resolutions || [];
62
- if (!o)
63
- return t[0];
64
- const i = o.toLowerCase().replace(/\s+/g, "").replace("×", "x");
65
- return t.find((s) => s.key.toLowerCase() === i);
66
- }
67
- function l(e) {
68
- if (!e)
69
- return null;
70
- const t = String(e).toLowerCase().trim().replace(/\s+/g, "").replace("×", "x").match(/^(\d+)x(\d+)$/);
71
- if (!t)
72
- return null;
73
- const i = parseInt(t[1], 10), s = parseInt(t[2], 10);
74
- return !Number.isFinite(i) || !Number.isFinite(s) ? null : { width: i, height: s };
75
- }
76
- export {
77
- h as getDisplayAspect,
78
- r as getPresetResolution,
79
- l as parseResolution
80
- };
@@ -1,17 +0,0 @@
1
- import { proxy as a } from "valtio/vanilla";
2
- const o = a({
3
- id: "",
4
- globals: {},
5
- time: 0
6
- });
7
- function r(t, l) {
8
- o.globals[t] = l;
9
- }
10
- function i(t) {
11
- return t !== void 0 ? o.globals[t] : o.globals;
12
- }
13
- export {
14
- i as getGlobalState,
15
- r as setGlobalState,
16
- o as state
17
- };