@zylem/game-lib 0.4.1 → 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/{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 -15
- package/dist/stage.js.map +1 -0
- package/dist/transformable-CUhvyuYO.d.ts +67 -0
- package/package.json +12 -42
- package/LICENSE +0 -21
- package/dist/.vite/manifest.json +0 -676
- package/dist/api/actions.d.ts +0 -5
- package/dist/api/actions.d.ts.map +0 -1
- package/dist/api/behaviors.d.ts +0 -4
- package/dist/api/behaviors.d.ts.map +0 -1
- package/dist/api/camera.d.ts +0 -4
- package/dist/api/camera.d.ts.map +0 -1
- package/dist/api/core.d.ts +0 -6
- package/dist/api/core.d.ts.map +0 -1
- package/dist/api/entities.d.ts +0 -9
- package/dist/api/entities.d.ts.map +0 -1
- package/dist/api/main.d.ts +0 -32
- package/dist/api/main.d.ts.map +0 -1
- package/dist/api/stage.d.ts +0 -6
- package/dist/api/stage.d.ts.map +0 -1
- package/dist/assets/zylem-logo.png +0 -0
- package/dist/lib/actions/behaviors/actions.d.ts +0 -11
- package/dist/lib/actions/behaviors/actions.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/actions.js +0 -35
- package/dist/lib/actions/behaviors/behavior.d.ts +0 -6
- package/dist/lib/actions/behaviors/behavior.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/boundaries/boundary.d.ts +0 -37
- package/dist/lib/actions/behaviors/boundaries/boundary.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/boundaries/boundary.js +0 -40
- package/dist/lib/actions/behaviors/character-controller.d.ts +0 -6
- package/dist/lib/actions/behaviors/character-controller.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/debug/debug-collision.d.ts +0 -6
- package/dist/lib/actions/behaviors/debug/debug-collision.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/debug/debug-update.d.ts +0 -5
- package/dist/lib/actions/behaviors/debug/debug-update.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/debug/debug.d.ts +0 -10
- package/dist/lib/actions/behaviors/debug/debug.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/movement/movement-sequence-2d.d.ts +0 -24
- 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 +0 -11
- package/dist/lib/actions/behaviors/ricochet/ricochet-2d-collision.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/ricochet/ricochet-2d-collision.js +0 -100
- package/dist/lib/actions/behaviors/ricochet/ricochet-2d-in-bounds.d.ts +0 -12
- package/dist/lib/actions/behaviors/ricochet/ricochet-2d-in-bounds.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/ricochet/ricochet-2d-in-bounds.js +0 -37
- package/dist/lib/actions/behaviors/ricochet/ricochet.d.ts +0 -44
- package/dist/lib/actions/behaviors/ricochet/ricochet.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/ricochet/ricochet.js +0 -6
- package/dist/lib/actions/behaviors/zylem-behavior.d.ts +0 -2
- package/dist/lib/actions/behaviors/zylem-behavior.d.ts.map +0 -1
- package/dist/lib/actions/capabilities/moveable.d.ts +0 -125
- package/dist/lib/actions/capabilities/moveable.d.ts.map +0 -1
- package/dist/lib/actions/capabilities/moveable.js +0 -108
- package/dist/lib/actions/capabilities/rotatable.d.ts +0 -111
- package/dist/lib/actions/capabilities/rotatable.d.ts.map +0 -1
- package/dist/lib/actions/capabilities/rotatable.js +0 -82
- package/dist/lib/actions/capabilities/transformable.d.ts +0 -7
- package/dist/lib/actions/capabilities/transformable.d.ts.map +0 -1
- package/dist/lib/actions/capabilities/transformable.js +0 -9
- package/dist/lib/actions/global-change.d.ts +0 -23
- package/dist/lib/actions/global-change.d.ts.map +0 -1
- package/dist/lib/actions/global-change.js +0 -40
- package/dist/lib/camera/camera.d.ts +0 -16
- package/dist/lib/camera/camera.d.ts.map +0 -1
- package/dist/lib/camera/camera.js +0 -19
- package/dist/lib/camera/fixed-2d.d.ts +0 -32
- package/dist/lib/camera/fixed-2d.d.ts.map +0 -1
- package/dist/lib/camera/fixed-2d.js +0 -30
- package/dist/lib/camera/perspective.d.ts +0 -9
- package/dist/lib/camera/perspective.d.ts.map +0 -1
- package/dist/lib/camera/perspective.js +0 -10
- package/dist/lib/camera/third-person.d.ts +0 -32
- package/dist/lib/camera/third-person.d.ts.map +0 -1
- package/dist/lib/camera/third-person.js +0 -42
- package/dist/lib/camera/zylem-camera.d.ts.map +0 -1
- package/dist/lib/camera/zylem-camera.js +0 -208
- package/dist/lib/collision/collision-builder.d.ts +0 -17
- package/dist/lib/collision/collision-builder.d.ts.map +0 -1
- package/dist/lib/collision/collision-builder.js +0 -46
- package/dist/lib/collision/collision-delegate.d.ts +0 -6
- package/dist/lib/collision/collision-delegate.d.ts.map +0 -1
- package/dist/lib/collision/collision-delegate.js +0 -6
- package/dist/lib/collision/collision-group.d.ts +0 -11
- package/dist/lib/collision/collision-group.d.ts.map +0 -1
- package/dist/lib/collision/collision-mask.d.ts +0 -18
- package/dist/lib/collision/collision-mask.d.ts.map +0 -1
- package/dist/lib/collision/collision.d.ts +0 -19
- package/dist/lib/collision/collision.d.ts.map +0 -1
- package/dist/lib/collision/utils.d.ts +0 -15
- package/dist/lib/collision/utils.d.ts.map +0 -1
- package/dist/lib/collision/utils.js +0 -24
- package/dist/lib/collision/world.d.ts +0 -23
- package/dist/lib/collision/world.d.ts.map +0 -1
- package/dist/lib/collision/world.js +0 -77
- package/dist/lib/core/asset-manager.d.ts +0 -2
- 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 +0 -37
- package/dist/lib/core/base-node.d.ts.map +0 -1
- package/dist/lib/core/base-node.js +0 -62
- package/dist/lib/core/entity-asset-loader.d.ts +0 -16
- package/dist/lib/core/entity-asset-loader.d.ts.map +0 -1
- package/dist/lib/core/entity-asset-loader.js +0 -54
- package/dist/lib/core/errors.d.ts +0 -5
- package/dist/lib/core/errors.d.ts.map +0 -1
- package/dist/lib/core/flags.d.ts +0 -3
- package/dist/lib/core/flags.d.ts.map +0 -1
- package/dist/lib/core/index.d.ts +0 -5
- package/dist/lib/core/index.d.ts.map +0 -1
- package/dist/lib/core/lazy-loader.d.ts +0 -80
- package/dist/lib/core/lazy-loader.d.ts.map +0 -1
- package/dist/lib/core/lifecycle-base.d.ts +0 -17
- package/dist/lib/core/lifecycle-base.d.ts.map +0 -1
- package/dist/lib/core/lifecycle-base.js +0 -20
- package/dist/lib/core/preset-shader.d.ts +0 -8
- package/dist/lib/core/preset-shader.d.ts.map +0 -1
- package/dist/lib/core/preset-shader.js +0 -26
- package/dist/lib/core/three-addons/Timer.d.ts +0 -92
- package/dist/lib/core/three-addons/Timer.d.ts.map +0 -1
- package/dist/lib/core/three-addons/Timer.js +0 -103
- package/dist/lib/core/utility/nodes.d.ts +0 -13
- package/dist/lib/core/utility/nodes.d.ts.map +0 -1
- package/dist/lib/core/utility/nodes.js +0 -31
- package/dist/lib/core/utility/strings.d.ts +0 -3
- package/dist/lib/core/utility/strings.d.ts.map +0 -1
- package/dist/lib/core/utility/strings.js +0 -14
- package/dist/lib/core/utility/vector.d.ts +0 -8
- package/dist/lib/core/utility/vector.d.ts.map +0 -1
- package/dist/lib/core/utility/vector.js +0 -8
- package/dist/lib/core/vector.d.ts +0 -4
- package/dist/lib/core/vector.d.ts.map +0 -1
- package/dist/lib/core/vessel.d.ts +0 -13
- package/dist/lib/core/vessel.d.ts.map +0 -1
- package/dist/lib/core/vessel.js +0 -26
- package/dist/lib/debug/console/console-state.d.ts +0 -20
- package/dist/lib/debug/console/console-state.d.ts.map +0 -1
- package/dist/lib/debug/console/console-state.js +0 -11
- package/dist/lib/debug/console/console-store.d.ts +0 -6
- package/dist/lib/debug/console/console-store.d.ts.map +0 -1
- package/dist/lib/debug/debug-state.d.ts +0 -38
- package/dist/lib/debug/debug-state.d.ts.map +0 -1
- package/dist/lib/debug/debug-state.js +0 -40
- package/dist/lib/debug/debug-store.d.ts +0 -15
- package/dist/lib/debug/debug-store.d.ts.map +0 -1
- package/dist/lib/debug/state-based-debug-loader.d.ts +0 -8
- package/dist/lib/debug/state-based-debug-loader.d.ts.map +0 -1
- package/dist/lib/device/aspect-ratio.d.ts +0 -38
- package/dist/lib/device/aspect-ratio.d.ts.map +0 -1
- package/dist/lib/device/aspect-ratio.js +0 -44
- package/dist/lib/device/desktop.d.ts +0 -2
- package/dist/lib/device/desktop.d.ts.map +0 -1
- package/dist/lib/device/mobile.d.ts +0 -2
- package/dist/lib/device/mobile.d.ts.map +0 -1
- package/dist/lib/device/tablet.d.ts +0 -2
- package/dist/lib/device/tablet.d.ts.map +0 -1
- package/dist/lib/entities/actor.d.ts +0 -44
- package/dist/lib/entities/actor.d.ts.map +0 -1
- package/dist/lib/entities/actor.js +0 -122
- package/dist/lib/entities/box.d.ts +0 -27
- package/dist/lib/entities/box.d.ts.map +0 -1
- package/dist/lib/entities/box.js +0 -68
- package/dist/lib/entities/builder.d.ts +0 -28
- package/dist/lib/entities/builder.d.ts.map +0 -1
- package/dist/lib/entities/builder.js +0 -79
- package/dist/lib/entities/create.d.ts +0 -15
- package/dist/lib/entities/create.d.ts.map +0 -1
- package/dist/lib/entities/create.js +0 -31
- package/dist/lib/entities/delegates/animation.d.ts +0 -33
- package/dist/lib/entities/delegates/animation.d.ts.map +0 -1
- package/dist/lib/entities/delegates/animation.js +0 -58
- package/dist/lib/entities/delegates/debug.d.ts +0 -29
- package/dist/lib/entities/delegates/debug.d.ts.map +0 -1
- package/dist/lib/entities/delegates/debug.js +0 -71
- package/dist/lib/entities/delegates/loader.d.ts +0 -12
- package/dist/lib/entities/delegates/loader.d.ts.map +0 -1
- package/dist/lib/entities/delegates/loader.js +0 -19
- package/dist/lib/entities/destroy.d.ts +0 -4
- package/dist/lib/entities/destroy.d.ts.map +0 -1
- package/dist/lib/entities/destroy.js +0 -15
- package/dist/lib/entities/entity.d.ts +0 -96
- package/dist/lib/entities/entity.d.ts.map +0 -1
- package/dist/lib/entities/entity.js +0 -120
- package/dist/lib/entities/index.d.ts +0 -12
- package/dist/lib/entities/index.d.ts.map +0 -1
- package/dist/lib/entities/plane.d.ts +0 -36
- package/dist/lib/entities/plane.d.ts.map +0 -1
- package/dist/lib/entities/plane.js +0 -81
- package/dist/lib/entities/rect.d.ts +0 -63
- package/dist/lib/entities/rect.d.ts.map +0 -1
- package/dist/lib/entities/rect.js +0 -160
- package/dist/lib/entities/sphere.d.ts +0 -29
- package/dist/lib/entities/sphere.d.ts.map +0 -1
- package/dist/lib/entities/sphere.js +0 -68
- package/dist/lib/entities/sprite.d.ts +0 -53
- package/dist/lib/entities/sprite.d.ts.map +0 -1
- package/dist/lib/entities/sprite.js +0 -118
- package/dist/lib/entities/text.d.ts +0 -49
- package/dist/lib/entities/text.d.ts.map +0 -1
- package/dist/lib/entities/text.js +0 -140
- package/dist/lib/entities/zone.d.ts +0 -54
- package/dist/lib/entities/zone.d.ts.map +0 -1
- package/dist/lib/entities/zone.js +0 -103
- package/dist/lib/game/game-blueprint.d.ts +0 -38
- package/dist/lib/game/game-blueprint.d.ts.map +0 -1
- package/dist/lib/game/game-canvas.d.ts +0 -35
- package/dist/lib/game/game-canvas.d.ts.map +0 -1
- package/dist/lib/game/game-canvas.js +0 -57
- package/dist/lib/game/game-config.d.ts +0 -59
- package/dist/lib/game/game-config.d.ts.map +0 -1
- package/dist/lib/game/game-config.js +0 -78
- package/dist/lib/game/game-default.d.ts +0 -14
- package/dist/lib/game/game-default.d.ts.map +0 -1
- package/dist/lib/game/game-default.js +0 -23
- package/dist/lib/game/game-interfaces.d.ts +0 -29
- package/dist/lib/game/game-interfaces.d.ts.map +0 -1
- package/dist/lib/game/game-retro-resolutions.d.ts +0 -25
- package/dist/lib/game/game-retro-resolutions.d.ts.map +0 -1
- package/dist/lib/game/game-retro-resolutions.js +0 -80
- package/dist/lib/game/game-state.d.ts +0 -11
- package/dist/lib/game/game-state.d.ts.map +0 -1
- package/dist/lib/game/game-state.js +0 -17
- package/dist/lib/game/game.d.ts +0 -37
- package/dist/lib/game/game.d.ts.map +0 -1
- package/dist/lib/game/game.js +0 -109
- package/dist/lib/game/zylem-game.d.ts +0 -58
- package/dist/lib/game/zylem-game.d.ts.map +0 -1
- package/dist/lib/game/zylem-game.js +0 -140
- package/dist/lib/graphics/geometries/XZPlaneGeometry.d.ts +0 -8
- package/dist/lib/graphics/geometries/XZPlaneGeometry.d.ts.map +0 -1
- package/dist/lib/graphics/geometries/XZPlaneGeometry.js +0 -34
- package/dist/lib/graphics/material.d.ts +0 -29
- package/dist/lib/graphics/material.d.ts.map +0 -1
- package/dist/lib/graphics/material.js +0 -64
- package/dist/lib/graphics/mesh.d.ts +0 -19
- package/dist/lib/graphics/mesh.d.ts.map +0 -1
- package/dist/lib/graphics/mesh.js +0 -14
- package/dist/lib/graphics/render-pass.d.ts +0 -17
- package/dist/lib/graphics/render-pass.d.ts.map +0 -1
- 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.d.ts +0 -50
- package/dist/lib/graphics/zylem-scene.d.ts.map +0 -1
- package/dist/lib/graphics/zylem-scene.js +0 -75
- package/dist/lib/input/gamepad-provider.d.ts +0 -14
- package/dist/lib/input/gamepad-provider.d.ts.map +0 -1
- package/dist/lib/input/gamepad-provider.js +0 -58
- package/dist/lib/input/input-manager.d.ts +0 -15
- package/dist/lib/input/input-manager.d.ts.map +0 -1
- package/dist/lib/input/input-manager.js +0 -70
- package/dist/lib/input/input-provider.d.ts +0 -7
- package/dist/lib/input/input-provider.d.ts.map +0 -1
- package/dist/lib/input/input.d.ts +0 -48
- package/dist/lib/input/input.d.ts.map +0 -1
- package/dist/lib/input/keyboard-provider.d.ts +0 -21
- package/dist/lib/input/keyboard-provider.d.ts.map +0 -1
- package/dist/lib/input/keyboard-provider.js +0 -120
- package/dist/lib/interfaces/entity.d.ts +0 -26
- package/dist/lib/interfaces/entity.d.ts.map +0 -1
- package/dist/lib/sounds/index.d.ts +0 -3
- package/dist/lib/sounds/index.d.ts.map +0 -1
- package/dist/lib/sounds/ping-pong-sound.d.ts +0 -5
- package/dist/lib/sounds/ping-pong-sound.d.ts.map +0 -1
- package/dist/lib/sounds/ricochet-sound.d.ts +0 -5
- package/dist/lib/sounds/ricochet-sound.d.ts.map +0 -1
- package/dist/lib/stage/debug-entity-cursor.d.ts +0 -24
- package/dist/lib/stage/debug-entity-cursor.d.ts.map +0 -1
- package/dist/lib/stage/debug-entity-cursor.js +0 -53
- package/dist/lib/stage/entity-spawner.d.ts +0 -9
- package/dist/lib/stage/entity-spawner.d.ts.map +0 -1
- package/dist/lib/stage/entity-spawner.js +0 -27
- 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 +0 -14
- package/dist/lib/stage/stage-camera-debug-delegate.d.ts.map +0 -1
- package/dist/lib/stage/stage-debug-delegate.d.ts +0 -26
- package/dist/lib/stage/stage-debug-delegate.d.ts.map +0 -1
- package/dist/lib/stage/stage-debug-delegate.js +0 -100
- package/dist/lib/stage/stage-default.d.ts +0 -3
- package/dist/lib/stage/stage-default.d.ts.map +0 -1
- package/dist/lib/stage/stage-default.js +0 -32
- package/dist/lib/stage/stage-state.d.ts +0 -14
- package/dist/lib/stage/stage-state.d.ts.map +0 -1
- package/dist/lib/stage/stage-state.js +0 -36
- package/dist/lib/stage/stage.d.ts +0 -33
- package/dist/lib/stage/stage.d.ts.map +0 -1
- package/dist/lib/stage/stage.js +0 -60
- package/dist/lib/stage/zylem-stage.d.ts +0 -128
- package/dist/lib/stage/zylem-stage.d.ts.map +0 -1
- package/dist/lib/stage/zylem-stage.js +0 -268
- package/dist/lib/systems/test-system.d.ts +0 -2
- package/dist/lib/systems/test-system.d.ts.map +0 -1
- package/dist/lib/systems/transformable.system.d.ts +0 -25
- package/dist/lib/systems/transformable.system.d.ts.map +0 -1
- package/dist/lib/systems/transformable.system.js +0 -43
- package/dist/lib/types/entity-types.d.ts +0 -24
- package/dist/lib/types/entity-types.d.ts.map +0 -1
- package/dist/lib/types/index.d.ts +0 -3
- package/dist/lib/types/index.d.ts.map +0 -1
- package/dist/lib/types/stage-types.d.ts +0 -26
- package/dist/lib/types/stage-types.d.ts.map +0 -1
- package/dist/lib/ui/Debug.d.ts +0 -6
- package/dist/lib/ui/Debug.d.ts.map +0 -1
- package/dist/lib/ui/console/Console.d.ts +0 -7
- package/dist/lib/ui/console/Console.d.ts.map +0 -1
- package/dist/lib/ui/debug-panel/AccordionMenu.d.ts +0 -7
- package/dist/lib/ui/debug-panel/AccordionMenu.d.ts.map +0 -1
- package/dist/lib/ui/debug-panel/Menu.d.ts +0 -6
- package/dist/lib/ui/debug-panel/Menu.d.ts.map +0 -1
- package/dist/lib/ui/debug-panel/sections/EntitiesSection.d.ts +0 -4
- package/dist/lib/ui/debug-panel/sections/EntitiesSection.d.ts.map +0 -1
- package/dist/lib/ui/debug-panel/sections/GameSection.d.ts +0 -3
- package/dist/lib/ui/debug-panel/sections/GameSection.d.ts.map +0 -1
- package/dist/lib/ui/debug-panel/sections/StagesSection.d.ts +0 -3
- package/dist/lib/ui/debug-panel/sections/StagesSection.d.ts.map +0 -1
- package/dist/lib/ui/debug-panel/sections/all.d.ts +0 -4
- package/dist/lib/ui/debug-panel/sections/all.d.ts.map +0 -1
- package/dist/lib/ui/toolbar/Toolbar.d.ts +0 -6
- package/dist/lib/ui/toolbar/Toolbar.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/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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"game-config.d.ts","sourceRoot":"","sources":["../../../src/lib/game/game-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAA0D,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAElH,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,eAAe,CAAC;IACvB,0CAA0C;IAC1C,WAAW,EAAE,gBAAgB,GAAG,MAAM,OAAO,WAAW,CAAC;IACzD,oDAAoD;IACpD,MAAM,EAAE,cAAc,CAAC;IACvB,4FAA4F;IAC5F,UAAU,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACvD,UAAU,EAAE,OAAO,CAAC;IACpB,6CAA6C;IAC7C,cAAc,EAAE,MAAM,CAAC;IACvB,sCAAsC;IACtC,SAAS,EAAE,WAAW,CAAC;IACvB,kCAAkC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,mDAAmD;IACnD,MAAM,EAAE,iBAAiB,CAAC;CAC1B,CAAC,CAAC;AAEH,qBAAa,UAAU;IAEd,EAAE,EAAE,MAAM;IACV,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAC5B,MAAM,EAAE,cAAc,EAAE;IACxB,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,eAAe,GAAG,SAAS;IAClC,WAAW,EAAE,MAAM;IACnB,kBAAkB,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS;IACjE,UAAU,EAAE,OAAO;IACnB,cAAc,EAAE,MAAM,GAAG,SAAS;IAClC,SAAS,EAAE,WAAW;IACtB,WAAW,CAAC,EAAE,MAAM;IACpB,MAAM,CAAC,EAAE,iBAAiB;gBAZ1B,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC5B,MAAM,EAAE,cAAc,EAAE,EACxB,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,eAAe,GAAG,SAAS,EAClC,WAAW,EAAE,MAAM,EACnB,kBAAkB,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,EACjE,UAAU,EAAE,OAAO,EACnB,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,SAAS,EAAE,WAAW,EACtB,WAAW,CAAC,EAAE,MAAM,YAAA,EACpB,MAAM,CAAC,EAAE,iBAAiB,YAAA;CAElC;AAsCD,wBAAgB,iBAAiB,CAAC,IAAI,CAAC,EAAE,cAAc,GAAG,UAAU,CAoEnE;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CAEjE"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { AspectRatio as p } from "../device/aspect-ratio.js";
|
|
2
|
-
import { getDisplayAspect as b, parseResolution as y, getPresetResolution as R } from "./game-retro-resolutions.js";
|
|
3
|
-
class f {
|
|
4
|
-
id;
|
|
5
|
-
globals;
|
|
6
|
-
stages;
|
|
7
|
-
debug;
|
|
8
|
-
time;
|
|
9
|
-
input;
|
|
10
|
-
aspectRatio;
|
|
11
|
-
internalResolution;
|
|
12
|
-
fullscreen;
|
|
13
|
-
bodyBackground;
|
|
14
|
-
container;
|
|
15
|
-
containerId;
|
|
16
|
-
canvas;
|
|
17
|
-
constructor(i, o, n, e, l, d, r, a, g, c, s, h, m) {
|
|
18
|
-
this.id = i, this.globals = o, this.stages = n, this.debug = e, this.time = l, this.input = d, this.aspectRatio = r, this.internalResolution = a, this.fullscreen = g, this.bodyBackground = c, this.container = s, this.containerId = h, this.canvas = m;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
function u(t, i) {
|
|
22
|
-
if (i)
|
|
23
|
-
return i;
|
|
24
|
-
if (t) {
|
|
25
|
-
const e = document.getElementById(t);
|
|
26
|
-
if (e)
|
|
27
|
-
return e;
|
|
28
|
-
}
|
|
29
|
-
const o = t || "zylem-root", n = document.createElement("main");
|
|
30
|
-
return n.setAttribute("id", o), n.style.position = "relative", n.style.width = "100%", n.style.height = "100%", document.body.appendChild(n), n;
|
|
31
|
-
}
|
|
32
|
-
function B(t) {
|
|
33
|
-
const i = t?.id ?? "zylem", o = u(i);
|
|
34
|
-
return new f(i, t?.globals ?? {}, t?.stages ?? [], !!t?.debug, t?.time ?? 0, t?.input, p.SixteenByNine, void 0, !0, "#000000", o, i, void 0);
|
|
35
|
-
}
|
|
36
|
-
function C(t) {
|
|
37
|
-
const i = B({
|
|
38
|
-
id: t?.id ?? "zylem",
|
|
39
|
-
debug: !!t?.debug,
|
|
40
|
-
time: t?.time ?? 0,
|
|
41
|
-
input: t?.input,
|
|
42
|
-
stages: t?.stages ?? [],
|
|
43
|
-
globals: t?.globals ?? {}
|
|
44
|
-
}), o = t?.containerId ?? i.containerId, n = u(o, t?.container ?? null), e = t?.aspectRatio;
|
|
45
|
-
let l = i.aspectRatio;
|
|
46
|
-
if (typeof e == "number" || e && typeof e == "string")
|
|
47
|
-
l = typeof e == "number" ? e : p[e] ?? i.aspectRatio;
|
|
48
|
-
else if (t?.preset)
|
|
49
|
-
try {
|
|
50
|
-
l = b(t.preset) || i.aspectRatio;
|
|
51
|
-
} catch {
|
|
52
|
-
l = i.aspectRatio;
|
|
53
|
-
}
|
|
54
|
-
const d = t?.fullscreen ?? i.fullscreen, r = t?.bodyBackground ?? i.bodyBackground;
|
|
55
|
-
let a;
|
|
56
|
-
if (t?.resolution) {
|
|
57
|
-
if (typeof t.resolution == "string") {
|
|
58
|
-
const c = y(t.resolution);
|
|
59
|
-
if (c && (a = c), !a && t.preset) {
|
|
60
|
-
const s = R(t.preset, t.resolution);
|
|
61
|
-
s && (a = { width: s.width, height: s.height });
|
|
62
|
-
}
|
|
63
|
-
} else if (typeof t.resolution == "object") {
|
|
64
|
-
const c = t.resolution.width, s = t.resolution.height;
|
|
65
|
-
Number.isFinite(c) && Number.isFinite(s) && (a = { width: c, height: s });
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
const g = t?.canvas ?? void 0;
|
|
69
|
-
return new f(t?.id ?? i.id, t?.globals ?? i.globals, t?.stages ?? i.stages, !!(t?.debug ?? i.debug), t?.time ?? i.time, t?.input ?? i.input, l, a, d, r, n, o, g);
|
|
70
|
-
}
|
|
71
|
-
function k(t) {
|
|
72
|
-
return { ...t };
|
|
73
|
-
}
|
|
74
|
-
export {
|
|
75
|
-
f as GameConfig,
|
|
76
|
-
k as gameConfig,
|
|
77
|
-
C as resolveGameConfig
|
|
78
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Stage } from '../stage/stage';
|
|
2
|
-
import type { BasicTypes, BaseGlobals, GameInputConfig } from './game-interfaces';
|
|
3
|
-
/**
|
|
4
|
-
* Get a plain object copy of the current defaults.
|
|
5
|
-
*/
|
|
6
|
-
export declare function getGameDefaultConfig<TGlobals extends Record<string, BasicTypes> = BaseGlobals>(): {
|
|
7
|
-
id: string;
|
|
8
|
-
globals: TGlobals;
|
|
9
|
-
stages: Stage[];
|
|
10
|
-
debug?: boolean;
|
|
11
|
-
time?: number;
|
|
12
|
-
input?: GameInputConfig;
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=game-default.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"game-default.d.ts","sourceRoot":"","sources":["../../../src/lib/game/game-default.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAmB,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAiCnG;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,WAAW,KAAK;IAClG,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,QAAQ,CAAC;IAClB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,eAAe,CAAC;CACxB,CASA"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { proxy as i } from "valtio/vanilla";
|
|
2
|
-
import { stage as e } from "../stage/stage.js";
|
|
3
|
-
const a = () => ({
|
|
4
|
-
id: "zylem",
|
|
5
|
-
globals: {},
|
|
6
|
-
stages: [e()],
|
|
7
|
-
debug: !1,
|
|
8
|
-
time: 0,
|
|
9
|
-
input: void 0
|
|
10
|
-
}), t = i({ ...a() });
|
|
11
|
-
function g() {
|
|
12
|
-
return {
|
|
13
|
-
id: t.id ?? "zylem",
|
|
14
|
-
globals: t.globals ?? {},
|
|
15
|
-
stages: t.stages ?? [e()],
|
|
16
|
-
debug: t.debug,
|
|
17
|
-
time: t.time,
|
|
18
|
-
input: t.input
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export {
|
|
22
|
-
g as getGameDefaultConfig
|
|
23
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { UpdateFunction } from "../core/base-node-life-cycle";
|
|
2
|
-
export type BasicTypes = number | string | boolean;
|
|
3
|
-
export type BaseGlobals = Record<string, BasicTypes>;
|
|
4
|
-
export type KeyboardMapping = Record<string, string[]>;
|
|
5
|
-
export type MouseMapping = Record<string, string[]>;
|
|
6
|
-
export interface GameInputPlayerConfig {
|
|
7
|
-
key?: KeyboardMapping;
|
|
8
|
-
mouse?: MouseMapping;
|
|
9
|
-
}
|
|
10
|
-
export interface GameInputConfig {
|
|
11
|
-
p1?: GameInputPlayerConfig;
|
|
12
|
-
p2?: GameInputPlayerConfig;
|
|
13
|
-
p3?: GameInputPlayerConfig;
|
|
14
|
-
p4?: GameInputPlayerConfig;
|
|
15
|
-
p5?: GameInputPlayerConfig;
|
|
16
|
-
p6?: GameInputPlayerConfig;
|
|
17
|
-
p7?: GameInputPlayerConfig;
|
|
18
|
-
p8?: GameInputPlayerConfig;
|
|
19
|
-
}
|
|
20
|
-
export interface ZylemGameConfig<StageInterface, GameInterface, TGlobals extends BaseGlobals> {
|
|
21
|
-
id: string;
|
|
22
|
-
globals?: TGlobals;
|
|
23
|
-
stages?: StageInterface[];
|
|
24
|
-
update?: UpdateFunction<GameInterface>;
|
|
25
|
-
debug?: boolean;
|
|
26
|
-
time?: number;
|
|
27
|
-
input?: GameInputConfig;
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=game-interfaces.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"game-interfaces.d.ts","sourceRoot":"","sources":["../../../src/lib/game/game-interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AACnD,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAErD,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;AACvD,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;AAEpD,MAAM,WAAW,qBAAqB;IACrC,GAAG,CAAC,EAAE,eAAe,CAAC;IACtB,KAAK,CAAC,EAAE,YAAY,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC/B,EAAE,CAAC,EAAE,qBAAqB,CAAC;IAC3B,EAAE,CAAC,EAAE,qBAAqB,CAAC;IAC3B,EAAE,CAAC,EAAE,qBAAqB,CAAC;IAC3B,EAAE,CAAC,EAAE,qBAAqB,CAAC;IAC3B,EAAE,CAAC,EAAE,qBAAqB,CAAC;IAC3B,EAAE,CAAC,EAAE,qBAAqB,CAAC;IAC3B,EAAE,CAAC,EAAE,qBAAqB,CAAC;IAC3B,EAAE,CAAC,EAAE,qBAAqB,CAAC;CAC3B;AAED,MAAM,WAAW,eAAe,CAAC,cAAc,EAAE,aAAa,EAAE,QAAQ,SAAS,WAAW;IAC3F,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,MAAM,CAAC,EAAE,cAAc,EAAE,CAAC;IAC1B,MAAM,CAAC,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;IACvC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,eAAe,CAAC;CACxB"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export type RetroResolution = {
|
|
2
|
-
key: string;
|
|
3
|
-
width: number;
|
|
4
|
-
height: number;
|
|
5
|
-
notes?: string;
|
|
6
|
-
};
|
|
7
|
-
export type RetroPreset = {
|
|
8
|
-
displayAspect: number;
|
|
9
|
-
resolutions: RetroResolution[];
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Retro and console display presets.
|
|
13
|
-
* displayAspect represents the intended display aspect (letterboxing target),
|
|
14
|
-
* not necessarily the raw pixel aspect of internal buffers.
|
|
15
|
-
*/
|
|
16
|
-
declare const RetroPresets: Record<string, RetroPreset>;
|
|
17
|
-
export type RetroPresetKey = keyof typeof RetroPresets;
|
|
18
|
-
export declare function getDisplayAspect(preset: RetroPresetKey): number;
|
|
19
|
-
export declare function getPresetResolution(preset: RetroPresetKey, key?: string): RetroResolution | undefined;
|
|
20
|
-
export declare function parseResolution(text: string): {
|
|
21
|
-
width: number;
|
|
22
|
-
height: number;
|
|
23
|
-
} | null;
|
|
24
|
-
export {};
|
|
25
|
-
//# sourceMappingURL=game-retro-resolutions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"game-retro-resolutions.d.ts","sourceRoot":"","sources":["../../../src/lib/game/game-retro-resolutions.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7F,MAAM,MAAM,WAAW,GAAG;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,eAAe,EAAE,CAAC;CAC/B,CAAC;AAEF;;;;GAIG;AACH,QAAA,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAuD7C,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,YAAY,CAAC;AAEvD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAE/D;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAKrG;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAStF"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
const n = {
|
|
2
|
-
NES: {
|
|
3
|
-
displayAspect: 1.3333333333333333,
|
|
4
|
-
resolutions: [
|
|
5
|
-
{ key: "256x240", width: 256, height: 240, notes: "Standard NTSC; effective 240p." }
|
|
6
|
-
]
|
|
7
|
-
},
|
|
8
|
-
SNES: {
|
|
9
|
-
displayAspect: 1.3333333333333333,
|
|
10
|
-
resolutions: [
|
|
11
|
-
{ key: "256x224", width: 256, height: 224, notes: "Common 240p-equivalent mode." },
|
|
12
|
-
{ key: "512x448", width: 512, height: 448, notes: "Hi-res interlaced (480i)." }
|
|
13
|
-
]
|
|
14
|
-
},
|
|
15
|
-
N64: {
|
|
16
|
-
displayAspect: 1.3333333333333333,
|
|
17
|
-
resolutions: [
|
|
18
|
-
{ key: "320x240", width: 320, height: 240, notes: "Common 240p mode." },
|
|
19
|
-
{ key: "640x480", width: 640, height: 480, notes: "Higher resolution (480i)." }
|
|
20
|
-
]
|
|
21
|
-
},
|
|
22
|
-
PS1: {
|
|
23
|
-
displayAspect: 1.3333333333333333,
|
|
24
|
-
resolutions: [
|
|
25
|
-
{ key: "320x240", width: 320, height: 240, notes: "Progressive 240p common." },
|
|
26
|
-
{ key: "640x480", width: 640, height: 480, notes: "Interlaced 480i for higher detail." }
|
|
27
|
-
]
|
|
28
|
-
},
|
|
29
|
-
PS2: {
|
|
30
|
-
displayAspect: 1.3333333333333333,
|
|
31
|
-
resolutions: [
|
|
32
|
-
{ key: "640x480", width: 640, height: 480, notes: "480i/480p baseline." },
|
|
33
|
-
{ key: "720x480", width: 720, height: 480, notes: "480p (widescreen capable in some titles)." },
|
|
34
|
-
{ key: "1280x720", width: 1280, height: 720, notes: "720p (select titles)." }
|
|
35
|
-
]
|
|
36
|
-
},
|
|
37
|
-
PS5: {
|
|
38
|
-
displayAspect: 1.7777777777777777,
|
|
39
|
-
resolutions: [
|
|
40
|
-
{ key: "720x480", width: 720, height: 480, notes: "Legacy compatibility." },
|
|
41
|
-
{ key: "1280x720", width: 1280, height: 720, notes: "720p." },
|
|
42
|
-
{ key: "1920x1080", width: 1920, height: 1080, notes: "1080p." },
|
|
43
|
-
{ key: "2560x1440", width: 2560, height: 1440, notes: "1440p." },
|
|
44
|
-
{ key: "3840x2160", width: 3840, height: 2160, notes: "4K (up to 120Hz)." },
|
|
45
|
-
{ key: "7680x4320", width: 7680, height: 4320, notes: "8K (limited)." }
|
|
46
|
-
]
|
|
47
|
-
},
|
|
48
|
-
XboxOne: {
|
|
49
|
-
displayAspect: 1.7777777777777777,
|
|
50
|
-
resolutions: [
|
|
51
|
-
{ key: "1280x720", width: 1280, height: 720, notes: "720p (original)." },
|
|
52
|
-
{ key: "1920x1080", width: 1920, height: 1080, notes: "1080p (original)." },
|
|
53
|
-
{ key: "3840x2160", width: 3840, height: 2160, notes: "4K UHD (S/X models)." }
|
|
54
|
-
]
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
function h(e) {
|
|
58
|
-
return n[e].displayAspect;
|
|
59
|
-
}
|
|
60
|
-
function r(e, o) {
|
|
61
|
-
const t = n[e]?.resolutions || [];
|
|
62
|
-
if (!o)
|
|
63
|
-
return t[0];
|
|
64
|
-
const i = o.toLowerCase().replace(/\s+/g, "").replace("×", "x");
|
|
65
|
-
return t.find((s) => s.key.toLowerCase() === i);
|
|
66
|
-
}
|
|
67
|
-
function l(e) {
|
|
68
|
-
if (!e)
|
|
69
|
-
return null;
|
|
70
|
-
const t = String(e).toLowerCase().trim().replace(/\s+/g, "").replace("×", "x").match(/^(\d+)x(\d+)$/);
|
|
71
|
-
if (!t)
|
|
72
|
-
return null;
|
|
73
|
-
const i = parseInt(t[1], 10), s = parseInt(t[2], 10);
|
|
74
|
-
return !Number.isFinite(i) || !Number.isFinite(s) ? null : { width: i, height: s };
|
|
75
|
-
}
|
|
76
|
-
export {
|
|
77
|
-
h as getDisplayAspect,
|
|
78
|
-
r as getPresetResolution,
|
|
79
|
-
l as parseResolution
|
|
80
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { BaseGlobals } from './game-interfaces';
|
|
2
|
-
declare const state: {
|
|
3
|
-
id: string;
|
|
4
|
-
globals: BaseGlobals;
|
|
5
|
-
time: number;
|
|
6
|
-
};
|
|
7
|
-
export declare function setGlobalState<TGlobals extends BaseGlobals, K extends keyof TGlobals = keyof TGlobals>(key: K, value: TGlobals[K]): void;
|
|
8
|
-
export declare function getGlobalState<TGlobals extends BaseGlobals>(): TGlobals;
|
|
9
|
-
export declare function getGlobalState<TGlobals extends BaseGlobals, K extends keyof TGlobals = keyof TGlobals>(key: K): TGlobals[K];
|
|
10
|
-
export { state };
|
|
11
|
-
//# sourceMappingURL=game-state.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"game-state.d.ts","sourceRoot":"","sources":["../../../src/lib/game/game-state.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAc,MAAM,mBAAmB,CAAC;AAE5D,QAAA,MAAM,KAAK;;aAEK,WAAW;;CAEzB,CAAC;AAEH,wBAAgB,cAAc,CAC7B,QAAQ,SAAS,WAAW,EAC5B,CAAC,SAAS,MAAM,QAAQ,GAAG,MAAM,QAAQ,EACxC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;AAMpC,wBAAgB,cAAc,CAAC,QAAQ,SAAS,WAAW,KAAK,QAAQ,CAAC;AAEzE,wBAAgB,cAAc,CAC7B,QAAQ,SAAS,WAAW,EAC5B,CAAC,SAAS,MAAM,QAAQ,GAAG,MAAM,QAAQ,EACxC,GAAG,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;AASvB,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { proxy as a } from "valtio/vanilla";
|
|
2
|
-
const o = a({
|
|
3
|
-
id: "",
|
|
4
|
-
globals: {},
|
|
5
|
-
time: 0
|
|
6
|
-
});
|
|
7
|
-
function r(t, l) {
|
|
8
|
-
o.globals[t] = l;
|
|
9
|
-
}
|
|
10
|
-
function i(t) {
|
|
11
|
-
return t !== void 0 ? o.globals[t] : o.globals;
|
|
12
|
-
}
|
|
13
|
-
export {
|
|
14
|
-
i as getGlobalState,
|
|
15
|
-
r as setGlobalState,
|
|
16
|
-
o as state
|
|
17
|
-
};
|
package/dist/lib/game/game.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { ZylemGame } from './zylem-game';
|
|
2
|
-
import { DestroyFunction, IGame, SetupFunction, UpdateFunction } from '../core/base-node-life-cycle';
|
|
3
|
-
import { BaseGlobals } from './game-interfaces';
|
|
4
|
-
import { GameOptions } from '../core/utility/nodes';
|
|
5
|
-
export declare class Game<TGlobals extends BaseGlobals> implements IGame<TGlobals> {
|
|
6
|
-
private wrappedGame;
|
|
7
|
-
private pendingGlobalChangeHandlers;
|
|
8
|
-
options: GameOptions<TGlobals>;
|
|
9
|
-
update: UpdateFunction<ZylemGame<TGlobals>, TGlobals>;
|
|
10
|
-
setup: SetupFunction<ZylemGame<TGlobals>, TGlobals>;
|
|
11
|
-
destroy: DestroyFunction<ZylemGame<TGlobals>, TGlobals>;
|
|
12
|
-
refErrorMessage: string;
|
|
13
|
-
constructor(options: GameOptions<TGlobals>);
|
|
14
|
-
start(): Promise<this>;
|
|
15
|
-
private load;
|
|
16
|
-
setOverrides(): void;
|
|
17
|
-
pause(): Promise<void>;
|
|
18
|
-
resume(): Promise<void>;
|
|
19
|
-
reset(): Promise<void>;
|
|
20
|
-
nextStage(): Promise<void>;
|
|
21
|
-
previousStage(): Promise<void>;
|
|
22
|
-
goToStage(): Promise<void>;
|
|
23
|
-
end(): Promise<void>;
|
|
24
|
-
getGlobal<K extends keyof TGlobals>(key: K): TGlobals[K];
|
|
25
|
-
setGlobal<K extends keyof TGlobals>(key: K, value: TGlobals[K]): void;
|
|
26
|
-
onGlobalChange<K extends keyof TGlobals>(key: K, callback: (value: TGlobals[K]) => void): void;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* create a new game
|
|
30
|
-
* @param options GameOptions - Array of IGameOptions, Stage, GameEntity, or BaseNode objects
|
|
31
|
-
* @param options.id Game name string (when using IGameOptions)
|
|
32
|
-
* @param options.globals Game globals object (when using IGameOptions)
|
|
33
|
-
* @param options.stages Array of stage objects (when using IGameOptions)
|
|
34
|
-
* @returns Game
|
|
35
|
-
*/
|
|
36
|
-
export declare function createGame<TGlobals extends BaseGlobals>(...options: GameOptions<TGlobals>): Game<TGlobals>;
|
|
37
|
-
//# sourceMappingURL=game.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"game.d.ts","sourceRoot":"","sources":["../../../src/lib/game/game.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAErG,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAgB,WAAW,EAAa,MAAM,uBAAuB,CAAC;AAI7E,qBAAa,IAAI,CAAC,QAAQ,SAAS,WAAW,CAAE,YAAW,KAAK,CAAC,QAAQ,CAAC;IACzE,OAAO,CAAC,WAAW,CAAoC;IACvD,OAAO,CAAC,2BAA2B,CAAsE;IAEzG,OAAO,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAE/B,MAAM,EAAE,cAAc,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAa;IAClE,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAa;IAChE,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAa;IAEpE,eAAe,SAA4B;gBAE/B,OAAO,EAAE,WAAW,CAAC,QAAQ,CAAC;IAOpC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YAQd,IAAI;IAYlB,YAAY;IAgBN,KAAK;IAIL,MAAM;IAQN,KAAK;IAQL,SAAS;IAeT,aAAa;IAeb,SAAS;IAET,GAAG;IAET,SAAS,CAAC,CAAC,SAAS,MAAM,QAAQ,EAAE,GAAG,EAAE,CAAC;IAO1C,SAAS,CAAC,CAAC,SAAS,MAAM,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;IAQ9D,cAAc,CAAC,CAAC,SAAS,MAAM,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,IAAI;CAOvF;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,QAAQ,SAAS,WAAW,EAAE,GAAG,OAAO,EAAE,WAAW,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAE1G"}
|
package/dist/lib/game/game.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { ZylemGame as n } from "./zylem-game.js";
|
|
2
|
-
import { setPaused as o } from "../debug/debug-state.js";
|
|
3
|
-
import { getGlobalState as i, setGlobalState as p } from "./game-state.js";
|
|
4
|
-
import { hasStages as d, convertNodes as l } from "../core/utility/nodes.js";
|
|
5
|
-
import { resolveGameConfig as h } from "./game-config.js";
|
|
6
|
-
import { stage as g } from "../stage/stage.js";
|
|
7
|
-
class m {
|
|
8
|
-
wrappedGame = null;
|
|
9
|
-
pendingGlobalChangeHandlers = [];
|
|
10
|
-
options;
|
|
11
|
-
update = () => {
|
|
12
|
-
};
|
|
13
|
-
setup = () => {
|
|
14
|
-
};
|
|
15
|
-
destroy = () => {
|
|
16
|
-
};
|
|
17
|
-
refErrorMessage = "lost reference to game";
|
|
18
|
-
constructor(e) {
|
|
19
|
-
this.options = e, d(e) || this.options.push(g());
|
|
20
|
-
}
|
|
21
|
-
async start() {
|
|
22
|
-
const e = await this.load();
|
|
23
|
-
return this.wrappedGame = e, this.setOverrides(), e.start(), this;
|
|
24
|
-
}
|
|
25
|
-
async load() {
|
|
26
|
-
console.log("loading game", this.options);
|
|
27
|
-
const e = await l(this.options), a = h(e), t = new n({
|
|
28
|
-
...e,
|
|
29
|
-
...a
|
|
30
|
-
}, this);
|
|
31
|
-
return await t.loadStage(e.stages[0]), t;
|
|
32
|
-
}
|
|
33
|
-
setOverrides() {
|
|
34
|
-
if (!this.wrappedGame) {
|
|
35
|
-
console.error(this.refErrorMessage);
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
if (this.wrappedGame.customSetup = this.setup, this.wrappedGame.customUpdate = this.update, this.wrappedGame.customDestroy = this.destroy, this.pendingGlobalChangeHandlers.length) {
|
|
39
|
-
for (const { key: e, callback: a } of this.pendingGlobalChangeHandlers)
|
|
40
|
-
this.wrappedGame.onGlobalChange(e, a);
|
|
41
|
-
this.pendingGlobalChangeHandlers = [];
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
async pause() {
|
|
45
|
-
o(!0);
|
|
46
|
-
}
|
|
47
|
-
async resume() {
|
|
48
|
-
o(!1), this.wrappedGame && (this.wrappedGame.previousTimeStamp = 0, this.wrappedGame.timer.reset());
|
|
49
|
-
}
|
|
50
|
-
async reset() {
|
|
51
|
-
if (!this.wrappedGame) {
|
|
52
|
-
console.error(this.refErrorMessage);
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
await this.wrappedGame.loadStage(this.wrappedGame.stages[0]);
|
|
56
|
-
}
|
|
57
|
-
async nextStage() {
|
|
58
|
-
if (!this.wrappedGame) {
|
|
59
|
-
console.error(this.refErrorMessage);
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
const e = this.wrappedGame.currentStageId, a = this.wrappedGame.stages.findIndex((r) => r.wrappedStage.uuid === e), t = this.wrappedGame.stages[a + 1];
|
|
63
|
-
if (!t) {
|
|
64
|
-
console.error("next stage called on last stage");
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
await this.wrappedGame.loadStage(t);
|
|
68
|
-
}
|
|
69
|
-
async previousStage() {
|
|
70
|
-
if (!this.wrappedGame) {
|
|
71
|
-
console.error(this.refErrorMessage);
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
const e = this.wrappedGame.currentStageId, a = this.wrappedGame.stages.findIndex((r) => r.wrappedStage.uuid === e), t = this.wrappedGame.stages[a - 1];
|
|
75
|
-
if (!t) {
|
|
76
|
-
console.error("previous stage called on first stage");
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
await this.wrappedGame.loadStage(t);
|
|
80
|
-
}
|
|
81
|
-
async goToStage() {
|
|
82
|
-
}
|
|
83
|
-
async end() {
|
|
84
|
-
}
|
|
85
|
-
getGlobal(e) {
|
|
86
|
-
return this.wrappedGame ? this.wrappedGame.getGlobal(e) : i(e);
|
|
87
|
-
}
|
|
88
|
-
setGlobal(e, a) {
|
|
89
|
-
if (this.wrappedGame) {
|
|
90
|
-
this.wrappedGame.setGlobal(e, a);
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
p(e, a);
|
|
94
|
-
}
|
|
95
|
-
onGlobalChange(e, a) {
|
|
96
|
-
if (this.wrappedGame) {
|
|
97
|
-
this.wrappedGame.onGlobalChange(e, a);
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
this.pendingGlobalChangeHandlers.push({ key: e, callback: a });
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
function b(...s) {
|
|
104
|
-
return new m(s);
|
|
105
|
-
}
|
|
106
|
-
export {
|
|
107
|
-
m as Game,
|
|
108
|
-
b as createGame
|
|
109
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { Game } from './game';
|
|
2
|
-
import { UpdateContext, SetupContext, DestroyContext } from '../core/base-node-life-cycle';
|
|
3
|
-
import { InputManager } from '../input/input-manager';
|
|
4
|
-
import { Timer } from '../core/three-addons/Timer';
|
|
5
|
-
import { ZylemCamera } from '~/lib/camera/zylem-camera';
|
|
6
|
-
import { Stage } from '../stage/stage';
|
|
7
|
-
import { BaseGlobals, ZylemGameConfig } from './game-interfaces';
|
|
8
|
-
import { GameConfig } from './game-config';
|
|
9
|
-
import { AspectRatioDelegate } from '../device/aspect-ratio';
|
|
10
|
-
import { GameCanvas } from './game-canvas';
|
|
11
|
-
type ZylemGameOptions<TGlobals extends BaseGlobals> = ZylemGameConfig<Stage, ZylemGame<TGlobals>, TGlobals> & Partial<GameConfig>;
|
|
12
|
-
export declare class ZylemGame<TGlobals extends BaseGlobals> {
|
|
13
|
-
id: string;
|
|
14
|
-
initialGlobals: TGlobals;
|
|
15
|
-
customSetup: ((params: SetupContext<ZylemGame<TGlobals>, TGlobals>) => void) | null;
|
|
16
|
-
customUpdate: ((params: UpdateContext<ZylemGame<TGlobals>, TGlobals>) => void) | null;
|
|
17
|
-
customDestroy: ((params: DestroyContext<ZylemGame<TGlobals>, TGlobals>) => void) | null;
|
|
18
|
-
stages: Stage[];
|
|
19
|
-
stageMap: Map<string, Stage>;
|
|
20
|
-
currentStageId: string;
|
|
21
|
-
previousTimeStamp: number;
|
|
22
|
-
totalTime: number;
|
|
23
|
-
timer: Timer;
|
|
24
|
-
inputManager: InputManager;
|
|
25
|
-
wrapperRef: Game<TGlobals>;
|
|
26
|
-
statsRef: {
|
|
27
|
-
begin: () => void;
|
|
28
|
-
end: () => void;
|
|
29
|
-
showPanel: (panel: number) => void;
|
|
30
|
-
dom: HTMLElement;
|
|
31
|
-
} | null;
|
|
32
|
-
defaultCamera: ZylemCamera | null;
|
|
33
|
-
container: HTMLElement | null;
|
|
34
|
-
canvas: HTMLCanvasElement | null;
|
|
35
|
-
aspectRatioDelegate: AspectRatioDelegate | null;
|
|
36
|
-
resolvedConfig: GameConfig | null;
|
|
37
|
-
gameCanvas: GameCanvas | null;
|
|
38
|
-
static FRAME_LIMIT: number;
|
|
39
|
-
static FRAME_DURATION: number;
|
|
40
|
-
static MAX_DELTA_SECONDS: number;
|
|
41
|
-
constructor(options: ZylemGameOptions<TGlobals>, wrapperRef: Game<TGlobals>);
|
|
42
|
-
loadGameCanvas(config: GameConfig): void;
|
|
43
|
-
loadDebugOptions(options: ZylemGameOptions<TGlobals>): void;
|
|
44
|
-
loadStage(stage: Stage): Promise<void>;
|
|
45
|
-
unloadCurrentStage(): void;
|
|
46
|
-
setGlobals(options: ZylemGameConfig<Stage, ZylemGame<TGlobals>, TGlobals>): void;
|
|
47
|
-
params(): UpdateContext<ZylemGame<TGlobals>, TGlobals>;
|
|
48
|
-
start(): void;
|
|
49
|
-
loop(timestamp: number): void;
|
|
50
|
-
outOfLoop(): void;
|
|
51
|
-
getStage(id: string): Stage | undefined;
|
|
52
|
-
currentStage(): Stage | undefined;
|
|
53
|
-
getGlobal<K extends keyof TGlobals>(key: K): TGlobals[K];
|
|
54
|
-
setGlobal<K extends keyof TGlobals>(key: K, value: TGlobals[K]): void;
|
|
55
|
-
onGlobalChange<K extends keyof TGlobals>(key: K, callback: (value: TGlobals[K]) => void): void;
|
|
56
|
-
}
|
|
57
|
-
export {};
|
|
58
|
-
//# sourceMappingURL=zylem-game.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zylem-game.d.ts","sourceRoot":"","sources":["../../../src/lib/game/zylem-game.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { state as o, getGlobalState as r, setGlobalState as d } from "./game-state.js";
|
|
2
|
-
import { setDebugFlag as h, isPaused as m } from "../debug/debug-state.js";
|
|
3
|
-
import { InputManager as c } from "../input/input-manager.js";
|
|
4
|
-
import { Timer as p } from "../core/three-addons/Timer.js";
|
|
5
|
-
import { resolveGameConfig as g } from "./game-config.js";
|
|
6
|
-
import { GameCanvas as f } from "./game-canvas.js";
|
|
7
|
-
import { subscribe as S } from "valtio/vanilla";
|
|
8
|
-
import b from "stats.js";
|
|
9
|
-
class n {
|
|
10
|
-
id;
|
|
11
|
-
initialGlobals = {};
|
|
12
|
-
customSetup = null;
|
|
13
|
-
customUpdate = null;
|
|
14
|
-
customDestroy = null;
|
|
15
|
-
stages = [];
|
|
16
|
-
stageMap = /* @__PURE__ */ new Map();
|
|
17
|
-
currentStageId = "";
|
|
18
|
-
previousTimeStamp = 0;
|
|
19
|
-
totalTime = 0;
|
|
20
|
-
timer;
|
|
21
|
-
inputManager;
|
|
22
|
-
wrapperRef;
|
|
23
|
-
statsRef = null;
|
|
24
|
-
defaultCamera = null;
|
|
25
|
-
container = null;
|
|
26
|
-
canvas = null;
|
|
27
|
-
aspectRatioDelegate = null;
|
|
28
|
-
resolvedConfig = null;
|
|
29
|
-
gameCanvas = null;
|
|
30
|
-
static FRAME_LIMIT = 120;
|
|
31
|
-
static FRAME_DURATION = 1e3 / n.FRAME_LIMIT;
|
|
32
|
-
static MAX_DELTA_SECONDS = 1 / 30;
|
|
33
|
-
constructor(t, e) {
|
|
34
|
-
this.wrapperRef = e, this.inputManager = new c(t.input), this.timer = new p(), this.timer.connect(document);
|
|
35
|
-
const a = g(t);
|
|
36
|
-
this.id = a.id, this.stages = a.stages || [], this.container = a.container, this.canvas = a.canvas ?? null, this.resolvedConfig = a, this.loadGameCanvas(a), this.loadDebugOptions(t), this.setGlobals(t);
|
|
37
|
-
}
|
|
38
|
-
loadGameCanvas(t) {
|
|
39
|
-
this.gameCanvas = new f({
|
|
40
|
-
id: t.id,
|
|
41
|
-
container: t.container,
|
|
42
|
-
containerId: t.containerId,
|
|
43
|
-
canvas: this.canvas ?? void 0,
|
|
44
|
-
bodyBackground: t.bodyBackground,
|
|
45
|
-
fullscreen: t.fullscreen,
|
|
46
|
-
aspectRatio: t.aspectRatio
|
|
47
|
-
}), this.gameCanvas.applyBodyBackground(), this.gameCanvas.mountCanvas(), this.gameCanvas.centerIfFullscreen();
|
|
48
|
-
}
|
|
49
|
-
loadDebugOptions(t) {
|
|
50
|
-
h(!!t.debug), t.debug && (this.statsRef = new b(), this.statsRef.showPanel(0), this.statsRef.dom.style.position = "absolute", this.statsRef.dom.style.bottom = "0", this.statsRef.dom.style.right = "0", this.statsRef.dom.style.top = "auto", this.statsRef.dom.style.left = "auto", document.body.appendChild(this.statsRef.dom));
|
|
51
|
-
}
|
|
52
|
-
async loadStage(t) {
|
|
53
|
-
this.unloadCurrentStage();
|
|
54
|
-
const e = t.options[0];
|
|
55
|
-
if (await t.load(this.id, e?.camera), this.stageMap.set(t.wrappedStage.uuid, t), this.currentStageId = t.wrappedStage.uuid, this.defaultCamera = t.wrappedStage.cameraRef, this.container && this.defaultCamera) {
|
|
56
|
-
const a = this.defaultCamera.getDomElement(), s = this.resolvedConfig?.internalResolution;
|
|
57
|
-
this.gameCanvas?.mountRenderer(a, (i, l) => {
|
|
58
|
-
if (this.defaultCamera)
|
|
59
|
-
if (s)
|
|
60
|
-
this.defaultCamera.setPixelRatio(1), this.defaultCamera.resize(s.width, s.height);
|
|
61
|
-
else {
|
|
62
|
-
const u = window.devicePixelRatio || 1;
|
|
63
|
-
this.defaultCamera.setPixelRatio(u), this.defaultCamera.resize(i, l);
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
unloadCurrentStage() {
|
|
69
|
-
if (!this.currentStageId)
|
|
70
|
-
return;
|
|
71
|
-
const t = this.getStage(this.currentStageId);
|
|
72
|
-
if (t) {
|
|
73
|
-
if (t?.wrappedStage)
|
|
74
|
-
try {
|
|
75
|
-
t.wrappedStage.nodeDestroy({
|
|
76
|
-
me: t.wrappedStage,
|
|
77
|
-
globals: o.globals
|
|
78
|
-
});
|
|
79
|
-
} catch (e) {
|
|
80
|
-
console.error("Failed to destroy previous stage", e);
|
|
81
|
-
}
|
|
82
|
-
this.stageMap.delete(this.currentStageId);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
setGlobals(t) {
|
|
86
|
-
this.initialGlobals = { ...t.globals };
|
|
87
|
-
for (const e in this.initialGlobals) {
|
|
88
|
-
const a = this.initialGlobals[e];
|
|
89
|
-
a === void 0 && console.error(`global ${e} is undefined`), this.setGlobal(e, a);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
params() {
|
|
93
|
-
const t = this.currentStage(), e = this.timer.getDelta(), a = this.inputManager.getInputs(e), s = t?.wrappedStage?.cameraRef || this.defaultCamera;
|
|
94
|
-
return {
|
|
95
|
-
delta: e,
|
|
96
|
-
inputs: a,
|
|
97
|
-
globals: o.globals,
|
|
98
|
-
me: this,
|
|
99
|
-
camera: s
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
start() {
|
|
103
|
-
const t = this.currentStage(), e = this.params();
|
|
104
|
-
t.start({ ...e, me: t.wrappedStage }), this.customSetup && this.customSetup(e), this.loop(0);
|
|
105
|
-
}
|
|
106
|
-
loop(t) {
|
|
107
|
-
if (this.statsRef && this.statsRef.begin(), !m()) {
|
|
108
|
-
this.timer.update(t);
|
|
109
|
-
const e = this.currentStage(), a = this.params(), s = Math.min(a.delta, n.MAX_DELTA_SECONDS), i = { ...a, delta: s };
|
|
110
|
-
this.customUpdate && this.customUpdate(i), e && e.wrappedStage.nodeUpdate({ ...i, me: e.wrappedStage }), this.totalTime += i.delta, o.time = this.totalTime, this.previousTimeStamp = t;
|
|
111
|
-
}
|
|
112
|
-
this.statsRef && this.statsRef.end(), this.outOfLoop(), requestAnimationFrame(this.loop.bind(this));
|
|
113
|
-
}
|
|
114
|
-
outOfLoop() {
|
|
115
|
-
const t = this.currentStage();
|
|
116
|
-
t && t.wrappedStage.outOfLoop();
|
|
117
|
-
}
|
|
118
|
-
getStage(t) {
|
|
119
|
-
return this.stageMap.get(t);
|
|
120
|
-
}
|
|
121
|
-
currentStage() {
|
|
122
|
-
return this.getStage(this.currentStageId);
|
|
123
|
-
}
|
|
124
|
-
getGlobal(t) {
|
|
125
|
-
return r(t);
|
|
126
|
-
}
|
|
127
|
-
setGlobal(t, e) {
|
|
128
|
-
d(t, e);
|
|
129
|
-
}
|
|
130
|
-
onGlobalChange(t, e) {
|
|
131
|
-
let a = r(t);
|
|
132
|
-
S(o, () => {
|
|
133
|
-
const s = r(t);
|
|
134
|
-
s !== a && (a = s, e(s));
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
export {
|
|
139
|
-
n as ZylemGame
|
|
140
|
-
};
|