@zylem/game-lib 0.5.0 → 0.5.1
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/README.md +23 -41
- package/dist/actions.d.ts +25 -0
- package/dist/actions.js +287 -8
- package/dist/actions.js.map +1 -0
- package/dist/behaviors.d.ts +108 -0
- package/dist/behaviors.js +396 -6
- package/dist/behaviors.js.map +1 -0
- package/dist/{src/lib/camera/zylem-camera.d.ts → camera-Dk-fOVZE.d.ts} +55 -8
- package/dist/camera.d.ts +5 -0
- package/dist/camera.js +504 -4
- package/dist/camera.js.map +1 -0
- package/dist/core-C2mjetAd.d.ts +431 -0
- package/dist/core.d.ts +9 -0
- package/dist/core.js +4780 -9
- package/dist/core.js.map +1 -0
- package/dist/entities.d.ts +269 -0
- package/dist/entities.js +2161 -17
- package/dist/entities.js.map +1 -0
- package/dist/entity-bQElAdpo.d.ts +347 -0
- package/dist/entity-spawner-DNnLYnZq.d.ts +11 -0
- package/dist/main.d.ts +135 -0
- package/dist/main.js +6599 -56
- package/dist/main.js.map +1 -0
- package/dist/moveable-B_vyA6cw.d.ts +67 -0
- package/dist/stage-CrmY7V0i.d.ts +287 -0
- package/dist/stage.d.ts +26 -0
- package/dist/stage.js +2229 -4
- package/dist/stage.js.map +1 -0
- package/dist/transformable-CUhvyuYO.d.ts +67 -0
- package/package.json +9 -45
- package/LICENSE +0 -21
- package/dist/.vite/manifest.json +0 -716
- package/dist/assets/zylem-logo.png +0 -0
- package/dist/examples/00-readme-example.d.ts +0 -2
- package/dist/examples/00-readme-example.d.ts.map +0 -1
- package/dist/examples/01-basic.d.ts +0 -2
- package/dist/examples/01-basic.d.ts.map +0 -1
- package/dist/examples/01.1-basic-ball.d.ts +0 -9
- package/dist/examples/01.1-basic-ball.d.ts.map +0 -1
- package/dist/examples/01.2-ricochet-test.d.ts +0 -2
- package/dist/examples/01.2-ricochet-test.d.ts.map +0 -1
- package/dist/examples/01.3-rect.d.ts +0 -2
- package/dist/examples/01.3-rect.d.ts.map +0 -1
- package/dist/examples/02-input.d.ts +0 -2
- package/dist/examples/02-input.d.ts.map +0 -1
- package/dist/examples/03-stage-test/03-stage-test.d.ts +0 -2
- package/dist/examples/03-stage-test/03-stage-test.d.ts.map +0 -1
- package/dist/examples/03-stage-test/stage0.d.ts +0 -2
- package/dist/examples/03-stage-test/stage0.d.ts.map +0 -1
- package/dist/examples/03-stage-test/stage1.d.ts +0 -2
- package/dist/examples/03-stage-test/stage1.d.ts.map +0 -1
- package/dist/examples/03-stage-test/stage2.d.ts +0 -2
- package/dist/examples/03-stage-test/stage2.d.ts.map +0 -1
- package/dist/examples/03-stage-test/stage3.d.ts +0 -2
- package/dist/examples/03-stage-test/stage3.d.ts.map +0 -1
- package/dist/examples/03.1-stage-variable.d.ts +0 -2
- package/dist/examples/03.1-stage-variable.d.ts.map +0 -1
- package/dist/examples/04-vessel-test.d.ts +0 -18
- package/dist/examples/04-vessel-test.d.ts.map +0 -1
- package/dist/examples/05-camera-test.d.ts +0 -2
- package/dist/examples/05-camera-test.d.ts.map +0 -1
- package/dist/examples/06-entity-test.d.ts +0 -2
- package/dist/examples/06-entity-test.d.ts.map +0 -1
- package/dist/examples/07-behaviors.d.ts +0 -2
- package/dist/examples/07-behaviors.d.ts.map +0 -1
- package/dist/examples/07.01-behavior-context.d.ts +0 -2
- package/dist/examples/07.01-behavior-context.d.ts.map +0 -1
- package/dist/examples/08-pong.d.ts +0 -2
- package/dist/examples/08-pong.d.ts.map +0 -1
- package/dist/examples/08.01-breakout.d.ts +0 -2
- package/dist/examples/08.01-breakout.d.ts.map +0 -1
- package/dist/examples/09-space-invaders.d.ts +0 -2
- package/dist/examples/09-space-invaders.d.ts.map +0 -1
- package/dist/examples/10-asteroids.d.ts +0 -2
- package/dist/examples/10-asteroids.d.ts.map +0 -1
- package/dist/examples/11-2d-platformer.d.ts +0 -2
- package/dist/examples/11-2d-platformer.d.ts.map +0 -1
- package/dist/examples/12-3d-platformer.d.ts +0 -2
- package/dist/examples/12-3d-platformer.d.ts.map +0 -1
- package/dist/examples/13-fps.d.ts +0 -2
- package/dist/examples/13-fps.d.ts.map +0 -1
- package/dist/examples/14-strategy.d.ts +0 -2
- package/dist/examples/14-strategy.d.ts.map +0 -1
- package/dist/examples/15-zylem-planet-demo.d.ts +0 -2
- package/dist/examples/15-zylem-planet-demo.d.ts.map +0 -1
- package/dist/examples/16-timbotron.d.ts +0 -2
- package/dist/examples/16-timbotron.d.ts.map +0 -1
- package/dist/examples/17-stress-test.d.ts +0 -2
- package/dist/examples/17-stress-test.d.ts.map +0 -1
- package/dist/examples/architecture-test.d.ts +0 -2
- package/dist/examples/architecture-test.d.ts.map +0 -1
- package/dist/examples/utils.d.ts +0 -10
- package/dist/examples/utils.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/actions.js +0 -35
- package/dist/lib/actions/behaviors/boundaries/boundary.js +0 -40
- package/dist/lib/actions/behaviors/ricochet/ricochet-2d-collision.js +0 -100
- package/dist/lib/actions/behaviors/ricochet/ricochet-2d-in-bounds.js +0 -37
- package/dist/lib/actions/behaviors/ricochet/ricochet.js +0 -6
- package/dist/lib/actions/capabilities/moveable.js +0 -108
- package/dist/lib/actions/capabilities/rotatable.js +0 -82
- package/dist/lib/actions/capabilities/transformable.js +0 -9
- package/dist/lib/actions/global-change.js +0 -40
- package/dist/lib/camera/camera.js +0 -19
- package/dist/lib/camera/fixed-2d.js +0 -30
- package/dist/lib/camera/perspective.js +0 -10
- package/dist/lib/camera/third-person.js +0 -42
- package/dist/lib/camera/zylem-camera.js +0 -208
- package/dist/lib/collision/collision-builder.js +0 -46
- package/dist/lib/collision/collision-delegate.js +0 -6
- package/dist/lib/collision/utils.js +0 -24
- package/dist/lib/collision/world.js +0 -77
- package/dist/lib/core/base-node.js +0 -61
- package/dist/lib/core/entity-asset-loader.js +0 -54
- package/dist/lib/core/lifecycle-base.js +0 -20
- package/dist/lib/core/preset-shader.js +0 -26
- package/dist/lib/core/three-addons/Timer.js +0 -103
- package/dist/lib/core/utility/nodes.js +0 -31
- package/dist/lib/core/utility/strings.js +0 -14
- package/dist/lib/core/utility/vector.js +0 -8
- package/dist/lib/core/vessel.js +0 -26
- package/dist/lib/debug/console/console-state.js +0 -11
- package/dist/lib/debug/debug-state.js +0 -40
- package/dist/lib/device/aspect-ratio.js +0 -44
- package/dist/lib/entities/actor.js +0 -122
- package/dist/lib/entities/box.js +0 -68
- package/dist/lib/entities/builder.js +0 -79
- package/dist/lib/entities/create.js +0 -31
- package/dist/lib/entities/delegates/animation.js +0 -58
- package/dist/lib/entities/delegates/debug.js +0 -71
- package/dist/lib/entities/delegates/loader.js +0 -19
- package/dist/lib/entities/destroy.js +0 -15
- package/dist/lib/entities/entity-factory.js +0 -24
- package/dist/lib/entities/entity.js +0 -121
- package/dist/lib/entities/plane.js +0 -81
- package/dist/lib/entities/rect.js +0 -160
- package/dist/lib/entities/sphere.js +0 -68
- package/dist/lib/entities/sprite.js +0 -125
- package/dist/lib/entities/text.js +0 -140
- package/dist/lib/entities/zone.js +0 -103
- package/dist/lib/game/game-canvas.js +0 -57
- package/dist/lib/game/game-config.js +0 -78
- package/dist/lib/game/game-default.js +0 -23
- package/dist/lib/game/game-retro-resolutions.js +0 -80
- package/dist/lib/game/game-state.js +0 -17
- package/dist/lib/game/game.js +0 -131
- package/dist/lib/game/zylem-game.js +0 -140
- package/dist/lib/graphics/geometries/XZPlaneGeometry.js +0 -34
- package/dist/lib/graphics/material.js +0 -64
- package/dist/lib/graphics/mesh.js +0 -14
- package/dist/lib/graphics/render-pass.js +0 -56
- package/dist/lib/graphics/shaders/fragment/debug.glsl.js +0 -23
- package/dist/lib/graphics/shaders/fragment/fire.glsl.js +0 -52
- package/dist/lib/graphics/shaders/fragment/standard.glsl.js +0 -11
- package/dist/lib/graphics/shaders/fragment/stars.glsl.js +0 -44
- package/dist/lib/graphics/shaders/vertex/debug.glsl.js +0 -15
- package/dist/lib/graphics/shaders/vertex/object-shader.glsl.js +0 -11
- package/dist/lib/graphics/shaders/vertex/standard.glsl.js +0 -9
- package/dist/lib/graphics/zylem-scene.js +0 -75
- package/dist/lib/input/gamepad-provider.js +0 -58
- package/dist/lib/input/input-manager.js +0 -70
- package/dist/lib/input/keyboard-provider.js +0 -120
- package/dist/lib/stage/debug-entity-cursor.js +0 -53
- package/dist/lib/stage/entity-spawner.js +0 -27
- package/dist/lib/stage/stage-debug-delegate.js +0 -100
- package/dist/lib/stage/stage-default.js +0 -32
- package/dist/lib/stage/stage-factory.js +0 -22
- package/dist/lib/stage/stage-manager.js +0 -49
- package/dist/lib/stage/stage-state.js +0 -36
- package/dist/lib/stage/stage.js +0 -67
- package/dist/lib/stage/zylem-stage.js +0 -268
- package/dist/lib/systems/transformable.system.js +0 -43
- package/dist/node_modules/.pnpm/idb-keyval@6.2.2/node_modules/idb-keyval/dist/index.js +0 -34
- package/dist/node_modules/.pnpm/msgpackr@1.11.5/node_modules/msgpackr/pack.js +0 -520
- package/dist/node_modules/.pnpm/msgpackr@1.11.5/node_modules/msgpackr/unpack.js +0 -672
- package/dist/src/api/actions.d.ts +0 -5
- package/dist/src/api/actions.d.ts.map +0 -1
- package/dist/src/api/behaviors.d.ts +0 -4
- package/dist/src/api/behaviors.d.ts.map +0 -1
- package/dist/src/api/camera.d.ts +0 -4
- package/dist/src/api/camera.d.ts.map +0 -1
- package/dist/src/api/core.d.ts +0 -6
- package/dist/src/api/core.d.ts.map +0 -1
- package/dist/src/api/entities.d.ts +0 -9
- package/dist/src/api/entities.d.ts.map +0 -1
- package/dist/src/api/main.d.ts +0 -32
- package/dist/src/api/main.d.ts.map +0 -1
- package/dist/src/api/stage.d.ts +0 -5
- package/dist/src/api/stage.d.ts.map +0 -1
- package/dist/src/lib/actions/behaviors/actions.d.ts +0 -11
- package/dist/src/lib/actions/behaviors/actions.d.ts.map +0 -1
- package/dist/src/lib/actions/behaviors/behavior.d.ts +0 -6
- package/dist/src/lib/actions/behaviors/behavior.d.ts.map +0 -1
- package/dist/src/lib/actions/behaviors/boundaries/boundary.d.ts +0 -37
- package/dist/src/lib/actions/behaviors/boundaries/boundary.d.ts.map +0 -1
- package/dist/src/lib/actions/behaviors/character-controller.d.ts +0 -6
- package/dist/src/lib/actions/behaviors/character-controller.d.ts.map +0 -1
- package/dist/src/lib/actions/behaviors/debug/debug-collision.d.ts +0 -6
- package/dist/src/lib/actions/behaviors/debug/debug-collision.d.ts.map +0 -1
- package/dist/src/lib/actions/behaviors/debug/debug-update.d.ts +0 -5
- package/dist/src/lib/actions/behaviors/debug/debug-update.d.ts.map +0 -1
- package/dist/src/lib/actions/behaviors/debug/debug.d.ts +0 -10
- package/dist/src/lib/actions/behaviors/debug/debug.d.ts.map +0 -1
- package/dist/src/lib/actions/behaviors/movement/movement-sequence-2d.d.ts +0 -24
- package/dist/src/lib/actions/behaviors/movement/movement-sequence-2d.d.ts.map +0 -1
- package/dist/src/lib/actions/behaviors/ricochet/ricochet-2d-collision.d.ts +0 -11
- package/dist/src/lib/actions/behaviors/ricochet/ricochet-2d-collision.d.ts.map +0 -1
- package/dist/src/lib/actions/behaviors/ricochet/ricochet-2d-in-bounds.d.ts +0 -12
- package/dist/src/lib/actions/behaviors/ricochet/ricochet-2d-in-bounds.d.ts.map +0 -1
- package/dist/src/lib/actions/behaviors/ricochet/ricochet.d.ts +0 -44
- package/dist/src/lib/actions/behaviors/ricochet/ricochet.d.ts.map +0 -1
- package/dist/src/lib/actions/behaviors/zylem-behavior.d.ts +0 -2
- package/dist/src/lib/actions/behaviors/zylem-behavior.d.ts.map +0 -1
- package/dist/src/lib/actions/capabilities/moveable.d.ts +0 -125
- package/dist/src/lib/actions/capabilities/moveable.d.ts.map +0 -1
- package/dist/src/lib/actions/capabilities/rotatable.d.ts +0 -111
- package/dist/src/lib/actions/capabilities/rotatable.d.ts.map +0 -1
- package/dist/src/lib/actions/capabilities/transformable.d.ts +0 -7
- package/dist/src/lib/actions/capabilities/transformable.d.ts.map +0 -1
- package/dist/src/lib/actions/global-change.d.ts +0 -23
- package/dist/src/lib/actions/global-change.d.ts.map +0 -1
- package/dist/src/lib/camera/camera.d.ts +0 -16
- package/dist/src/lib/camera/camera.d.ts.map +0 -1
- package/dist/src/lib/camera/fixed-2d.d.ts +0 -32
- package/dist/src/lib/camera/fixed-2d.d.ts.map +0 -1
- package/dist/src/lib/camera/perspective.d.ts +0 -9
- package/dist/src/lib/camera/perspective.d.ts.map +0 -1
- package/dist/src/lib/camera/third-person.d.ts +0 -32
- package/dist/src/lib/camera/third-person.d.ts.map +0 -1
- package/dist/src/lib/camera/zylem-camera.d.ts.map +0 -1
- package/dist/src/lib/collision/collision-builder.d.ts +0 -17
- package/dist/src/lib/collision/collision-builder.d.ts.map +0 -1
- package/dist/src/lib/collision/collision-delegate.d.ts +0 -6
- package/dist/src/lib/collision/collision-delegate.d.ts.map +0 -1
- package/dist/src/lib/collision/collision-group.d.ts +0 -11
- package/dist/src/lib/collision/collision-group.d.ts.map +0 -1
- package/dist/src/lib/collision/collision-mask.d.ts +0 -18
- package/dist/src/lib/collision/collision-mask.d.ts.map +0 -1
- package/dist/src/lib/collision/collision.d.ts +0 -19
- package/dist/src/lib/collision/collision.d.ts.map +0 -1
- package/dist/src/lib/collision/utils.d.ts +0 -15
- package/dist/src/lib/collision/utils.d.ts.map +0 -1
- package/dist/src/lib/collision/world.d.ts +0 -23
- package/dist/src/lib/collision/world.d.ts.map +0 -1
- package/dist/src/lib/core/asset-manager.d.ts +0 -2
- package/dist/src/lib/core/asset-manager.d.ts.map +0 -1
- package/dist/src/lib/core/base-node-life-cycle.d.ts +0 -54
- package/dist/src/lib/core/base-node-life-cycle.d.ts.map +0 -1
- package/dist/src/lib/core/base-node.d.ts +0 -36
- package/dist/src/lib/core/base-node.d.ts.map +0 -1
- package/dist/src/lib/core/blueprints.d.ts +0 -22
- package/dist/src/lib/core/blueprints.d.ts.map +0 -1
- package/dist/src/lib/core/entity-asset-loader.d.ts +0 -16
- package/dist/src/lib/core/entity-asset-loader.d.ts.map +0 -1
- package/dist/src/lib/core/errors.d.ts +0 -5
- package/dist/src/lib/core/errors.d.ts.map +0 -1
- package/dist/src/lib/core/flags.d.ts +0 -3
- package/dist/src/lib/core/flags.d.ts.map +0 -1
- package/dist/src/lib/core/index.d.ts +0 -5
- package/dist/src/lib/core/index.d.ts.map +0 -1
- package/dist/src/lib/core/interfaces.d.ts +0 -25
- package/dist/src/lib/core/interfaces.d.ts.map +0 -1
- package/dist/src/lib/core/lazy-loader.d.ts +0 -80
- package/dist/src/lib/core/lazy-loader.d.ts.map +0 -1
- package/dist/src/lib/core/lifecycle-base.d.ts +0 -17
- package/dist/src/lib/core/lifecycle-base.d.ts.map +0 -1
- package/dist/src/lib/core/node-interface.d.ts +0 -12
- package/dist/src/lib/core/node-interface.d.ts.map +0 -1
- package/dist/src/lib/core/preset-shader.d.ts +0 -8
- package/dist/src/lib/core/preset-shader.d.ts.map +0 -1
- package/dist/src/lib/core/three-addons/Timer.d.ts +0 -92
- package/dist/src/lib/core/three-addons/Timer.d.ts.map +0 -1
- package/dist/src/lib/core/utility/nodes.d.ts +0 -13
- package/dist/src/lib/core/utility/nodes.d.ts.map +0 -1
- package/dist/src/lib/core/utility/strings.d.ts +0 -3
- package/dist/src/lib/core/utility/strings.d.ts.map +0 -1
- package/dist/src/lib/core/utility/vector.d.ts +0 -8
- package/dist/src/lib/core/utility/vector.d.ts.map +0 -1
- package/dist/src/lib/core/vector.d.ts +0 -4
- package/dist/src/lib/core/vector.d.ts.map +0 -1
- package/dist/src/lib/core/vessel.d.ts +0 -13
- package/dist/src/lib/core/vessel.d.ts.map +0 -1
- package/dist/src/lib/debug/console/console-state.d.ts +0 -20
- package/dist/src/lib/debug/console/console-state.d.ts.map +0 -1
- package/dist/src/lib/debug/console/console-store.d.ts +0 -6
- package/dist/src/lib/debug/console/console-store.d.ts.map +0 -1
- package/dist/src/lib/debug/debug-state.d.ts +0 -38
- package/dist/src/lib/debug/debug-state.d.ts.map +0 -1
- package/dist/src/lib/debug/debug-store.d.ts +0 -15
- package/dist/src/lib/debug/debug-store.d.ts.map +0 -1
- package/dist/src/lib/debug/state-based-debug-loader.d.ts +0 -8
- package/dist/src/lib/debug/state-based-debug-loader.d.ts.map +0 -1
- package/dist/src/lib/device/aspect-ratio.d.ts +0 -38
- package/dist/src/lib/device/aspect-ratio.d.ts.map +0 -1
- package/dist/src/lib/device/desktop.d.ts +0 -2
- package/dist/src/lib/device/desktop.d.ts.map +0 -1
- package/dist/src/lib/device/mobile.d.ts +0 -2
- package/dist/src/lib/device/mobile.d.ts.map +0 -1
- package/dist/src/lib/device/tablet.d.ts +0 -2
- package/dist/src/lib/device/tablet.d.ts.map +0 -1
- package/dist/src/lib/entities/actor.d.ts +0 -44
- package/dist/src/lib/entities/actor.d.ts.map +0 -1
- package/dist/src/lib/entities/box.d.ts +0 -27
- package/dist/src/lib/entities/box.d.ts.map +0 -1
- package/dist/src/lib/entities/builder.d.ts +0 -28
- package/dist/src/lib/entities/builder.d.ts.map +0 -1
- package/dist/src/lib/entities/create.d.ts +0 -15
- package/dist/src/lib/entities/create.d.ts.map +0 -1
- package/dist/src/lib/entities/delegates/animation.d.ts +0 -33
- package/dist/src/lib/entities/delegates/animation.d.ts.map +0 -1
- package/dist/src/lib/entities/delegates/debug.d.ts +0 -29
- package/dist/src/lib/entities/delegates/debug.d.ts.map +0 -1
- package/dist/src/lib/entities/delegates/loader.d.ts +0 -12
- package/dist/src/lib/entities/delegates/loader.d.ts.map +0 -1
- package/dist/src/lib/entities/destroy.d.ts +0 -4
- package/dist/src/lib/entities/destroy.d.ts.map +0 -1
- package/dist/src/lib/entities/entity-factory.d.ts +0 -10
- package/dist/src/lib/entities/entity-factory.d.ts.map +0 -1
- package/dist/src/lib/entities/entity.d.ts +0 -98
- package/dist/src/lib/entities/entity.d.ts.map +0 -1
- package/dist/src/lib/entities/index.d.ts +0 -12
- package/dist/src/lib/entities/index.d.ts.map +0 -1
- package/dist/src/lib/entities/plane.d.ts +0 -36
- package/dist/src/lib/entities/plane.d.ts.map +0 -1
- package/dist/src/lib/entities/rect.d.ts +0 -63
- package/dist/src/lib/entities/rect.d.ts.map +0 -1
- package/dist/src/lib/entities/sphere.d.ts +0 -29
- package/dist/src/lib/entities/sphere.d.ts.map +0 -1
- package/dist/src/lib/entities/sprite.d.ts +0 -54
- package/dist/src/lib/entities/sprite.d.ts.map +0 -1
- package/dist/src/lib/entities/text.d.ts +0 -49
- package/dist/src/lib/entities/text.d.ts.map +0 -1
- package/dist/src/lib/entities/zone.d.ts +0 -54
- package/dist/src/lib/entities/zone.d.ts.map +0 -1
- package/dist/src/lib/game/game-blueprint.d.ts +0 -38
- package/dist/src/lib/game/game-blueprint.d.ts.map +0 -1
- package/dist/src/lib/game/game-canvas.d.ts +0 -35
- package/dist/src/lib/game/game-canvas.d.ts.map +0 -1
- package/dist/src/lib/game/game-config.d.ts +0 -59
- package/dist/src/lib/game/game-config.d.ts.map +0 -1
- package/dist/src/lib/game/game-default.d.ts +0 -14
- package/dist/src/lib/game/game-default.d.ts.map +0 -1
- package/dist/src/lib/game/game-interfaces.d.ts +0 -29
- package/dist/src/lib/game/game-interfaces.d.ts.map +0 -1
- package/dist/src/lib/game/game-retro-resolutions.d.ts +0 -25
- package/dist/src/lib/game/game-retro-resolutions.d.ts.map +0 -1
- package/dist/src/lib/game/game-state.d.ts +0 -11
- package/dist/src/lib/game/game-state.d.ts.map +0 -1
- package/dist/src/lib/game/game.d.ts +0 -39
- package/dist/src/lib/game/game.d.ts.map +0 -1
- package/dist/src/lib/game/zylem-game.d.ts +0 -58
- package/dist/src/lib/game/zylem-game.d.ts.map +0 -1
- package/dist/src/lib/graphics/geometries/XZPlaneGeometry.d.ts +0 -8
- package/dist/src/lib/graphics/geometries/XZPlaneGeometry.d.ts.map +0 -1
- package/dist/src/lib/graphics/material.d.ts +0 -29
- package/dist/src/lib/graphics/material.d.ts.map +0 -1
- package/dist/src/lib/graphics/mesh.d.ts +0 -19
- package/dist/src/lib/graphics/mesh.d.ts.map +0 -1
- package/dist/src/lib/graphics/render-pass.d.ts +0 -17
- package/dist/src/lib/graphics/render-pass.d.ts.map +0 -1
- package/dist/src/lib/graphics/zylem-scene.d.ts +0 -50
- package/dist/src/lib/graphics/zylem-scene.d.ts.map +0 -1
- package/dist/src/lib/input/gamepad-provider.d.ts +0 -14
- package/dist/src/lib/input/gamepad-provider.d.ts.map +0 -1
- package/dist/src/lib/input/input-manager.d.ts +0 -15
- package/dist/src/lib/input/input-manager.d.ts.map +0 -1
- package/dist/src/lib/input/input-provider.d.ts +0 -7
- package/dist/src/lib/input/input-provider.d.ts.map +0 -1
- package/dist/src/lib/input/input.d.ts +0 -48
- package/dist/src/lib/input/input.d.ts.map +0 -1
- package/dist/src/lib/input/keyboard-provider.d.ts +0 -21
- package/dist/src/lib/input/keyboard-provider.d.ts.map +0 -1
- package/dist/src/lib/interfaces/entity.d.ts +0 -26
- package/dist/src/lib/interfaces/entity.d.ts.map +0 -1
- package/dist/src/lib/sounds/index.d.ts +0 -3
- package/dist/src/lib/sounds/index.d.ts.map +0 -1
- package/dist/src/lib/sounds/ping-pong-sound.d.ts +0 -5
- package/dist/src/lib/sounds/ping-pong-sound.d.ts.map +0 -1
- package/dist/src/lib/sounds/ricochet-sound.d.ts +0 -5
- package/dist/src/lib/sounds/ricochet-sound.d.ts.map +0 -1
- package/dist/src/lib/stage/debug-entity-cursor.d.ts +0 -24
- package/dist/src/lib/stage/debug-entity-cursor.d.ts.map +0 -1
- package/dist/src/lib/stage/entity-spawner.d.ts +0 -9
- package/dist/src/lib/stage/entity-spawner.d.ts.map +0 -1
- package/dist/src/lib/stage/stage-camera-debug-delegate.d.ts +0 -14
- package/dist/src/lib/stage/stage-camera-debug-delegate.d.ts.map +0 -1
- package/dist/src/lib/stage/stage-debug-delegate.d.ts +0 -26
- package/dist/src/lib/stage/stage-debug-delegate.d.ts.map +0 -1
- package/dist/src/lib/stage/stage-default.d.ts +0 -3
- package/dist/src/lib/stage/stage-default.d.ts.map +0 -1
- package/dist/src/lib/stage/stage-factory.d.ts +0 -6
- package/dist/src/lib/stage/stage-factory.d.ts.map +0 -1
- package/dist/src/lib/stage/stage-manager.d.ts +0 -30
- package/dist/src/lib/stage/stage-manager.d.ts.map +0 -1
- package/dist/src/lib/stage/stage-state.d.ts +0 -14
- package/dist/src/lib/stage/stage-state.d.ts.map +0 -1
- package/dist/src/lib/stage/stage.d.ts +0 -35
- package/dist/src/lib/stage/stage.d.ts.map +0 -1
- package/dist/src/lib/stage/zylem-stage.d.ts +0 -128
- package/dist/src/lib/stage/zylem-stage.d.ts.map +0 -1
- package/dist/src/lib/systems/test-system.d.ts +0 -2
- package/dist/src/lib/systems/test-system.d.ts.map +0 -1
- package/dist/src/lib/systems/transformable.system.d.ts +0 -25
- package/dist/src/lib/systems/transformable.system.d.ts.map +0 -1
- package/dist/src/lib/types/entity-types.d.ts +0 -24
- package/dist/src/lib/types/entity-types.d.ts.map +0 -1
- package/dist/src/lib/types/index.d.ts +0 -3
- package/dist/src/lib/types/index.d.ts.map +0 -1
- package/dist/src/lib/types/stage-types.d.ts +0 -26
- package/dist/src/lib/types/stage-types.d.ts.map +0 -1
- package/dist/src/lib/ui/Debug.d.ts +0 -6
- package/dist/src/lib/ui/Debug.d.ts.map +0 -1
- package/dist/src/lib/ui/console/Console.d.ts +0 -7
- package/dist/src/lib/ui/console/Console.d.ts.map +0 -1
- package/dist/src/lib/ui/debug-panel/AccordionMenu.d.ts +0 -7
- package/dist/src/lib/ui/debug-panel/AccordionMenu.d.ts.map +0 -1
- package/dist/src/lib/ui/debug-panel/Menu.d.ts +0 -6
- package/dist/src/lib/ui/debug-panel/Menu.d.ts.map +0 -1
- package/dist/src/lib/ui/debug-panel/sections/EntitiesSection.d.ts +0 -4
- package/dist/src/lib/ui/debug-panel/sections/EntitiesSection.d.ts.map +0 -1
- package/dist/src/lib/ui/debug-panel/sections/GameSection.d.ts +0 -3
- package/dist/src/lib/ui/debug-panel/sections/GameSection.d.ts.map +0 -1
- package/dist/src/lib/ui/debug-panel/sections/StagesSection.d.ts +0 -3
- package/dist/src/lib/ui/debug-panel/sections/StagesSection.d.ts.map +0 -1
- package/dist/src/lib/ui/debug-panel/sections/all.d.ts +0 -4
- package/dist/src/lib/ui/debug-panel/sections/all.d.ts.map +0 -1
- package/dist/src/lib/ui/toolbar/Toolbar.d.ts +0 -6
- package/dist/src/lib/ui/toolbar/Toolbar.d.ts.map +0 -1
- package/dist/tests/e2e/basic-game.spec.d.ts +0 -2
- package/dist/tests/e2e/basic-game.spec.d.ts.map +0 -1
- package/dist/tests/integration/debug.sim.spec.d.ts +0 -2
- package/dist/tests/integration/debug.sim.spec.d.ts.map +0 -1
- package/dist/tests/unit/collision/collision.spec.d.ts +0 -2
- package/dist/tests/unit/collision/collision.spec.d.ts.map +0 -1
- package/dist/tests/unit/core/base-node.spec.d.ts +0 -2
- package/dist/tests/unit/core/base-node.spec.d.ts.map +0 -1
- package/dist/tests/unit/core/game.spec.d.ts +0 -2
- package/dist/tests/unit/core/game.spec.d.ts.map +0 -1
- package/dist/tests/unit/core/stage.spec.d.ts +0 -2
- package/dist/tests/unit/core/stage.spec.d.ts.map +0 -1
- package/dist/tests/unit/core/vessel.spec.d.ts +0 -2
- package/dist/tests/unit/core/vessel.spec.d.ts.map +0 -1
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
class h {
|
|
2
|
-
gamepadIndex;
|
|
3
|
-
connected = !1;
|
|
4
|
-
buttonStates = {};
|
|
5
|
-
constructor(t) {
|
|
6
|
-
this.gamepadIndex = t, window.addEventListener("gamepadconnected", (e) => {
|
|
7
|
-
e.gamepad.index === this.gamepadIndex && (this.connected = !0);
|
|
8
|
-
}), window.addEventListener("gamepaddisconnected", (e) => {
|
|
9
|
-
e.gamepad.index === this.gamepadIndex && (this.connected = !1);
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
handleButtonState(t, e, a) {
|
|
13
|
-
const s = e.buttons[t].pressed;
|
|
14
|
-
let n = this.buttonStates[t];
|
|
15
|
-
return n || (n = { pressed: !1, released: !1, held: 0 }, this.buttonStates[t] = n), s ? (n.held === 0 ? n.pressed = !0 : n.pressed = !1, n.held += a, n.released = !1) : (n.held > 0 ? (n.released = !0, n.held = 0) : n.released = !1, n.pressed = !1), n;
|
|
16
|
-
}
|
|
17
|
-
handleAnalogState(t, e, a) {
|
|
18
|
-
return { value: e.axes[t], held: a };
|
|
19
|
-
}
|
|
20
|
-
getInput(t) {
|
|
21
|
-
const e = navigator.getGamepads()[this.gamepadIndex];
|
|
22
|
-
return e ? {
|
|
23
|
-
buttons: {
|
|
24
|
-
A: this.handleButtonState(0, e, t),
|
|
25
|
-
B: this.handleButtonState(1, e, t),
|
|
26
|
-
X: this.handleButtonState(2, e, t),
|
|
27
|
-
Y: this.handleButtonState(3, e, t),
|
|
28
|
-
Start: this.handleButtonState(9, e, t),
|
|
29
|
-
Select: this.handleButtonState(8, e, t),
|
|
30
|
-
L: this.handleButtonState(4, e, t),
|
|
31
|
-
R: this.handleButtonState(5, e, t)
|
|
32
|
-
},
|
|
33
|
-
directions: {
|
|
34
|
-
Up: this.handleButtonState(12, e, t),
|
|
35
|
-
Down: this.handleButtonState(13, e, t),
|
|
36
|
-
Left: this.handleButtonState(14, e, t),
|
|
37
|
-
Right: this.handleButtonState(15, e, t)
|
|
38
|
-
},
|
|
39
|
-
axes: {
|
|
40
|
-
Horizontal: this.handleAnalogState(0, e, t),
|
|
41
|
-
Vertical: this.handleAnalogState(1, e, t)
|
|
42
|
-
},
|
|
43
|
-
shoulders: {
|
|
44
|
-
LTrigger: this.handleButtonState(6, e, t),
|
|
45
|
-
RTrigger: this.handleButtonState(7, e, t)
|
|
46
|
-
}
|
|
47
|
-
} : {};
|
|
48
|
-
}
|
|
49
|
-
getName() {
|
|
50
|
-
return `gamepad-${this.gamepadIndex + 1}`;
|
|
51
|
-
}
|
|
52
|
-
isConnected() {
|
|
53
|
-
return this.connected;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
export {
|
|
57
|
-
h as GamepadProvider
|
|
58
|
-
};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { KeyboardProvider as s } from "./keyboard-provider.js";
|
|
2
|
-
import { GamepadProvider as r } from "./gamepad-provider.js";
|
|
3
|
-
class B {
|
|
4
|
-
inputMap = /* @__PURE__ */ new Map();
|
|
5
|
-
currentInputs = {};
|
|
6
|
-
previousInputs = {};
|
|
7
|
-
constructor(t) {
|
|
8
|
-
t?.p1?.key ? this.addInputProvider(1, new s(t.p1.key, { includeDefaultBase: !1 })) : this.addInputProvider(1, new s()), this.addInputProvider(1, new r(0)), t?.p2?.key && this.addInputProvider(2, new s(t.p2.key, { includeDefaultBase: !1 })), this.addInputProvider(2, new r(1)), t?.p3?.key && this.addInputProvider(3, new s(t.p3.key, { includeDefaultBase: !1 })), this.addInputProvider(3, new r(2)), t?.p4?.key && this.addInputProvider(4, new s(t.p4.key, { includeDefaultBase: !1 })), this.addInputProvider(4, new r(3)), t?.p5?.key && this.addInputProvider(5, new s(t.p5.key, { includeDefaultBase: !1 })), this.addInputProvider(5, new r(4)), t?.p6?.key && this.addInputProvider(6, new s(t.p6.key, { includeDefaultBase: !1 })), this.addInputProvider(6, new r(5)), t?.p7?.key && this.addInputProvider(7, new s(t.p7.key, { includeDefaultBase: !1 })), this.addInputProvider(7, new r(6)), t?.p8?.key && this.addInputProvider(8, new s(t.p8.key, { includeDefaultBase: !1 })), this.addInputProvider(8, new r(7));
|
|
9
|
-
}
|
|
10
|
-
addInputProvider(t, e) {
|
|
11
|
-
this.inputMap.has(t) || this.inputMap.set(t, []), this.inputMap.get(t)?.push(e);
|
|
12
|
-
}
|
|
13
|
-
getInputs(t) {
|
|
14
|
-
const e = {};
|
|
15
|
-
return this.inputMap.forEach((i, n) => {
|
|
16
|
-
const u = `p${n}`, d = i.reduce((a, o) => {
|
|
17
|
-
const p = o.getInput(t);
|
|
18
|
-
return this.mergeInputs(a, p);
|
|
19
|
-
}, {});
|
|
20
|
-
e[u] = {
|
|
21
|
-
playerNumber: n,
|
|
22
|
-
...d
|
|
23
|
-
};
|
|
24
|
-
}), e;
|
|
25
|
-
}
|
|
26
|
-
mergeButtonState(t, e) {
|
|
27
|
-
return {
|
|
28
|
-
pressed: t?.pressed || e?.pressed || !1,
|
|
29
|
-
released: t?.released || e?.released || !1,
|
|
30
|
-
held: (t?.held || 0) + (e?.held || 0)
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
mergeAnalogState(t, e) {
|
|
34
|
-
return {
|
|
35
|
-
value: (t?.value || 0) + (e?.value || 0),
|
|
36
|
-
held: (t?.held || 0) + (e?.held || 0)
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
mergeInputs(t, e) {
|
|
40
|
-
return {
|
|
41
|
-
buttons: {
|
|
42
|
-
A: this.mergeButtonState(t.buttons?.A, e.buttons?.A),
|
|
43
|
-
B: this.mergeButtonState(t.buttons?.B, e.buttons?.B),
|
|
44
|
-
X: this.mergeButtonState(t.buttons?.X, e.buttons?.X),
|
|
45
|
-
Y: this.mergeButtonState(t.buttons?.Y, e.buttons?.Y),
|
|
46
|
-
Start: this.mergeButtonState(t.buttons?.Start, e.buttons?.Start),
|
|
47
|
-
Select: this.mergeButtonState(t.buttons?.Select, e.buttons?.Select),
|
|
48
|
-
L: this.mergeButtonState(t.buttons?.L, e.buttons?.L),
|
|
49
|
-
R: this.mergeButtonState(t.buttons?.R, e.buttons?.R)
|
|
50
|
-
},
|
|
51
|
-
directions: {
|
|
52
|
-
Up: this.mergeButtonState(t.directions?.Up, e.directions?.Up),
|
|
53
|
-
Down: this.mergeButtonState(t.directions?.Down, e.directions?.Down),
|
|
54
|
-
Left: this.mergeButtonState(t.directions?.Left, e.directions?.Left),
|
|
55
|
-
Right: this.mergeButtonState(t.directions?.Right, e.directions?.Right)
|
|
56
|
-
},
|
|
57
|
-
axes: {
|
|
58
|
-
Horizontal: this.mergeAnalogState(t.axes?.Horizontal, e.axes?.Horizontal),
|
|
59
|
-
Vertical: this.mergeAnalogState(t.axes?.Vertical, e.axes?.Vertical)
|
|
60
|
-
},
|
|
61
|
-
shoulders: {
|
|
62
|
-
LTrigger: this.mergeButtonState(t.shoulders?.LTrigger, e.shoulders?.LTrigger),
|
|
63
|
-
RTrigger: this.mergeButtonState(t.shoulders?.RTrigger, e.shoulders?.RTrigger)
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
export {
|
|
69
|
-
B as InputManager
|
|
70
|
-
};
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
class p {
|
|
2
|
-
keyStates = /* @__PURE__ */ new Map();
|
|
3
|
-
keyButtonStates = /* @__PURE__ */ new Map();
|
|
4
|
-
mapping = null;
|
|
5
|
-
includeDefaultBase = !0;
|
|
6
|
-
constructor(t, s) {
|
|
7
|
-
this.mapping = t ?? null, this.includeDefaultBase = s?.includeDefaultBase ?? !0, window.addEventListener("keydown", ({ key: e }) => this.keyStates.set(e, !0)), window.addEventListener("keyup", ({ key: e }) => this.keyStates.set(e, !1));
|
|
8
|
-
}
|
|
9
|
-
isKeyPressed(t) {
|
|
10
|
-
return this.keyStates.get(t) || !1;
|
|
11
|
-
}
|
|
12
|
-
handleButtonState(t, s) {
|
|
13
|
-
let e = this.keyButtonStates.get(t);
|
|
14
|
-
const o = this.isKeyPressed(t);
|
|
15
|
-
return e || (e = { pressed: !1, released: !1, held: 0 }, this.keyButtonStates.set(t, e)), o ? (e.held === 0 ? e.pressed = !0 : e.pressed = !1, e.held += s, e.released = !1) : (e.held > 0 ? (e.released = !0, e.held = 0) : e.released = !1, e.pressed = !1), e;
|
|
16
|
-
}
|
|
17
|
-
handleAnalogState(t, s, e) {
|
|
18
|
-
return { value: this.getAxisValue(t, s), held: e };
|
|
19
|
-
}
|
|
20
|
-
mergeButtonState(t, s) {
|
|
21
|
-
return {
|
|
22
|
-
pressed: t?.pressed || s?.pressed || !1,
|
|
23
|
-
released: t?.released || s?.released || !1,
|
|
24
|
-
held: (t?.held || 0) + (s?.held || 0)
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
applyCustomMapping(t, s) {
|
|
28
|
-
if (!this.mapping)
|
|
29
|
-
return t;
|
|
30
|
-
for (const [e, o] of Object.entries(this.mapping)) {
|
|
31
|
-
if (!o || o.length === 0)
|
|
32
|
-
continue;
|
|
33
|
-
const a = this.handleButtonState(e, s);
|
|
34
|
-
for (const c of o) {
|
|
35
|
-
const [u, l] = (c || "").split(".");
|
|
36
|
-
if (!u || !l)
|
|
37
|
-
continue;
|
|
38
|
-
const i = u.toLowerCase(), h = l.toLowerCase();
|
|
39
|
-
if (i === "buttons") {
|
|
40
|
-
const n = {
|
|
41
|
-
a: "A",
|
|
42
|
-
b: "B",
|
|
43
|
-
x: "X",
|
|
44
|
-
y: "Y",
|
|
45
|
-
start: "Start",
|
|
46
|
-
select: "Select",
|
|
47
|
-
l: "L",
|
|
48
|
-
r: "R"
|
|
49
|
-
}[h];
|
|
50
|
-
if (!n)
|
|
51
|
-
continue;
|
|
52
|
-
const r = t.buttons || {};
|
|
53
|
-
r[n] = this.mergeButtonState(r[n], a), t.buttons = r;
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
if (i === "directions") {
|
|
57
|
-
const n = {
|
|
58
|
-
up: "Up",
|
|
59
|
-
down: "Down",
|
|
60
|
-
left: "Left",
|
|
61
|
-
right: "Right"
|
|
62
|
-
}[h];
|
|
63
|
-
if (!n)
|
|
64
|
-
continue;
|
|
65
|
-
const r = t.directions || {};
|
|
66
|
-
r[n] = this.mergeButtonState(r[n], a), t.directions = r;
|
|
67
|
-
continue;
|
|
68
|
-
}
|
|
69
|
-
if (i === "shoulders") {
|
|
70
|
-
const n = {
|
|
71
|
-
ltrigger: "LTrigger",
|
|
72
|
-
rtrigger: "RTrigger"
|
|
73
|
-
}[h];
|
|
74
|
-
if (!n)
|
|
75
|
-
continue;
|
|
76
|
-
const r = t.shoulders || {};
|
|
77
|
-
r[n] = this.mergeButtonState(r[n], a), t.shoulders = r;
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return t;
|
|
83
|
-
}
|
|
84
|
-
getInput(t) {
|
|
85
|
-
const s = {};
|
|
86
|
-
return this.includeDefaultBase && (s.buttons = {
|
|
87
|
-
A: this.handleButtonState("z", t),
|
|
88
|
-
B: this.handleButtonState("x", t),
|
|
89
|
-
X: this.handleButtonState("a", t),
|
|
90
|
-
Y: this.handleButtonState("s", t),
|
|
91
|
-
Start: this.handleButtonState(" ", t),
|
|
92
|
-
Select: this.handleButtonState("Enter", t),
|
|
93
|
-
L: this.handleButtonState("q", t),
|
|
94
|
-
R: this.handleButtonState("e", t)
|
|
95
|
-
}, s.directions = {
|
|
96
|
-
Up: this.handleButtonState("ArrowUp", t),
|
|
97
|
-
Down: this.handleButtonState("ArrowDown", t),
|
|
98
|
-
Left: this.handleButtonState("ArrowLeft", t),
|
|
99
|
-
Right: this.handleButtonState("ArrowRight", t)
|
|
100
|
-
}, s.axes = {
|
|
101
|
-
Horizontal: this.handleAnalogState("ArrowLeft", "ArrowRight", t),
|
|
102
|
-
Vertical: this.handleAnalogState("ArrowUp", "ArrowDown", t)
|
|
103
|
-
}, s.shoulders = {
|
|
104
|
-
LTrigger: this.handleButtonState("Q", t),
|
|
105
|
-
RTrigger: this.handleButtonState("E", t)
|
|
106
|
-
}), this.applyCustomMapping(s, t);
|
|
107
|
-
}
|
|
108
|
-
getName() {
|
|
109
|
-
return "keyboard";
|
|
110
|
-
}
|
|
111
|
-
getAxisValue(t, s) {
|
|
112
|
-
return (this.isKeyPressed(s) ? 1 : 0) - (this.isKeyPressed(t) ? 1 : 0);
|
|
113
|
-
}
|
|
114
|
-
isConnected() {
|
|
115
|
-
return !0;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
export {
|
|
119
|
-
p as KeyboardProvider
|
|
120
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { Color as r, Box3 as h, Vector3 as s, BoxGeometry as n, Mesh as a, MeshBasicMaterial as l, EdgesGeometry as o, LineSegments as c, LineBasicMaterial as d, Group as m } from "three";
|
|
2
|
-
class u {
|
|
3
|
-
scene;
|
|
4
|
-
container;
|
|
5
|
-
fillMesh;
|
|
6
|
-
edgeLines;
|
|
7
|
-
currentColor = new r(65280);
|
|
8
|
-
bbox = new h();
|
|
9
|
-
size = new s();
|
|
10
|
-
center = new s();
|
|
11
|
-
constructor(e) {
|
|
12
|
-
this.scene = e;
|
|
13
|
-
const i = new n(1, 1, 1);
|
|
14
|
-
this.fillMesh = new a(i, new l({
|
|
15
|
-
color: this.currentColor,
|
|
16
|
-
transparent: !0,
|
|
17
|
-
opacity: 0.12,
|
|
18
|
-
depthWrite: !1
|
|
19
|
-
}));
|
|
20
|
-
const t = new o(i);
|
|
21
|
-
this.edgeLines = new c(t, new d({ color: this.currentColor, linewidth: 1 })), this.container = new m(), this.container.name = "DebugEntityCursor", this.container.add(this.fillMesh), this.container.add(this.edgeLines), this.container.visible = !1, this.scene.add(this.container);
|
|
22
|
-
}
|
|
23
|
-
setColor(e) {
|
|
24
|
-
this.currentColor.set(e), this.fillMesh.material.color.set(this.currentColor), this.edgeLines.material.color.set(this.currentColor);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Update the cursor to enclose the provided Object3D using a world-space AABB.
|
|
28
|
-
*/
|
|
29
|
-
updateFromObject(e) {
|
|
30
|
-
if (!e) {
|
|
31
|
-
this.hide();
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
if (this.bbox.setFromObject(e), !isFinite(this.bbox.min.x) || !isFinite(this.bbox.max.x)) {
|
|
35
|
-
this.hide();
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
this.bbox.getSize(this.size), this.bbox.getCenter(this.center);
|
|
39
|
-
const i = new n(Math.max(this.size.x, 1e-6), Math.max(this.size.y, 1e-6), Math.max(this.size.z, 1e-6));
|
|
40
|
-
this.fillMesh.geometry.dispose(), this.fillMesh.geometry = i;
|
|
41
|
-
const t = new o(i);
|
|
42
|
-
this.edgeLines.geometry.dispose(), this.edgeLines.geometry = t, this.container.position.copy(this.center), this.container.visible = !0;
|
|
43
|
-
}
|
|
44
|
-
hide() {
|
|
45
|
-
this.container.visible = !1;
|
|
46
|
-
}
|
|
47
|
-
dispose() {
|
|
48
|
-
this.scene.remove(this.container), this.fillMesh.geometry.dispose(), this.fillMesh.material.dispose(), this.edgeLines.geometry.dispose(), this.edgeLines.material.dispose();
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
export {
|
|
52
|
-
u as DebugEntityCursor
|
|
53
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Vector2 as l, Quaternion as m, Euler as p } from "three";
|
|
2
|
-
function b(s) {
|
|
3
|
-
return {
|
|
4
|
-
spawn: async (n, r, t) => {
|
|
5
|
-
const e = await Promise.resolve(s(r, t));
|
|
6
|
-
return n.add(e), e;
|
|
7
|
-
},
|
|
8
|
-
spawnRelative: async (n, r, t = new l(0, 1)) => {
|
|
9
|
-
if (!n.body) {
|
|
10
|
-
console.warn("body missing for entity during spawnRelative");
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
const { x: e, y: c, z: u } = n.body.translation();
|
|
14
|
-
let a = n._rotation2DAngle ?? 0;
|
|
15
|
-
try {
|
|
16
|
-
const o = n.body.rotation(), d = new m(o.x, o.y, o.z, o.w);
|
|
17
|
-
a = new p().setFromQuaternion(d, "XYZ").z;
|
|
18
|
-
} catch {
|
|
19
|
-
}
|
|
20
|
-
const w = Math.sin(-a) * (t.x ?? 0), y = Math.cos(-a) * (t.y ?? 0), i = await Promise.resolve(s(e + w, c + y));
|
|
21
|
-
return r.add(i), i;
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
export {
|
|
26
|
-
b as entitySpawner
|
|
27
|
-
};
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { Ray as b } from "@dimforge/rapier3d-compat";
|
|
2
|
-
import { Vector2 as E, Raycaster as f, LineSegments as L, BufferGeometry as p, LineBasicMaterial as w, BufferAttribute as m } from "three";
|
|
3
|
-
import { debugState as C, getDebugTool as y, setHoveredEntity as D, resetHoveredEntity as v, getHoveredEntity as R, DebugTools as d, setSelectedEntity as T } from "../debug/debug-state.js";
|
|
4
|
-
import { DebugEntityCursor as O } from "./debug-entity-cursor.js";
|
|
5
|
-
const F = 2293538, x = 16724787;
|
|
6
|
-
class A {
|
|
7
|
-
stage;
|
|
8
|
-
options;
|
|
9
|
-
mouseNdc = new E(-2, -2);
|
|
10
|
-
raycaster = new f();
|
|
11
|
-
isMouseDown = !1;
|
|
12
|
-
disposeFns = [];
|
|
13
|
-
debugCursor = null;
|
|
14
|
-
debugLines = null;
|
|
15
|
-
constructor(e, s) {
|
|
16
|
-
this.stage = e, this.options = {
|
|
17
|
-
maxRayDistance: s?.maxRayDistance ?? 5e3,
|
|
18
|
-
addEntityFactory: s?.addEntityFactory ?? null
|
|
19
|
-
}, this.stage.scene && (this.debugLines = new L(new p(), new w({ vertexColors: !0 })), this.stage.scene.scene.add(this.debugLines), this.debugLines.visible = !0, this.debugCursor = new O(this.stage.scene.scene)), this.attachDomListeners();
|
|
20
|
-
}
|
|
21
|
-
update() {
|
|
22
|
-
if (!C.on || !this.stage.scene || !this.stage.world || !this.stage.cameraRef)
|
|
23
|
-
return;
|
|
24
|
-
const { world: e, cameraRef: s } = this.stage;
|
|
25
|
-
if (this.debugLines) {
|
|
26
|
-
const { vertices: l, colors: c } = e.world.debugRender();
|
|
27
|
-
this.debugLines.geometry.setAttribute("position", new m(l, 3)), this.debugLines.geometry.setAttribute("color", new m(c, 4));
|
|
28
|
-
}
|
|
29
|
-
const i = y(), n = i === d.SELECT || i === d.DELETE;
|
|
30
|
-
this.raycaster.setFromCamera(this.mouseNdc, s.camera);
|
|
31
|
-
const t = this.raycaster.ray.origin.clone(), o = this.raycaster.ray.direction.clone().normalize(), r = new b({ x: t.x, y: t.y, z: t.z }, { x: o.x, y: o.y, z: o.z }), a = e.world.castRay(r, this.options.maxRayDistance, !0);
|
|
32
|
-
if (a && n) {
|
|
33
|
-
const c = a.collider?._parent?.userData?.uuid;
|
|
34
|
-
c ? D(c) : v(), this.isMouseDown && this.handleActionOnHit(c ?? null, t, o, a.toi);
|
|
35
|
-
}
|
|
36
|
-
this.isMouseDown = !1;
|
|
37
|
-
const u = R();
|
|
38
|
-
if (!u) {
|
|
39
|
-
this.debugCursor?.hide();
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const h = this.stage._debugMap.get(`${u}`), g = h?.group ?? h?.mesh ?? null;
|
|
43
|
-
if (!g) {
|
|
44
|
-
this.debugCursor?.hide();
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
switch (i) {
|
|
48
|
-
case d.SELECT:
|
|
49
|
-
this.debugCursor?.setColor(F);
|
|
50
|
-
break;
|
|
51
|
-
case d.DELETE:
|
|
52
|
-
this.debugCursor?.setColor(x);
|
|
53
|
-
break;
|
|
54
|
-
default:
|
|
55
|
-
this.debugCursor?.setColor(16777215);
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
this.debugCursor?.updateFromObject(g);
|
|
59
|
-
}
|
|
60
|
-
dispose() {
|
|
61
|
-
this.disposeFns.forEach((e) => e()), this.disposeFns = [], this.debugCursor?.dispose(), this.debugLines && this.stage.scene && (this.stage.scene.scene.remove(this.debugLines), this.debugLines.geometry.dispose(), this.debugLines.material.dispose(), this.debugLines = null);
|
|
62
|
-
}
|
|
63
|
-
handleActionOnHit(e, s, i, n) {
|
|
64
|
-
switch (y()) {
|
|
65
|
-
case "SELECT": {
|
|
66
|
-
e && T(e);
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
case "DELETE": {
|
|
70
|
-
e && this.stage.removeEntityByUuid(e);
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
case "ADD": {
|
|
74
|
-
if (!this.options.addEntityFactory)
|
|
75
|
-
break;
|
|
76
|
-
const o = s.clone().add(i.clone().multiplyScalar(n)), r = this.options.addEntityFactory({ position: o });
|
|
77
|
-
r && Promise.resolve(r).then((a) => {
|
|
78
|
-
a && this.stage.spawnEntity(a);
|
|
79
|
-
}).catch(() => {
|
|
80
|
-
});
|
|
81
|
-
break;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
attachDomListeners() {
|
|
86
|
-
const e = this.stage.cameraRef?.renderer.domElement ?? this.stage.scene?.zylemCamera.renderer.domElement;
|
|
87
|
-
if (!e)
|
|
88
|
-
return;
|
|
89
|
-
const s = (n) => {
|
|
90
|
-
const t = e.getBoundingClientRect(), o = (n.clientX - t.left) / t.width * 2 - 1, r = -((n.clientY - t.top) / t.height * 2 - 1);
|
|
91
|
-
this.mouseNdc.set(o, r);
|
|
92
|
-
}, i = (n) => {
|
|
93
|
-
this.isMouseDown = !0;
|
|
94
|
-
};
|
|
95
|
-
e.addEventListener("mousemove", s), e.addEventListener("mousedown", i), this.disposeFns.push(() => e.removeEventListener("mousemove", s)), this.disposeFns.push(() => e.removeEventListener("mousedown", i));
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
export {
|
|
99
|
-
A as StageDebugDelegate
|
|
100
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
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
|
-
backgroundImage: null,
|
|
7
|
-
inputs: {
|
|
8
|
-
p1: ["gamepad-1", "keyboard"],
|
|
9
|
-
p2: ["gamepad-2", "keyboard"]
|
|
10
|
-
},
|
|
11
|
-
gravity: new i(0, 0, 0),
|
|
12
|
-
variables: {}
|
|
13
|
-
}, o = r({
|
|
14
|
-
...g
|
|
15
|
-
});
|
|
16
|
-
function b(a) {
|
|
17
|
-
const e = l();
|
|
18
|
-
let t = {};
|
|
19
|
-
return typeof a[0] == "object" && (t = a.shift() ?? {}), [{ ...e, ...t }, ...a];
|
|
20
|
-
}
|
|
21
|
-
function l() {
|
|
22
|
-
return {
|
|
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
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
export {
|
|
31
|
-
b as getStageOptions
|
|
32
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Vector3 as t, Color as r } from "three";
|
|
2
|
-
import { proxy as s } from "valtio/vanilla";
|
|
3
|
-
const e = s({
|
|
4
|
-
backgroundColor: new r(r.NAMES.cornflowerblue),
|
|
5
|
-
backgroundImage: null,
|
|
6
|
-
inputs: {
|
|
7
|
-
p1: ["gamepad-1", "keyboard-1"],
|
|
8
|
-
p2: ["gamepad-2", "keyboard-2"]
|
|
9
|
-
},
|
|
10
|
-
variables: {},
|
|
11
|
-
gravity: new t(0, 0, 0),
|
|
12
|
-
entities: []
|
|
13
|
-
}), l = (a) => {
|
|
14
|
-
e.backgroundColor = a;
|
|
15
|
-
}, b = (a) => {
|
|
16
|
-
e.backgroundImage = a;
|
|
17
|
-
}, i = (a, o) => {
|
|
18
|
-
e.variables[a] = o;
|
|
19
|
-
}, c = (a) => {
|
|
20
|
-
if (e.variables.hasOwnProperty(a))
|
|
21
|
-
return e.variables[a];
|
|
22
|
-
console.warn(`Stage variable ${a} not found`);
|
|
23
|
-
}, d = (a) => {
|
|
24
|
-
e.variables = { ...a };
|
|
25
|
-
}, u = () => {
|
|
26
|
-
e.variables = {};
|
|
27
|
-
};
|
|
28
|
-
export {
|
|
29
|
-
c as getStageVariable,
|
|
30
|
-
u as resetStageVariables,
|
|
31
|
-
l as setStageBackgroundColor,
|
|
32
|
-
b as setStageBackgroundImage,
|
|
33
|
-
i as setStageVariable,
|
|
34
|
-
d as setStageVariables,
|
|
35
|
-
e as stageState
|
|
36
|
-
};
|
package/dist/lib/stage/stage.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
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
|
-
wrappedStage;
|
|
7
|
-
options = [];
|
|
8
|
-
// TODO: these shouldn't be here maybe more like nextFrame(stageInstance, () => {})
|
|
9
|
-
update = () => {
|
|
10
|
-
};
|
|
11
|
-
setup = () => {
|
|
12
|
-
};
|
|
13
|
-
destroy = () => {
|
|
14
|
-
};
|
|
15
|
-
constructor(t) {
|
|
16
|
-
this.options = t, this.wrappedStage = null;
|
|
17
|
-
}
|
|
18
|
-
async load(t, e) {
|
|
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 });
|
|
25
|
-
}
|
|
26
|
-
async addEntities(t) {
|
|
27
|
-
this.options.push(...t), this.wrappedStage && this.wrappedStage.enqueue(...t);
|
|
28
|
-
}
|
|
29
|
-
add(...t) {
|
|
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);
|
|
37
|
-
}
|
|
38
|
-
start(t) {
|
|
39
|
-
this.wrappedStage?.nodeSetup(t);
|
|
40
|
-
}
|
|
41
|
-
onUpdate(...t) {
|
|
42
|
-
this.wrappedStage && (this.wrappedStage.update = (e) => {
|
|
43
|
-
const a = { ...e, stage: this };
|
|
44
|
-
t.forEach((p) => p(a));
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
onSetup(t) {
|
|
48
|
-
this.wrappedStage.setup = t;
|
|
49
|
-
}
|
|
50
|
-
onDestroy(t) {
|
|
51
|
-
this.wrappedStage.destroy = t;
|
|
52
|
-
}
|
|
53
|
-
setVariable(t, e) {
|
|
54
|
-
n(t, e);
|
|
55
|
-
}
|
|
56
|
-
getVariable(t) {
|
|
57
|
-
return g(t);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
function c(...i) {
|
|
61
|
-
const t = S(i);
|
|
62
|
-
return new h([...t]);
|
|
63
|
-
}
|
|
64
|
-
export {
|
|
65
|
-
h as Stage,
|
|
66
|
-
c as createStage
|
|
67
|
-
};
|