@zylem/game-lib 0.4.0 → 0.5.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.
- package/dist/.vite/manifest.json +52 -13
- package/dist/examples/00-readme-example.d.ts +2 -0
- package/dist/examples/00-readme-example.d.ts.map +1 -0
- package/dist/examples/01-basic.d.ts +2 -0
- package/dist/examples/01-basic.d.ts.map +1 -0
- package/dist/examples/01.1-basic-ball.d.ts +9 -0
- package/dist/examples/01.1-basic-ball.d.ts.map +1 -0
- package/dist/examples/01.2-ricochet-test.d.ts +2 -0
- package/dist/examples/01.2-ricochet-test.d.ts.map +1 -0
- package/dist/examples/01.3-rect.d.ts +2 -0
- package/dist/examples/01.3-rect.d.ts.map +1 -0
- package/dist/examples/02-input.d.ts +2 -0
- package/dist/examples/02-input.d.ts.map +1 -0
- package/dist/examples/03-stage-test/03-stage-test.d.ts +2 -0
- package/dist/examples/03-stage-test/03-stage-test.d.ts.map +1 -0
- package/dist/examples/03-stage-test/stage0.d.ts +2 -0
- package/dist/examples/03-stage-test/stage0.d.ts.map +1 -0
- package/dist/examples/03-stage-test/stage1.d.ts +2 -0
- package/dist/examples/03-stage-test/stage1.d.ts.map +1 -0
- package/dist/examples/03-stage-test/stage2.d.ts +2 -0
- package/dist/examples/03-stage-test/stage2.d.ts.map +1 -0
- package/dist/examples/03-stage-test/stage3.d.ts +2 -0
- package/dist/examples/03-stage-test/stage3.d.ts.map +1 -0
- package/dist/examples/03.1-stage-variable.d.ts +2 -0
- package/dist/examples/03.1-stage-variable.d.ts.map +1 -0
- package/dist/examples/04-vessel-test.d.ts +18 -0
- package/dist/examples/04-vessel-test.d.ts.map +1 -0
- package/dist/examples/05-camera-test.d.ts +2 -0
- package/dist/examples/05-camera-test.d.ts.map +1 -0
- package/dist/examples/06-entity-test.d.ts +2 -0
- package/dist/examples/06-entity-test.d.ts.map +1 -0
- package/dist/examples/07-behaviors.d.ts +2 -0
- package/dist/examples/07-behaviors.d.ts.map +1 -0
- package/dist/examples/07.01-behavior-context.d.ts +2 -0
- package/dist/examples/07.01-behavior-context.d.ts.map +1 -0
- package/dist/examples/08-pong.d.ts +2 -0
- package/dist/examples/08-pong.d.ts.map +1 -0
- package/dist/examples/08.01-breakout.d.ts +2 -0
- package/dist/examples/08.01-breakout.d.ts.map +1 -0
- package/dist/examples/09-space-invaders.d.ts +2 -0
- package/dist/examples/09-space-invaders.d.ts.map +1 -0
- package/dist/examples/10-asteroids.d.ts +2 -0
- package/dist/examples/10-asteroids.d.ts.map +1 -0
- package/dist/examples/11-2d-platformer.d.ts +2 -0
- package/dist/examples/11-2d-platformer.d.ts.map +1 -0
- package/dist/examples/12-3d-platformer.d.ts +2 -0
- package/dist/examples/12-3d-platformer.d.ts.map +1 -0
- package/dist/examples/13-fps.d.ts +2 -0
- package/dist/examples/13-fps.d.ts.map +1 -0
- package/dist/examples/14-strategy.d.ts +2 -0
- package/dist/examples/14-strategy.d.ts.map +1 -0
- package/dist/examples/15-zylem-planet-demo.d.ts +2 -0
- package/dist/examples/15-zylem-planet-demo.d.ts.map +1 -0
- package/dist/examples/16-timbotron.d.ts +2 -0
- package/dist/examples/16-timbotron.d.ts.map +1 -0
- package/dist/examples/17-stress-test.d.ts +2 -0
- package/dist/examples/17-stress-test.d.ts.map +1 -0
- package/dist/examples/architecture-test.d.ts +2 -0
- package/dist/examples/architecture-test.d.ts.map +1 -0
- package/dist/examples/utils.d.ts +10 -0
- package/dist/examples/utils.d.ts.map +1 -0
- package/dist/lib/core/base-node.js +0 -1
- package/dist/lib/core/entity-asset-loader.js +1 -4
- package/dist/lib/core/preset-shader.js +1 -5
- package/dist/lib/core/vessel.js +0 -1
- package/dist/lib/entities/actor.js +0 -3
- package/dist/lib/entities/delegates/debug.js +1 -2
- package/dist/lib/entities/entity-factory.js +24 -0
- package/dist/lib/entities/entity.js +1 -0
- package/dist/lib/entities/sprite.js +46 -39
- package/dist/lib/game/game-config.js +0 -1
- package/dist/lib/game/game-default.js +1 -2
- package/dist/lib/game/game-retro-resolutions.js +0 -1
- package/dist/lib/game/game.js +45 -23
- package/dist/lib/game/zylem-game.js +1 -2
- package/dist/lib/stage/stage-default.js +18 -28
- package/dist/lib/stage/stage-factory.js +22 -0
- package/dist/lib/stage/stage-manager.js +49 -0
- package/dist/lib/stage/stage.js +29 -22
- package/dist/lib/stage/zylem-stage.js +0 -1
- package/dist/main.js +12 -12
- package/dist/node_modules/.pnpm/idb-keyval@6.2.2/node_modules/idb-keyval/dist/index.js +34 -0
- package/dist/node_modules/.pnpm/msgpackr@1.11.5/node_modules/msgpackr/pack.js +520 -0
- package/dist/node_modules/.pnpm/msgpackr@1.11.5/node_modules/msgpackr/unpack.js +672 -0
- package/dist/src/api/actions.d.ts.map +1 -0
- package/dist/src/api/behaviors.d.ts.map +1 -0
- package/dist/src/api/camera.d.ts.map +1 -0
- package/dist/src/api/core.d.ts.map +1 -0
- package/dist/src/api/entities.d.ts.map +1 -0
- package/dist/{api → src/api}/main.d.ts +1 -1
- package/dist/src/api/main.d.ts.map +1 -0
- package/dist/src/api/stage.d.ts +5 -0
- package/dist/src/api/stage.d.ts.map +1 -0
- package/dist/src/lib/actions/behaviors/actions.d.ts.map +1 -0
- package/dist/src/lib/actions/behaviors/behavior.d.ts.map +1 -0
- package/dist/src/lib/actions/behaviors/boundaries/boundary.d.ts.map +1 -0
- package/dist/src/lib/actions/behaviors/character-controller.d.ts.map +1 -0
- package/dist/src/lib/actions/behaviors/debug/debug-collision.d.ts.map +1 -0
- package/dist/src/lib/actions/behaviors/debug/debug-update.d.ts.map +1 -0
- package/dist/src/lib/actions/behaviors/debug/debug.d.ts.map +1 -0
- package/dist/src/lib/actions/behaviors/movement/movement-sequence-2d.d.ts.map +1 -0
- package/dist/src/lib/actions/behaviors/ricochet/ricochet-2d-collision.d.ts.map +1 -0
- package/dist/src/lib/actions/behaviors/ricochet/ricochet-2d-in-bounds.d.ts.map +1 -0
- package/dist/src/lib/actions/behaviors/ricochet/ricochet.d.ts.map +1 -0
- package/dist/src/lib/actions/behaviors/zylem-behavior.d.ts.map +1 -0
- package/dist/src/lib/actions/capabilities/moveable.d.ts.map +1 -0
- package/dist/src/lib/actions/capabilities/rotatable.d.ts.map +1 -0
- package/dist/src/lib/actions/capabilities/transformable.d.ts.map +1 -0
- package/dist/src/lib/actions/global-change.d.ts.map +1 -0
- package/dist/src/lib/camera/camera.d.ts.map +1 -0
- package/dist/src/lib/camera/fixed-2d.d.ts.map +1 -0
- package/dist/src/lib/camera/perspective.d.ts.map +1 -0
- package/dist/{lib → src/lib}/camera/third-person.d.ts +0 -8
- package/dist/src/lib/camera/third-person.d.ts.map +1 -0
- package/dist/src/lib/camera/zylem-camera.d.ts.map +1 -0
- package/dist/{lib → src/lib}/collision/collision-builder.d.ts +0 -5
- package/dist/src/lib/collision/collision-builder.d.ts.map +1 -0
- package/dist/src/lib/collision/collision-delegate.d.ts +6 -0
- package/dist/src/lib/collision/collision-delegate.d.ts.map +1 -0
- package/dist/src/lib/collision/collision-group.d.ts.map +1 -0
- package/dist/src/lib/collision/collision-mask.d.ts.map +1 -0
- package/dist/{lib → src/lib}/collision/collision.d.ts +0 -9
- package/dist/src/lib/collision/collision.d.ts.map +1 -0
- package/dist/src/lib/collision/utils.d.ts.map +1 -0
- package/dist/src/lib/collision/world.d.ts.map +1 -0
- package/dist/src/lib/core/asset-manager.d.ts.map +1 -0
- package/dist/src/lib/core/base-node-life-cycle.d.ts +54 -0
- package/dist/src/lib/core/base-node-life-cycle.d.ts.map +1 -0
- package/dist/{lib → src/lib}/core/base-node.d.ts +9 -10
- package/dist/src/lib/core/base-node.d.ts.map +1 -0
- package/dist/src/lib/core/blueprints.d.ts +22 -0
- package/dist/src/lib/core/blueprints.d.ts.map +1 -0
- package/dist/src/lib/core/entity-asset-loader.d.ts +16 -0
- package/dist/src/lib/core/entity-asset-loader.d.ts.map +1 -0
- package/dist/src/lib/core/errors.d.ts.map +1 -0
- package/dist/src/lib/core/flags.d.ts.map +1 -0
- package/dist/src/lib/core/index.d.ts.map +1 -0
- package/dist/src/lib/core/interfaces.d.ts +25 -0
- package/dist/src/lib/core/interfaces.d.ts.map +1 -0
- package/dist/src/lib/core/lazy-loader.d.ts.map +1 -0
- package/dist/src/lib/core/lifecycle-base.d.ts.map +1 -0
- package/dist/src/lib/core/node-interface.d.ts +12 -0
- package/dist/src/lib/core/node-interface.d.ts.map +1 -0
- package/dist/src/lib/core/preset-shader.d.ts +8 -0
- package/dist/src/lib/core/preset-shader.d.ts.map +1 -0
- package/dist/{lib → src/lib}/core/three-addons/Timer.d.ts +1 -16
- package/dist/src/lib/core/three-addons/Timer.d.ts.map +1 -0
- package/dist/src/lib/core/utility/nodes.d.ts.map +1 -0
- package/dist/src/lib/core/utility/strings.d.ts.map +1 -0
- package/dist/src/lib/core/utility/vector.d.ts +8 -0
- package/dist/src/lib/core/utility/vector.d.ts.map +1 -0
- package/dist/src/lib/core/vector.d.ts.map +1 -0
- package/dist/{lib → src/lib}/core/vessel.d.ts +0 -1
- package/dist/src/lib/core/vessel.d.ts.map +1 -0
- package/dist/src/lib/debug/console/console-state.d.ts.map +1 -0
- package/dist/src/lib/debug/console/console-store.d.ts.map +1 -0
- package/dist/{lib → src/lib}/debug/debug-state.d.ts +1 -7
- package/dist/src/lib/debug/debug-state.d.ts.map +1 -0
- package/dist/src/lib/debug/debug-store.d.ts.map +1 -0
- package/dist/src/lib/debug/state-based-debug-loader.d.ts.map +1 -0
- package/dist/src/lib/device/aspect-ratio.d.ts.map +1 -0
- package/dist/{lib → src/lib}/device/desktop.d.ts.map +1 -1
- package/dist/src/lib/device/mobile.d.ts.map +1 -0
- package/dist/{lib → src/lib}/device/tablet.d.ts.map +1 -1
- package/dist/{lib → src/lib}/entities/actor.d.ts +1 -15
- package/dist/src/lib/entities/actor.d.ts.map +1 -0
- package/dist/src/lib/entities/box.d.ts.map +1 -0
- package/dist/src/lib/entities/builder.d.ts.map +1 -0
- package/dist/src/lib/entities/create.d.ts.map +1 -0
- package/dist/src/lib/entities/delegates/animation.d.ts.map +1 -0
- package/dist/{lib → src/lib}/entities/delegates/debug.d.ts +1 -10
- package/dist/src/lib/entities/delegates/debug.d.ts.map +1 -0
- package/dist/src/lib/entities/delegates/loader.d.ts.map +1 -0
- package/dist/src/lib/entities/destroy.d.ts.map +1 -0
- package/dist/src/lib/entities/entity-factory.d.ts +10 -0
- package/dist/src/lib/entities/entity-factory.d.ts.map +1 -0
- package/dist/{lib → src/lib}/entities/entity.d.ts +2 -5
- package/dist/src/lib/entities/entity.d.ts.map +1 -0
- package/dist/{lib → src/lib}/entities/index.d.ts +1 -1
- package/dist/src/lib/entities/index.d.ts.map +1 -0
- package/dist/src/lib/entities/plane.d.ts.map +1 -0
- package/dist/src/lib/entities/rect.d.ts.map +1 -0
- package/dist/src/lib/entities/sphere.d.ts.map +1 -0
- package/dist/{lib → src/lib}/entities/sprite.d.ts +1 -0
- package/dist/src/lib/entities/sprite.d.ts.map +1 -0
- package/dist/src/lib/entities/text.d.ts.map +1 -0
- package/dist/src/lib/entities/zone.d.ts.map +1 -0
- package/dist/src/lib/game/game-blueprint.d.ts.map +1 -0
- package/dist/src/lib/game/game-canvas.d.ts.map +1 -0
- package/dist/{lib → src/lib}/game/game-config.d.ts +0 -4
- package/dist/src/lib/game/game-config.d.ts.map +1 -0
- package/dist/src/lib/game/game-default.d.ts +14 -0
- package/dist/src/lib/game/game-default.d.ts.map +1 -0
- package/dist/src/lib/game/game-interfaces.d.ts.map +1 -0
- package/dist/{lib → src/lib}/game/game-retro-resolutions.d.ts +2 -1
- package/dist/src/lib/game/game-retro-resolutions.d.ts.map +1 -0
- package/dist/src/lib/game/game-state.d.ts.map +1 -0
- package/dist/{lib → src/lib}/game/game.d.ts +4 -2
- package/dist/src/lib/game/game.d.ts.map +1 -0
- package/dist/{lib → src/lib}/game/zylem-game.d.ts +1 -1
- package/dist/src/lib/game/zylem-game.d.ts.map +1 -0
- package/dist/src/lib/graphics/geometries/XZPlaneGeometry.d.ts.map +1 -0
- package/dist/src/lib/graphics/material.d.ts.map +1 -0
- package/dist/src/lib/graphics/mesh.d.ts.map +1 -0
- package/dist/src/lib/graphics/render-pass.d.ts.map +1 -0
- package/dist/src/lib/graphics/zylem-scene.d.ts.map +1 -0
- package/dist/src/lib/input/gamepad-provider.d.ts.map +1 -0
- package/dist/src/lib/input/input-manager.d.ts.map +1 -0
- package/dist/src/lib/input/input-provider.d.ts.map +1 -0
- package/dist/{lib → src/lib}/input/input.d.ts +0 -4
- package/dist/src/lib/input/input.d.ts.map +1 -0
- package/dist/src/lib/input/keyboard-provider.d.ts.map +1 -0
- package/dist/{lib → src/lib}/interfaces/entity.d.ts +0 -6
- package/dist/src/lib/interfaces/entity.d.ts.map +1 -0
- package/dist/src/lib/sounds/index.d.ts.map +1 -0
- package/dist/src/lib/sounds/ping-pong-sound.d.ts.map +1 -0
- package/dist/src/lib/sounds/ricochet-sound.d.ts.map +1 -0
- package/dist/src/lib/stage/debug-entity-cursor.d.ts.map +1 -0
- package/dist/src/lib/stage/entity-spawner.d.ts.map +1 -0
- package/dist/src/lib/stage/stage-camera-debug-delegate.d.ts.map +1 -0
- package/dist/src/lib/stage/stage-debug-delegate.d.ts.map +1 -0
- package/dist/src/lib/stage/stage-default.d.ts +3 -0
- package/dist/src/lib/stage/stage-default.d.ts.map +1 -0
- package/dist/src/lib/stage/stage-factory.d.ts +6 -0
- package/dist/src/lib/stage/stage-factory.d.ts.map +1 -0
- package/dist/src/lib/stage/stage-manager.d.ts +30 -0
- package/dist/src/lib/stage/stage-manager.d.ts.map +1 -0
- package/dist/{lib → src/lib}/stage/stage-state.d.ts +1 -4
- package/dist/src/lib/stage/stage-state.d.ts.map +1 -0
- package/dist/{lib → src/lib}/stage/stage.d.ts +3 -1
- package/dist/src/lib/stage/stage.d.ts.map +1 -0
- package/dist/{lib → src/lib}/stage/zylem-stage.d.ts +0 -1
- package/dist/src/lib/stage/zylem-stage.d.ts.map +1 -0
- package/dist/src/lib/systems/test-system.d.ts.map +1 -0
- package/dist/src/lib/systems/transformable.system.d.ts.map +1 -0
- package/dist/{lib → src/lib}/types/entity-types.d.ts +0 -15
- package/dist/src/lib/types/entity-types.d.ts.map +1 -0
- package/dist/src/lib/types/index.d.ts.map +1 -0
- package/dist/{lib → src/lib}/types/stage-types.d.ts +0 -9
- package/dist/src/lib/types/stage-types.d.ts.map +1 -0
- package/dist/src/lib/ui/Debug.d.ts +6 -0
- package/dist/src/lib/ui/Debug.d.ts.map +1 -0
- package/dist/src/lib/ui/console/Console.d.ts.map +1 -0
- package/dist/src/lib/ui/debug-panel/AccordionMenu.d.ts.map +1 -0
- package/dist/src/lib/ui/debug-panel/Menu.d.ts.map +1 -0
- package/dist/src/lib/ui/debug-panel/sections/EntitiesSection.d.ts +4 -0
- package/dist/src/lib/ui/debug-panel/sections/EntitiesSection.d.ts.map +1 -0
- package/dist/src/lib/ui/debug-panel/sections/GameSection.d.ts.map +1 -0
- package/dist/src/lib/ui/debug-panel/sections/StagesSection.d.ts.map +1 -0
- package/dist/src/lib/ui/debug-panel/sections/all.d.ts.map +1 -0
- package/dist/src/lib/ui/toolbar/Toolbar.d.ts.map +1 -0
- package/dist/stage.js +4 -20
- package/dist/tests/e2e/basic-game.spec.d.ts +2 -0
- package/dist/tests/e2e/basic-game.spec.d.ts.map +1 -0
- package/dist/tests/integration/debug.sim.spec.d.ts +2 -0
- package/dist/tests/integration/debug.sim.spec.d.ts.map +1 -0
- package/dist/tests/unit/collision/collision.spec.d.ts.map +1 -1
- package/dist/tests/unit/core/base-node.spec.d.ts +2 -0
- package/dist/tests/unit/core/base-node.spec.d.ts.map +1 -0
- package/dist/tests/unit/core/game.spec.d.ts.map +1 -1
- package/dist/tests/unit/core/stage.spec.d.ts.map +1 -1
- package/dist/tests/unit/core/vessel.spec.d.ts.map +1 -1
- package/package.json +24 -42
- package/dist/api/actions.d.ts.map +0 -1
- package/dist/api/behaviors.d.ts.map +0 -1
- package/dist/api/camera.d.ts.map +0 -1
- package/dist/api/core.d.ts.map +0 -1
- package/dist/api/entities.d.ts.map +0 -1
- package/dist/api/main.d.ts.map +0 -1
- package/dist/api/stage.d.ts +0 -7
- package/dist/api/stage.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/actions.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/behavior.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/boundaries/boundary.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/character-controller.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/debug/debug-collision.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/debug/debug-update.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/debug/debug.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/movement/movement-sequence-2d.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/ricochet/ricochet-2d-collision.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/ricochet/ricochet-2d-in-bounds.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/ricochet/ricochet.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/zylem-behavior.d.ts.map +0 -1
- package/dist/lib/actions/capabilities/moveable.d.ts.map +0 -1
- package/dist/lib/actions/capabilities/rotatable.d.ts.map +0 -1
- package/dist/lib/actions/capabilities/transformable.d.ts.map +0 -1
- package/dist/lib/actions/global-change.d.ts.map +0 -1
- package/dist/lib/camera/camera.d.ts.map +0 -1
- package/dist/lib/camera/fixed-2d.d.ts.map +0 -1
- package/dist/lib/camera/perspective.d.ts.map +0 -1
- package/dist/lib/camera/third-person.d.ts.map +0 -1
- package/dist/lib/camera/zylem-camera.d.ts.map +0 -1
- package/dist/lib/collision/collision-builder.d.ts.map +0 -1
- package/dist/lib/collision/collision-delegate.d.ts +0 -12
- package/dist/lib/collision/collision-delegate.d.ts.map +0 -1
- package/dist/lib/collision/collision-group.d.ts.map +0 -1
- package/dist/lib/collision/collision-mask.d.ts.map +0 -1
- package/dist/lib/collision/collision.d.ts.map +0 -1
- package/dist/lib/collision/utils.d.ts.map +0 -1
- package/dist/lib/collision/world.d.ts.map +0 -1
- package/dist/lib/core/asset-manager.d.ts.map +0 -1
- package/dist/lib/core/base-node-life-cycle.d.ts +0 -68
- package/dist/lib/core/base-node-life-cycle.d.ts.map +0 -1
- package/dist/lib/core/base-node.d.ts.map +0 -1
- package/dist/lib/core/entity-asset-loader.d.ts +0 -30
- package/dist/lib/core/entity-asset-loader.d.ts.map +0 -1
- package/dist/lib/core/errors.d.ts.map +0 -1
- package/dist/lib/core/flags.d.ts.map +0 -1
- package/dist/lib/core/index.d.ts.map +0 -1
- package/dist/lib/core/lazy-loader.d.ts.map +0 -1
- package/dist/lib/core/lifecycle-base.d.ts.map +0 -1
- package/dist/lib/core/preset-shader.d.ts +0 -12
- package/dist/lib/core/preset-shader.d.ts.map +0 -1
- package/dist/lib/core/three-addons/Timer.d.ts.map +0 -1
- package/dist/lib/core/utility/nodes.d.ts.map +0 -1
- package/dist/lib/core/utility/strings.d.ts.map +0 -1
- package/dist/lib/core/utility/vector.d.ts +0 -14
- package/dist/lib/core/utility/vector.d.ts.map +0 -1
- package/dist/lib/core/vector.d.ts.map +0 -1
- package/dist/lib/core/vessel.d.ts.map +0 -1
- package/dist/lib/debug/console/console-state.d.ts.map +0 -1
- package/dist/lib/debug/console/console-store.d.ts.map +0 -1
- package/dist/lib/debug/debug-state.d.ts.map +0 -1
- package/dist/lib/debug/debug-store.d.ts.map +0 -1
- package/dist/lib/debug/state-based-debug-loader.d.ts.map +0 -1
- package/dist/lib/device/aspect-ratio.d.ts.map +0 -1
- package/dist/lib/device/mobile.d.ts.map +0 -1
- package/dist/lib/entities/actor.d.ts.map +0 -1
- package/dist/lib/entities/box.d.ts.map +0 -1
- package/dist/lib/entities/builder.d.ts.map +0 -1
- package/dist/lib/entities/create.d.ts.map +0 -1
- package/dist/lib/entities/delegates/animation.d.ts.map +0 -1
- package/dist/lib/entities/delegates/debug.d.ts.map +0 -1
- package/dist/lib/entities/delegates/loader.d.ts.map +0 -1
- package/dist/lib/entities/destroy.d.ts.map +0 -1
- package/dist/lib/entities/entity.d.ts.map +0 -1
- package/dist/lib/entities/index.d.ts.map +0 -1
- package/dist/lib/entities/plane.d.ts.map +0 -1
- package/dist/lib/entities/rect.d.ts.map +0 -1
- package/dist/lib/entities/sphere.d.ts.map +0 -1
- package/dist/lib/entities/sprite.d.ts.map +0 -1
- package/dist/lib/entities/text.d.ts.map +0 -1
- package/dist/lib/entities/zone.d.ts.map +0 -1
- package/dist/lib/game/game-blueprint.d.ts.map +0 -1
- package/dist/lib/game/game-canvas.d.ts.map +0 -1
- package/dist/lib/game/game-config.d.ts.map +0 -1
- package/dist/lib/game/game-default.d.ts +0 -19
- package/dist/lib/game/game-default.d.ts.map +0 -1
- package/dist/lib/game/game-interfaces.d.ts.map +0 -1
- package/dist/lib/game/game-retro-resolutions.d.ts.map +0 -1
- package/dist/lib/game/game-state.d.ts.map +0 -1
- package/dist/lib/game/game.d.ts.map +0 -1
- package/dist/lib/game/zylem-game.d.ts.map +0 -1
- package/dist/lib/graphics/geometries/XZPlaneGeometry.d.ts.map +0 -1
- package/dist/lib/graphics/material.d.ts.map +0 -1
- package/dist/lib/graphics/mesh.d.ts.map +0 -1
- package/dist/lib/graphics/render-pass.d.ts.map +0 -1
- package/dist/lib/graphics/zylem-scene.d.ts.map +0 -1
- package/dist/lib/input/gamepad-provider.d.ts.map +0 -1
- package/dist/lib/input/input-manager.d.ts.map +0 -1
- package/dist/lib/input/input-provider.d.ts.map +0 -1
- package/dist/lib/input/input.d.ts.map +0 -1
- package/dist/lib/input/keyboard-provider.d.ts.map +0 -1
- package/dist/lib/interfaces/entity.d.ts.map +0 -1
- package/dist/lib/sounds/index.d.ts.map +0 -1
- package/dist/lib/sounds/ping-pong-sound.d.ts.map +0 -1
- package/dist/lib/sounds/ricochet-sound.d.ts.map +0 -1
- package/dist/lib/stage/debug-entity-cursor.d.ts.map +0 -1
- package/dist/lib/stage/entity-spawner.d.ts.map +0 -1
- package/dist/lib/stage/stage-blueprint.d.ts +0 -45
- package/dist/lib/stage/stage-blueprint.d.ts.map +0 -1
- package/dist/lib/stage/stage-blueprint.js +0 -56
- package/dist/lib/stage/stage-camera-debug-delegate.d.ts.map +0 -1
- package/dist/lib/stage/stage-debug-delegate.d.ts.map +0 -1
- package/dist/lib/stage/stage-default.d.ts +0 -10
- package/dist/lib/stage/stage-default.d.ts.map +0 -1
- package/dist/lib/stage/stage-state.d.ts.map +0 -1
- package/dist/lib/stage/stage.d.ts.map +0 -1
- package/dist/lib/stage/zylem-stage.d.ts.map +0 -1
- package/dist/lib/systems/test-system.d.ts.map +0 -1
- package/dist/lib/systems/transformable.system.d.ts.map +0 -1
- package/dist/lib/types/entity-types.d.ts.map +0 -1
- package/dist/lib/types/index.d.ts.map +0 -1
- package/dist/lib/types/stage-types.d.ts.map +0 -1
- package/dist/lib/ui/Debug.d.ts +0 -2
- package/dist/lib/ui/Debug.d.ts.map +0 -1
- package/dist/lib/ui/console/Console.d.ts.map +0 -1
- package/dist/lib/ui/debug-panel/AccordionMenu.d.ts.map +0 -1
- package/dist/lib/ui/debug-panel/Menu.d.ts.map +0 -1
- package/dist/lib/ui/debug-panel/sections/EntitiesSection.d.ts +0 -12
- package/dist/lib/ui/debug-panel/sections/EntitiesSection.d.ts.map +0 -1
- package/dist/lib/ui/debug-panel/sections/GameSection.d.ts.map +0 -1
- package/dist/lib/ui/debug-panel/sections/StagesSection.d.ts.map +0 -1
- package/dist/lib/ui/debug-panel/sections/all.d.ts.map +0 -1
- package/dist/lib/ui/toolbar/Toolbar.d.ts.map +0 -1
- package/dist/tests/unit/stage/stage-blueprint.spec.d.ts +0 -2
- package/dist/tests/unit/stage/stage-blueprint.spec.d.ts.map +0 -1
- /package/dist/{api → src/api}/actions.d.ts +0 -0
- /package/dist/{api → src/api}/behaviors.d.ts +0 -0
- /package/dist/{api → src/api}/camera.d.ts +0 -0
- /package/dist/{api → src/api}/core.d.ts +0 -0
- /package/dist/{api → src/api}/entities.d.ts +0 -0
- /package/dist/{lib → src/lib}/actions/behaviors/actions.d.ts +0 -0
- /package/dist/{lib → src/lib}/actions/behaviors/behavior.d.ts +0 -0
- /package/dist/{lib → src/lib}/actions/behaviors/boundaries/boundary.d.ts +0 -0
- /package/dist/{lib → src/lib}/actions/behaviors/character-controller.d.ts +0 -0
- /package/dist/{lib → src/lib}/actions/behaviors/debug/debug-collision.d.ts +0 -0
- /package/dist/{lib → src/lib}/actions/behaviors/debug/debug-update.d.ts +0 -0
- /package/dist/{lib → src/lib}/actions/behaviors/debug/debug.d.ts +0 -0
- /package/dist/{lib → src/lib}/actions/behaviors/movement/movement-sequence-2d.d.ts +0 -0
- /package/dist/{lib → src/lib}/actions/behaviors/ricochet/ricochet-2d-collision.d.ts +0 -0
- /package/dist/{lib → src/lib}/actions/behaviors/ricochet/ricochet-2d-in-bounds.d.ts +0 -0
- /package/dist/{lib → src/lib}/actions/behaviors/ricochet/ricochet.d.ts +0 -0
- /package/dist/{lib → src/lib}/actions/behaviors/zylem-behavior.d.ts +0 -0
- /package/dist/{lib → src/lib}/actions/capabilities/moveable.d.ts +0 -0
- /package/dist/{lib → src/lib}/actions/capabilities/rotatable.d.ts +0 -0
- /package/dist/{lib → src/lib}/actions/capabilities/transformable.d.ts +0 -0
- /package/dist/{lib → src/lib}/actions/global-change.d.ts +0 -0
- /package/dist/{lib → src/lib}/camera/camera.d.ts +0 -0
- /package/dist/{lib → src/lib}/camera/fixed-2d.d.ts +0 -0
- /package/dist/{lib → src/lib}/camera/perspective.d.ts +0 -0
- /package/dist/{lib → src/lib}/camera/zylem-camera.d.ts +0 -0
- /package/dist/{lib → src/lib}/collision/collision-group.d.ts +0 -0
- /package/dist/{lib → src/lib}/collision/collision-mask.d.ts +0 -0
- /package/dist/{lib → src/lib}/collision/utils.d.ts +0 -0
- /package/dist/{lib → src/lib}/collision/world.d.ts +0 -0
- /package/dist/{lib → src/lib}/core/asset-manager.d.ts +0 -0
- /package/dist/{lib → src/lib}/core/errors.d.ts +0 -0
- /package/dist/{lib → src/lib}/core/flags.d.ts +0 -0
- /package/dist/{lib → src/lib}/core/index.d.ts +0 -0
- /package/dist/{lib → src/lib}/core/lazy-loader.d.ts +0 -0
- /package/dist/{lib → src/lib}/core/lifecycle-base.d.ts +0 -0
- /package/dist/{lib → src/lib}/core/utility/nodes.d.ts +0 -0
- /package/dist/{lib → src/lib}/core/utility/strings.d.ts +0 -0
- /package/dist/{lib → src/lib}/core/vector.d.ts +0 -0
- /package/dist/{lib → src/lib}/debug/console/console-state.d.ts +0 -0
- /package/dist/{lib → src/lib}/debug/console/console-store.d.ts +0 -0
- /package/dist/{lib → src/lib}/debug/debug-store.d.ts +0 -0
- /package/dist/{lib → src/lib}/debug/state-based-debug-loader.d.ts +0 -0
- /package/dist/{lib → src/lib}/device/aspect-ratio.d.ts +0 -0
- /package/dist/{lib → src/lib}/device/desktop.d.ts +0 -0
- /package/dist/{lib → src/lib}/device/mobile.d.ts +0 -0
- /package/dist/{lib → src/lib}/device/tablet.d.ts +0 -0
- /package/dist/{lib → src/lib}/entities/box.d.ts +0 -0
- /package/dist/{lib → src/lib}/entities/builder.d.ts +0 -0
- /package/dist/{lib → src/lib}/entities/create.d.ts +0 -0
- /package/dist/{lib → src/lib}/entities/delegates/animation.d.ts +0 -0
- /package/dist/{lib → src/lib}/entities/delegates/loader.d.ts +0 -0
- /package/dist/{lib → src/lib}/entities/destroy.d.ts +0 -0
- /package/dist/{lib → src/lib}/entities/plane.d.ts +0 -0
- /package/dist/{lib → src/lib}/entities/rect.d.ts +0 -0
- /package/dist/{lib → src/lib}/entities/sphere.d.ts +0 -0
- /package/dist/{lib → src/lib}/entities/text.d.ts +0 -0
- /package/dist/{lib → src/lib}/entities/zone.d.ts +0 -0
- /package/dist/{lib → src/lib}/game/game-blueprint.d.ts +0 -0
- /package/dist/{lib → src/lib}/game/game-canvas.d.ts +0 -0
- /package/dist/{lib → src/lib}/game/game-interfaces.d.ts +0 -0
- /package/dist/{lib → src/lib}/game/game-state.d.ts +0 -0
- /package/dist/{lib → src/lib}/graphics/geometries/XZPlaneGeometry.d.ts +0 -0
- /package/dist/{lib → src/lib}/graphics/material.d.ts +0 -0
- /package/dist/{lib → src/lib}/graphics/mesh.d.ts +0 -0
- /package/dist/{lib → src/lib}/graphics/render-pass.d.ts +0 -0
- /package/dist/{lib → src/lib}/graphics/zylem-scene.d.ts +0 -0
- /package/dist/{lib → src/lib}/input/gamepad-provider.d.ts +0 -0
- /package/dist/{lib → src/lib}/input/input-manager.d.ts +0 -0
- /package/dist/{lib → src/lib}/input/input-provider.d.ts +0 -0
- /package/dist/{lib → src/lib}/input/keyboard-provider.d.ts +0 -0
- /package/dist/{lib → src/lib}/sounds/index.d.ts +0 -0
- /package/dist/{lib → src/lib}/sounds/ping-pong-sound.d.ts +0 -0
- /package/dist/{lib → src/lib}/sounds/ricochet-sound.d.ts +0 -0
- /package/dist/{lib → src/lib}/stage/debug-entity-cursor.d.ts +0 -0
- /package/dist/{lib → src/lib}/stage/entity-spawner.d.ts +0 -0
- /package/dist/{lib → src/lib}/stage/stage-camera-debug-delegate.d.ts +0 -0
- /package/dist/{lib → src/lib}/stage/stage-debug-delegate.d.ts +0 -0
- /package/dist/{lib → src/lib}/systems/test-system.d.ts +0 -0
- /package/dist/{lib → src/lib}/systems/transformable.system.d.ts +0 -0
- /package/dist/{lib → src/lib}/types/index.d.ts +0 -0
- /package/dist/{lib → src/lib}/ui/console/Console.d.ts +0 -0
- /package/dist/{lib → src/lib}/ui/debug-panel/AccordionMenu.d.ts +0 -0
- /package/dist/{lib → src/lib}/ui/debug-panel/Menu.d.ts +0 -0
- /package/dist/{lib → src/lib}/ui/debug-panel/sections/GameSection.d.ts +0 -0
- /package/dist/{lib → src/lib}/ui/debug-panel/sections/StagesSection.d.ts +0 -0
- /package/dist/{lib → src/lib}/ui/debug-panel/sections/all.d.ts +0 -0
- /package/dist/{lib → src/lib}/ui/toolbar/Toolbar.d.ts +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxy as i } from "valtio/vanilla";
|
|
2
|
-
import {
|
|
2
|
+
import { createStage as e } from "../stage/stage.js";
|
|
3
3
|
const a = () => ({
|
|
4
4
|
id: "zylem",
|
|
5
5
|
globals: {},
|
|
@@ -19,6 +19,5 @@ function g() {
|
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
export {
|
|
22
|
-
t as gameDefaultsState,
|
|
23
22
|
g as getGameDefaultConfig
|
|
24
23
|
};
|
package/dist/lib/game/game.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { ZylemGame as
|
|
2
|
-
import { setPaused as
|
|
3
|
-
import { getGlobalState as
|
|
4
|
-
import { hasStages as
|
|
5
|
-
import { resolveGameConfig as
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import { ZylemGame as l } from "./zylem-game.js";
|
|
2
|
+
import { setPaused as n } from "../debug/debug-state.js";
|
|
3
|
+
import { getGlobalState as g, setGlobalState as m } from "./game-state.js";
|
|
4
|
+
import { hasStages as h, convertNodes as c } from "../core/utility/nodes.js";
|
|
5
|
+
import { resolveGameConfig as u } from "./game-config.js";
|
|
6
|
+
import { createStage as G } from "../stage/stage.js";
|
|
7
|
+
import { StageManager as i, stageState as s } from "../stage/stage-manager.js";
|
|
8
|
+
import { StageFactory as p } from "../stage/stage-factory.js";
|
|
9
|
+
class w {
|
|
8
10
|
wrappedGame = null;
|
|
9
11
|
pendingGlobalChangeHandlers = [];
|
|
10
12
|
options;
|
|
@@ -16,7 +18,7 @@ class m {
|
|
|
16
18
|
};
|
|
17
19
|
refErrorMessage = "lost reference to game";
|
|
18
20
|
constructor(e) {
|
|
19
|
-
this.options = e,
|
|
21
|
+
this.options = e, h(e) || this.options.push(G());
|
|
20
22
|
}
|
|
21
23
|
async start() {
|
|
22
24
|
const e = await this.load();
|
|
@@ -24,7 +26,7 @@ class m {
|
|
|
24
26
|
}
|
|
25
27
|
async load() {
|
|
26
28
|
console.log("loading game", this.options);
|
|
27
|
-
const e = await
|
|
29
|
+
const e = await c(this.options), a = u(e), t = new l({
|
|
28
30
|
...e,
|
|
29
31
|
...a
|
|
30
32
|
}, this);
|
|
@@ -42,10 +44,10 @@ class m {
|
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
46
|
async pause() {
|
|
45
|
-
|
|
47
|
+
n(!0);
|
|
46
48
|
}
|
|
47
49
|
async resume() {
|
|
48
|
-
|
|
50
|
+
n(!1), this.wrappedGame && (this.wrappedGame.previousTimeStamp = 0, this.wrappedGame.timer.reset());
|
|
49
51
|
}
|
|
50
52
|
async reset() {
|
|
51
53
|
if (!this.wrappedGame) {
|
|
@@ -54,26 +56,46 @@ class m {
|
|
|
54
56
|
}
|
|
55
57
|
await this.wrappedGame.loadStage(this.wrappedGame.stages[0]);
|
|
56
58
|
}
|
|
57
|
-
async
|
|
59
|
+
async previousStage() {
|
|
58
60
|
if (!this.wrappedGame) {
|
|
59
61
|
console.error(this.refErrorMessage);
|
|
60
62
|
return;
|
|
61
63
|
}
|
|
62
|
-
const e = this.wrappedGame.currentStageId, a = this.wrappedGame.stages.findIndex((r) => r.wrappedStage.uuid === e), t = this.wrappedGame.stages[a
|
|
64
|
+
const e = this.wrappedGame.currentStageId, a = this.wrappedGame.stages.findIndex((r) => r.wrappedStage.uuid === e), t = this.wrappedGame.stages[a - 1];
|
|
63
65
|
if (!t) {
|
|
64
|
-
console.error("
|
|
66
|
+
console.error("previous stage called on first stage");
|
|
65
67
|
return;
|
|
66
68
|
}
|
|
67
69
|
await this.wrappedGame.loadStage(t);
|
|
68
70
|
}
|
|
69
|
-
async
|
|
71
|
+
async loadStageFromId(e) {
|
|
70
72
|
if (!this.wrappedGame) {
|
|
71
73
|
console.error(this.refErrorMessage);
|
|
72
74
|
return;
|
|
73
75
|
}
|
|
74
|
-
|
|
76
|
+
try {
|
|
77
|
+
const a = await i.loadStageData(e), t = await p.createFromBlueprint(a);
|
|
78
|
+
await this.wrappedGame.loadStage(t), s.current = a;
|
|
79
|
+
} catch (a) {
|
|
80
|
+
console.error(`Failed to load stage ${e}`, a);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
async nextStage() {
|
|
84
|
+
if (!this.wrappedGame) {
|
|
85
|
+
console.error(this.refErrorMessage);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (s.next) {
|
|
89
|
+
const r = s.next.id;
|
|
90
|
+
if (await i.transitionForward(r), s.current) {
|
|
91
|
+
const d = await p.createFromBlueprint(s.current);
|
|
92
|
+
await this.wrappedGame.loadStage(d);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
const e = this.wrappedGame.currentStageId, a = this.wrappedGame.stages.findIndex((r) => r.wrappedStage.uuid === e), t = this.wrappedGame.stages[a + 1];
|
|
75
97
|
if (!t) {
|
|
76
|
-
console.error("
|
|
98
|
+
console.error("next stage called on last stage");
|
|
77
99
|
return;
|
|
78
100
|
}
|
|
79
101
|
await this.wrappedGame.loadStage(t);
|
|
@@ -83,14 +105,14 @@ class m {
|
|
|
83
105
|
async end() {
|
|
84
106
|
}
|
|
85
107
|
getGlobal(e) {
|
|
86
|
-
return this.wrappedGame ? this.wrappedGame.getGlobal(e) :
|
|
108
|
+
return this.wrappedGame ? this.wrappedGame.getGlobal(e) : g(e);
|
|
87
109
|
}
|
|
88
110
|
setGlobal(e, a) {
|
|
89
111
|
if (this.wrappedGame) {
|
|
90
112
|
this.wrappedGame.setGlobal(e, a);
|
|
91
113
|
return;
|
|
92
114
|
}
|
|
93
|
-
|
|
115
|
+
m(e, a);
|
|
94
116
|
}
|
|
95
117
|
onGlobalChange(e, a) {
|
|
96
118
|
if (this.wrappedGame) {
|
|
@@ -100,10 +122,10 @@ class m {
|
|
|
100
122
|
this.pendingGlobalChangeHandlers.push({ key: e, callback: a });
|
|
101
123
|
}
|
|
102
124
|
}
|
|
103
|
-
function
|
|
104
|
-
return new
|
|
125
|
+
function M(...o) {
|
|
126
|
+
return new w(o);
|
|
105
127
|
}
|
|
106
128
|
export {
|
|
107
|
-
|
|
108
|
-
|
|
129
|
+
w as Game,
|
|
130
|
+
M as createGame
|
|
109
131
|
};
|
|
@@ -1,42 +1,32 @@
|
|
|
1
|
-
import { proxy as
|
|
2
|
-
import { Vector3 as
|
|
3
|
-
import { ZylemBlueColor as
|
|
4
|
-
const
|
|
5
|
-
backgroundColor:
|
|
1
|
+
import { proxy as r } from "valtio/vanilla";
|
|
2
|
+
import { Vector3 as i } from "three";
|
|
3
|
+
import { ZylemBlueColor as n } from "../core/utility/vector.js";
|
|
4
|
+
const g = {
|
|
5
|
+
backgroundColor: n,
|
|
6
6
|
backgroundImage: null,
|
|
7
7
|
inputs: {
|
|
8
8
|
p1: ["gamepad-1", "keyboard"],
|
|
9
9
|
p2: ["gamepad-2", "keyboard"]
|
|
10
10
|
},
|
|
11
|
-
gravity: new
|
|
11
|
+
gravity: new i(0, 0, 0),
|
|
12
12
|
variables: {}
|
|
13
|
-
},
|
|
14
|
-
...
|
|
13
|
+
}, o = r({
|
|
14
|
+
...g
|
|
15
15
|
});
|
|
16
16
|
function b(a) {
|
|
17
|
-
|
|
17
|
+
const e = l();
|
|
18
|
+
let t = {};
|
|
19
|
+
return typeof a[0] == "object" && (t = a.shift() ?? {}), [{ ...e, ...t }, ...a];
|
|
18
20
|
}
|
|
19
|
-
function
|
|
20
|
-
Object.assign(t, o);
|
|
21
|
-
}
|
|
22
|
-
function m(a) {
|
|
23
|
-
const n = u();
|
|
24
|
-
let e = {};
|
|
25
|
-
return typeof a[0] == "object" && (e = a.shift() ?? {}), [{ ...n, ...e }, ...a];
|
|
26
|
-
}
|
|
27
|
-
function u() {
|
|
21
|
+
function l() {
|
|
28
22
|
return {
|
|
29
|
-
backgroundColor:
|
|
30
|
-
backgroundImage:
|
|
31
|
-
inputs:
|
|
32
|
-
gravity:
|
|
33
|
-
variables:
|
|
23
|
+
backgroundColor: o.backgroundColor,
|
|
24
|
+
backgroundImage: o.backgroundImage ?? null,
|
|
25
|
+
inputs: o.inputs ? { ...o.inputs } : void 0,
|
|
26
|
+
gravity: o.gravity,
|
|
27
|
+
variables: o.variables ? { ...o.variables } : void 0
|
|
34
28
|
};
|
|
35
29
|
}
|
|
36
30
|
export {
|
|
37
|
-
|
|
38
|
-
m as getStageOptions,
|
|
39
|
-
d as resetStageDefaults,
|
|
40
|
-
b as setStageDefaults,
|
|
41
|
-
t as stageDefaultsState
|
|
31
|
+
b as getStageOptions
|
|
42
32
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createStage as a } from "./stage.js";
|
|
2
|
+
import { EntityFactory as i } from "../entities/entity-factory.js";
|
|
3
|
+
const s = {
|
|
4
|
+
async createFromBlueprint(t) {
|
|
5
|
+
const r = a({
|
|
6
|
+
// Map blueprint properties to stage options if needed
|
|
7
|
+
// e.g. name: blueprint.name
|
|
8
|
+
});
|
|
9
|
+
if (t.entities)
|
|
10
|
+
for (const o of t.entities)
|
|
11
|
+
try {
|
|
12
|
+
const e = await i.createFromBlueprint(o);
|
|
13
|
+
r.add(e);
|
|
14
|
+
} catch (e) {
|
|
15
|
+
console.error(`Failed to create entity ${o.id} for stage ${t.id}`, e);
|
|
16
|
+
}
|
|
17
|
+
return r;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
s as StageFactory
|
|
22
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { proxy as i } from "valtio/vanilla";
|
|
2
|
+
import { set as n, get as o } from "../../node_modules/.pnpm/idb-keyval@6.2.2/node_modules/idb-keyval/dist/index.js";
|
|
3
|
+
import { pack as s } from "../../node_modules/.pnpm/msgpackr@1.11.5/node_modules/msgpackr/pack.js";
|
|
4
|
+
import { unpack as c } from "../../node_modules/.pnpm/msgpackr@1.11.5/node_modules/msgpackr/unpack.js";
|
|
5
|
+
const t = i({
|
|
6
|
+
previous: null,
|
|
7
|
+
current: null,
|
|
8
|
+
next: null,
|
|
9
|
+
isLoading: !1
|
|
10
|
+
}), p = {
|
|
11
|
+
staticRegistry: /* @__PURE__ */ new Map(),
|
|
12
|
+
registerStaticStage(r, a) {
|
|
13
|
+
this.staticRegistry.set(r, a);
|
|
14
|
+
},
|
|
15
|
+
async loadStageData(r) {
|
|
16
|
+
try {
|
|
17
|
+
const a = await o(r);
|
|
18
|
+
if (a)
|
|
19
|
+
return c(a);
|
|
20
|
+
} catch (a) {
|
|
21
|
+
console.warn(`Failed to load stage ${r} from storage`, a);
|
|
22
|
+
}
|
|
23
|
+
if (this.staticRegistry.has(r))
|
|
24
|
+
return this.staticRegistry.get(r);
|
|
25
|
+
throw new Error(`Stage ${r} not found in storage and static loading not fully implemented.`);
|
|
26
|
+
},
|
|
27
|
+
async transitionForward(r, a) {
|
|
28
|
+
if (!t.isLoading) {
|
|
29
|
+
t.isLoading = !0;
|
|
30
|
+
try {
|
|
31
|
+
t.current && await n(t.current.id, s(t.current)), t.previous = t.current, t.current = t.next, t.current?.id !== r && (a ? t.current = await a(r) : t.current = await this.loadStageData(r)), t.next = null;
|
|
32
|
+
} catch (e) {
|
|
33
|
+
console.error("Failed to transition stage:", e);
|
|
34
|
+
} finally {
|
|
35
|
+
t.isLoading = !1;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
/**
|
|
40
|
+
* Manually set the next stage to pre-load it.
|
|
41
|
+
*/
|
|
42
|
+
async preloadNext(r, a) {
|
|
43
|
+
a ? t.next = await a(r) : t.next = await this.loadStageData(r);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
p as StageManager,
|
|
48
|
+
t as stageState
|
|
49
|
+
};
|
package/dist/lib/stage/stage.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { ZylemStage as
|
|
2
|
-
import { CameraWrapper as
|
|
3
|
-
import { stageState as
|
|
4
|
-
import { getStageOptions as
|
|
5
|
-
class
|
|
1
|
+
import { ZylemStage as o } from "./zylem-stage.js";
|
|
2
|
+
import { CameraWrapper as d } from "../camera/camera.js";
|
|
3
|
+
import { stageState as r, setStageVariable as n, getStageVariable as g } from "./stage-state.js";
|
|
4
|
+
import { getStageOptions as S } from "./stage-default.js";
|
|
5
|
+
class h {
|
|
6
6
|
wrappedStage;
|
|
7
7
|
options = [];
|
|
8
|
+
// TODO: these shouldn't be here maybe more like nextFrame(stageInstance, () => {})
|
|
8
9
|
update = () => {
|
|
9
10
|
};
|
|
10
11
|
setup = () => {
|
|
@@ -15,27 +16,33 @@ class S {
|
|
|
15
16
|
this.options = t, this.wrappedStage = null;
|
|
16
17
|
}
|
|
17
18
|
async load(t, e) {
|
|
18
|
-
this.wrappedStage = new
|
|
19
|
-
const a = e instanceof
|
|
20
|
-
await this.wrappedStage.load(t, a)
|
|
19
|
+
r.entities = [], this.wrappedStage = new o(this.options), this.wrappedStage.wrapperRef = this;
|
|
20
|
+
const a = e instanceof d ? e.cameraRef : e;
|
|
21
|
+
await this.wrappedStage.load(t, a), this.wrappedStage.onEntityAdded((p) => {
|
|
22
|
+
const s = this.wrappedStage.buildEntityState(p);
|
|
23
|
+
r.entities = [...r.entities, s];
|
|
24
|
+
}, { replayExisting: !0 });
|
|
21
25
|
}
|
|
22
26
|
async addEntities(t) {
|
|
23
27
|
this.options.push(...t), this.wrappedStage && this.wrappedStage.enqueue(...t);
|
|
24
28
|
}
|
|
25
29
|
add(...t) {
|
|
26
|
-
this.
|
|
30
|
+
this.addToBlueprints(...t), this.addToStage(...t);
|
|
31
|
+
}
|
|
32
|
+
addToBlueprints(...t) {
|
|
33
|
+
this.wrappedStage || this.options.push(...t);
|
|
34
|
+
}
|
|
35
|
+
addToStage(...t) {
|
|
36
|
+
this.wrappedStage && this.wrappedStage.enqueue(...t);
|
|
27
37
|
}
|
|
28
38
|
start(t) {
|
|
29
|
-
this.wrappedStage?.nodeSetup(t)
|
|
30
|
-
const a = this.wrappedStage.buildEntityState(e);
|
|
31
|
-
s.entities = [...s.entities, a];
|
|
32
|
-
}, { replayExisting: !0 });
|
|
39
|
+
this.wrappedStage?.nodeSetup(t);
|
|
33
40
|
}
|
|
34
41
|
onUpdate(...t) {
|
|
35
|
-
this.wrappedStage.update = (e) => {
|
|
42
|
+
this.wrappedStage && (this.wrappedStage.update = (e) => {
|
|
36
43
|
const a = { ...e, stage: this };
|
|
37
|
-
t.forEach((
|
|
38
|
-
};
|
|
44
|
+
t.forEach((p) => p(a));
|
|
45
|
+
});
|
|
39
46
|
}
|
|
40
47
|
onSetup(t) {
|
|
41
48
|
this.wrappedStage.setup = t;
|
|
@@ -47,14 +54,14 @@ class S {
|
|
|
47
54
|
n(t, e);
|
|
48
55
|
}
|
|
49
56
|
getVariable(t) {
|
|
50
|
-
return
|
|
57
|
+
return g(t);
|
|
51
58
|
}
|
|
52
59
|
}
|
|
53
|
-
function c(...
|
|
54
|
-
const t =
|
|
55
|
-
return new
|
|
60
|
+
function c(...i) {
|
|
61
|
+
const t = S(i);
|
|
62
|
+
return new h([...t]);
|
|
56
63
|
}
|
|
57
64
|
export {
|
|
58
|
-
|
|
59
|
-
c as
|
|
65
|
+
h as Stage,
|
|
66
|
+
c as createStage
|
|
60
67
|
};
|
package/dist/main.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createGame as m } from "./lib/game/game.js";
|
|
2
2
|
import { gameConfig as a } from "./lib/game/game-config.js";
|
|
3
|
-
import {
|
|
4
|
-
import { entitySpawner as
|
|
3
|
+
import { createStage as f } from "./lib/stage/stage.js";
|
|
4
|
+
import { entitySpawner as n } from "./lib/stage/entity-spawner.js";
|
|
5
5
|
import { vessel as i } from "./lib/core/vessel.js";
|
|
6
|
-
import { camera as
|
|
6
|
+
import { camera as b } from "./lib/camera/camera.js";
|
|
7
7
|
import { Perspectives as h } from "./lib/camera/perspective.js";
|
|
8
8
|
import { ZylemBox as v, box as d } from "./lib/entities/box.js";
|
|
9
9
|
import { sphere as R } from "./lib/entities/sphere.js";
|
|
@@ -11,9 +11,9 @@ import { sprite as E } from "./lib/entities/sprite.js";
|
|
|
11
11
|
import { plane as w } from "./lib/entities/plane.js";
|
|
12
12
|
import { zone as D } from "./lib/entities/zone.js";
|
|
13
13
|
import { actor as I } from "./lib/entities/actor.js";
|
|
14
|
-
import { text as
|
|
15
|
-
import { rect as
|
|
16
|
-
import { makeMoveable as
|
|
14
|
+
import { text as S } from "./lib/entities/text.js";
|
|
15
|
+
import { rect as z } from "./lib/entities/rect.js";
|
|
16
|
+
import { makeMoveable as G } from "./lib/actions/capabilities/moveable.js";
|
|
17
17
|
import { makeRotatable as Z } from "./lib/actions/capabilities/rotatable.js";
|
|
18
18
|
import { makeTransformable as q } from "./lib/actions/capabilities/transformable.js";
|
|
19
19
|
import { ricochet2DInBounds as J } from "./lib/actions/behaviors/ricochet/ricochet-2d-in-bounds.js";
|
|
@@ -33,24 +33,24 @@ export {
|
|
|
33
33
|
I as actor,
|
|
34
34
|
O as boundary2d,
|
|
35
35
|
d as box,
|
|
36
|
-
|
|
36
|
+
b as camera,
|
|
37
37
|
m as createGame,
|
|
38
|
+
f as createStage,
|
|
38
39
|
U as destroy,
|
|
39
|
-
|
|
40
|
+
n as entitySpawner,
|
|
40
41
|
a as gameConfig,
|
|
41
42
|
Y as globalChange,
|
|
42
43
|
_ as globalChanges,
|
|
43
|
-
|
|
44
|
+
G as makeMoveable,
|
|
44
45
|
Z as makeRotatable,
|
|
45
46
|
q as makeTransformable,
|
|
46
47
|
w as plane,
|
|
47
|
-
|
|
48
|
+
z as rect,
|
|
48
49
|
L as ricochet2DCollision,
|
|
49
50
|
J as ricochet2DInBounds,
|
|
50
51
|
R as sphere,
|
|
51
52
|
E as sprite,
|
|
52
|
-
|
|
53
|
-
T as text,
|
|
53
|
+
S as text,
|
|
54
54
|
$ as variableChange,
|
|
55
55
|
oo as variableChanges,
|
|
56
56
|
i as vessel,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
function i(e) {
|
|
2
|
+
return new Promise((n, t) => {
|
|
3
|
+
e.oncomplete = e.onsuccess = () => n(e.result), e.onabort = e.onerror = () => t(e.error);
|
|
4
|
+
});
|
|
5
|
+
}
|
|
6
|
+
function f(e, n) {
|
|
7
|
+
let t;
|
|
8
|
+
const o = () => {
|
|
9
|
+
if (t)
|
|
10
|
+
return t;
|
|
11
|
+
const r = indexedDB.open(e);
|
|
12
|
+
return r.onupgradeneeded = () => r.result.createObjectStore(n), t = i(r), t.then((u) => {
|
|
13
|
+
u.onclose = () => t = void 0;
|
|
14
|
+
}, () => {
|
|
15
|
+
}), t;
|
|
16
|
+
};
|
|
17
|
+
return (r, u) => o().then((d) => u(d.transaction(n, r).objectStore(n)));
|
|
18
|
+
}
|
|
19
|
+
let c;
|
|
20
|
+
function a() {
|
|
21
|
+
return c || (c = f("keyval-store", "keyval")), c;
|
|
22
|
+
}
|
|
23
|
+
function l(e, n = a()) {
|
|
24
|
+
return n("readonly", (t) => i(t.get(e)));
|
|
25
|
+
}
|
|
26
|
+
function s(e, n, t = a()) {
|
|
27
|
+
return t("readwrite", (o) => (o.put(n, e), i(o.transaction)));
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
f as createStore,
|
|
31
|
+
l as get,
|
|
32
|
+
i as promisifyRequest,
|
|
33
|
+
s as set
|
|
34
|
+
};
|