@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,118 +0,0 @@
|
|
|
1
|
-
import { ColliderDesc as h } from "@dimforge/rapier3d-compat";
|
|
2
|
-
import { Color as d, Vector3 as c, TextureLoader as f, SpriteMaterial as y, Sprite as A, Group as x, Quaternion as S, Euler as I } from "three";
|
|
3
|
-
import { GameEntity as w } from "./entity.js";
|
|
4
|
-
import { EntityCollisionBuilder as z, EntityBuilder as E } from "./builder.js";
|
|
5
|
-
import { createEntity as g } from "./create.js";
|
|
6
|
-
const l = {
|
|
7
|
-
size: new c(1, 1, 1),
|
|
8
|
-
position: new c(0, 0, 0),
|
|
9
|
-
collision: {
|
|
10
|
-
static: !1
|
|
11
|
-
},
|
|
12
|
-
material: {
|
|
13
|
-
color: new d("#ffffff"),
|
|
14
|
-
shader: "standard"
|
|
15
|
-
},
|
|
16
|
-
images: [],
|
|
17
|
-
animations: []
|
|
18
|
-
};
|
|
19
|
-
class C extends z {
|
|
20
|
-
collider(t) {
|
|
21
|
-
const i = t.collisionSize || t.size || new c(1, 1, 1), e = { x: i.x / 2, y: i.y / 2, z: i.z / 2 };
|
|
22
|
-
return h.cuboid(e.x, e.y, e.z);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
class T extends E {
|
|
26
|
-
createEntity(t) {
|
|
27
|
-
return new p(t);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
const b = Symbol("Sprite");
|
|
31
|
-
class p extends w {
|
|
32
|
-
static type = b;
|
|
33
|
-
sprites = [];
|
|
34
|
-
spriteMap = /* @__PURE__ */ new Map();
|
|
35
|
-
currentSpriteIndex = 0;
|
|
36
|
-
animations = /* @__PURE__ */ new Map();
|
|
37
|
-
currentAnimation = null;
|
|
38
|
-
currentAnimationFrame = "";
|
|
39
|
-
currentAnimationIndex = 0;
|
|
40
|
-
currentAnimationTime = 0;
|
|
41
|
-
constructor(t) {
|
|
42
|
-
super(), this.options = { ...l, ...t }, this.createSpritesFromImages(t?.images || []), this.createAnimations(t?.animations || []), this.lifeCycleDelegate = {
|
|
43
|
-
update: [this.spriteUpdate.bind(this)],
|
|
44
|
-
destroy: [this.spriteDestroy.bind(this)]
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
createSpritesFromImages(t) {
|
|
48
|
-
const i = new f();
|
|
49
|
-
t.forEach((e, n) => {
|
|
50
|
-
const r = i.load(e.file), s = new y({
|
|
51
|
-
map: r,
|
|
52
|
-
transparent: !0
|
|
53
|
-
}), a = new A(s);
|
|
54
|
-
a.position.normalize(), this.sprites.push(a), this.spriteMap.set(e.name, n);
|
|
55
|
-
}), this.group = new x(), this.group.add(...this.sprites);
|
|
56
|
-
}
|
|
57
|
-
createAnimations(t) {
|
|
58
|
-
t.forEach((i) => {
|
|
59
|
-
const { name: e, frames: n, loop: r = !1, speed: s = 1 } = i, a = {
|
|
60
|
-
frames: n.map((u, m) => ({
|
|
61
|
-
key: u,
|
|
62
|
-
index: m,
|
|
63
|
-
time: (typeof s == "number" ? s : s[m]) * (m + 1),
|
|
64
|
-
duration: typeof s == "number" ? s : s[m]
|
|
65
|
-
})),
|
|
66
|
-
loop: r
|
|
67
|
-
};
|
|
68
|
-
this.animations.set(e, a);
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
setSprite(t) {
|
|
72
|
-
const e = this.spriteMap.get(t) ?? 0;
|
|
73
|
-
this.currentSpriteIndex = e, this.sprites.forEach((n, r) => {
|
|
74
|
-
n.visible = this.currentSpriteIndex === r;
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
setAnimation(t, i) {
|
|
78
|
-
const e = this.animations.get(t);
|
|
79
|
-
if (!e)
|
|
80
|
-
return;
|
|
81
|
-
const { loop: n, frames: r } = e, s = r[this.currentAnimationIndex];
|
|
82
|
-
t === this.currentAnimation ? (this.currentAnimationFrame = s.key, this.currentAnimationTime += i, this.setSprite(this.currentAnimationFrame)) : this.currentAnimation = t, this.currentAnimationTime > s.time && this.currentAnimationIndex++, this.currentAnimationIndex >= r.length && (n ? (this.currentAnimationIndex = 0, this.currentAnimationTime = 0) : this.currentAnimationTime = r[this.currentAnimationIndex].time);
|
|
83
|
-
}
|
|
84
|
-
async spriteUpdate(t) {
|
|
85
|
-
this.sprites.forEach((i) => {
|
|
86
|
-
if (i.material) {
|
|
87
|
-
const e = this.body?.rotation();
|
|
88
|
-
if (e) {
|
|
89
|
-
const n = new S(e.x, e.y, e.z, e.w), r = new I().setFromQuaternion(n, "XYZ");
|
|
90
|
-
i.material.rotation = r.z;
|
|
91
|
-
}
|
|
92
|
-
i.scale.set(this.options.size?.x ?? 1, this.options.size?.y ?? 1, this.options.size?.z ?? 1);
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
async spriteDestroy(t) {
|
|
97
|
-
this.sprites.forEach((i) => {
|
|
98
|
-
i.removeFromParent();
|
|
99
|
-
}), this.group?.remove(...this.sprites), this.group?.removeFromParent();
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
async function P(...o) {
|
|
103
|
-
return g({
|
|
104
|
-
args: o,
|
|
105
|
-
defaultConfig: l,
|
|
106
|
-
EntityClass: p,
|
|
107
|
-
BuilderClass: T,
|
|
108
|
-
CollisionBuilderClass: C,
|
|
109
|
-
entityType: p.type
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
export {
|
|
113
|
-
b as SPRITE_TYPE,
|
|
114
|
-
T as SpriteBuilder,
|
|
115
|
-
C as SpriteCollisionBuilder,
|
|
116
|
-
p as ZylemSprite,
|
|
117
|
-
P as sprite
|
|
118
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { Color, Vector2 } from 'three';
|
|
2
|
-
import { BaseNode } from '../core/base-node';
|
|
3
|
-
import { GameEntityOptions, GameEntity } from './entity';
|
|
4
|
-
import { EntityBuilder } from './builder';
|
|
5
|
-
type ZylemTextOptions = GameEntityOptions & {
|
|
6
|
-
text?: string;
|
|
7
|
-
fontFamily?: string;
|
|
8
|
-
fontSize?: number;
|
|
9
|
-
fontColor?: Color | string;
|
|
10
|
-
backgroundColor?: Color | string | null;
|
|
11
|
-
padding?: number;
|
|
12
|
-
stickToViewport?: boolean;
|
|
13
|
-
screenPosition?: Vector2;
|
|
14
|
-
zDistance?: number;
|
|
15
|
-
};
|
|
16
|
-
export declare class TextBuilder extends EntityBuilder<ZylemText, ZylemTextOptions> {
|
|
17
|
-
protected createEntity(options: Partial<ZylemTextOptions>): ZylemText;
|
|
18
|
-
}
|
|
19
|
-
export declare const TEXT_TYPE: unique symbol;
|
|
20
|
-
export declare class ZylemText extends GameEntity<ZylemTextOptions> {
|
|
21
|
-
static type: symbol;
|
|
22
|
-
private _sprite;
|
|
23
|
-
private _texture;
|
|
24
|
-
private _canvas;
|
|
25
|
-
private _ctx;
|
|
26
|
-
private _cameraRef;
|
|
27
|
-
private _lastCanvasW;
|
|
28
|
-
private _lastCanvasH;
|
|
29
|
-
constructor(options?: ZylemTextOptions);
|
|
30
|
-
private createSprite;
|
|
31
|
-
private measureAndResizeCanvas;
|
|
32
|
-
private drawCenteredText;
|
|
33
|
-
private updateTexture;
|
|
34
|
-
private redrawText;
|
|
35
|
-
private toCssColor;
|
|
36
|
-
private textSetup;
|
|
37
|
-
private textUpdate;
|
|
38
|
-
private getResolution;
|
|
39
|
-
private getScreenPixels;
|
|
40
|
-
private computeWorldExtents;
|
|
41
|
-
private updateSpriteScale;
|
|
42
|
-
private updateStickyTransform;
|
|
43
|
-
updateText(_text: string): void;
|
|
44
|
-
buildInfo(): Record<string, any>;
|
|
45
|
-
}
|
|
46
|
-
type TextOptions = BaseNode | Partial<ZylemTextOptions>;
|
|
47
|
-
export declare function text(...args: Array<TextOptions>): Promise<ZylemText>;
|
|
48
|
-
export {};
|
|
49
|
-
//# sourceMappingURL=text.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/lib/entities/text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAA6E,OAAO,EAA8D,MAAM,OAAO,CAAC;AAC9K,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAM1C,KAAK,gBAAgB,GAAG,iBAAiB,GAAG;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAC3B,eAAe,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,CAAC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAeF,qBAAa,WAAY,SAAQ,aAAa,CAAC,SAAS,EAAE,gBAAgB,CAAC;IAC1E,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,SAAS;CAGrE;AAED,eAAO,MAAM,SAAS,eAAiB,CAAC;AAExC,qBAAa,SAAU,SAAQ,UAAU,CAAC,gBAAgB,CAAC;IAC1D,MAAM,CAAC,IAAI,SAAa;IAExB,OAAO,CAAC,OAAO,CAA4B;IAC3C,OAAO,CAAC,QAAQ,CAA8B;IAC9C,OAAO,CAAC,OAAO,CAAkC;IACjD,OAAO,CAAC,IAAI,CAAyC;IACrD,OAAO,CAAC,UAAU,CAA4B;IAC9C,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,YAAY,CAAa;gBAErB,OAAO,CAAC,EAAE,gBAAgB;IAWtC,OAAO,CAAC,YAAY;IAkBpB,OAAO,CAAC,sBAAsB;IAgB9B,OAAO,CAAC,gBAAgB;IAcxB,OAAO,CAAC,aAAa;IAkBrB,OAAO,CAAC,UAAU;IAelB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,SAAS;IAQjB,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,mBAAmB;IAiB3B,OAAO,CAAC,iBAAiB;IAWzB,OAAO,CAAC,qBAAqB;IAiB7B,UAAU,CAAC,KAAK,EAAE,MAAM;IAQxB,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAWhC;AAED,KAAK,WAAW,GAAG,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAExD,wBAAsB,IAAI,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,CAQ1E"}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { Vector2 as m, Group as v, CanvasTexture as d, LinearFilter as l, SpriteMaterial as y, Sprite as T, ClampToEdgeWrapping as _, Color as f } from "three";
|
|
2
|
-
import { GameEntity as S } from "./entity.js";
|
|
3
|
-
import { EntityBuilder as F } from "./builder.js";
|
|
4
|
-
import { createEntity as R } from "./create.js";
|
|
5
|
-
import { DebugDelegate as H } from "./delegates/debug.js";
|
|
6
|
-
const u = {
|
|
7
|
-
position: void 0,
|
|
8
|
-
text: "",
|
|
9
|
-
fontFamily: 'Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',
|
|
10
|
-
fontSize: 18,
|
|
11
|
-
fontColor: "#FFFFFF",
|
|
12
|
-
backgroundColor: null,
|
|
13
|
-
padding: 4,
|
|
14
|
-
stickToViewport: !0,
|
|
15
|
-
screenPosition: new m(24, 24),
|
|
16
|
-
zDistance: 1
|
|
17
|
-
};
|
|
18
|
-
class k extends F {
|
|
19
|
-
createEntity(t) {
|
|
20
|
-
return new c(t);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
const b = Symbol("Text");
|
|
24
|
-
class c extends S {
|
|
25
|
-
static type = b;
|
|
26
|
-
_sprite = null;
|
|
27
|
-
_texture = null;
|
|
28
|
-
_canvas = null;
|
|
29
|
-
_ctx = null;
|
|
30
|
-
_cameraRef = null;
|
|
31
|
-
_lastCanvasW = 0;
|
|
32
|
-
_lastCanvasH = 0;
|
|
33
|
-
constructor(t) {
|
|
34
|
-
super(), this.options = { ...u, ...t }, this.group = new v(), this.createSprite(), this.lifeCycleDelegate = {
|
|
35
|
-
setup: [this.textSetup.bind(this)],
|
|
36
|
-
update: [this.textUpdate.bind(this)]
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
createSprite() {
|
|
40
|
-
this._canvas = document.createElement("canvas"), this._ctx = this._canvas.getContext("2d"), this._texture = new d(this._canvas), this._texture.minFilter = l, this._texture.magFilter = l;
|
|
41
|
-
const t = new y({
|
|
42
|
-
map: this._texture,
|
|
43
|
-
transparent: !0,
|
|
44
|
-
depthTest: !1,
|
|
45
|
-
depthWrite: !1,
|
|
46
|
-
alphaTest: 0.5
|
|
47
|
-
});
|
|
48
|
-
this._sprite = new T(t), this.group?.add(this._sprite), this.redrawText(this.options.text ?? "");
|
|
49
|
-
}
|
|
50
|
-
measureAndResizeCanvas(t, e, s, a) {
|
|
51
|
-
if (!this._canvas || !this._ctx)
|
|
52
|
-
return { sizeChanged: !1 };
|
|
53
|
-
this._ctx.font = `${e}px ${s}`;
|
|
54
|
-
const i = this._ctx.measureText(t), n = Math.ceil(i.width), r = Math.ceil(e * 1.4), o = Math.max(2, n + a * 2), h = Math.max(2, r + a * 2), p = o !== this._lastCanvasW || h !== this._lastCanvasH;
|
|
55
|
-
return this._canvas.width = o, this._canvas.height = h, this._lastCanvasW = o, this._lastCanvasH = h, { sizeChanged: p };
|
|
56
|
-
}
|
|
57
|
-
drawCenteredText(t, e, s) {
|
|
58
|
-
!this._canvas || !this._ctx || (this._ctx.font = `${e}px ${s}`, this._ctx.textAlign = "center", this._ctx.textBaseline = "middle", this._ctx.clearRect(0, 0, this._canvas.width, this._canvas.height), this.options.backgroundColor && (this._ctx.fillStyle = this.toCssColor(this.options.backgroundColor), this._ctx.fillRect(0, 0, this._canvas.width, this._canvas.height)), this._ctx.fillStyle = this.toCssColor(this.options.fontColor ?? "#FFFFFF"), this._ctx.fillText(t, this._canvas.width / 2, this._canvas.height / 2));
|
|
59
|
-
}
|
|
60
|
-
updateTexture(t) {
|
|
61
|
-
!this._texture || !this._canvas || (t && (this._texture.dispose(), this._texture = new d(this._canvas), this._texture.minFilter = l, this._texture.magFilter = l, this._texture.wrapS = _, this._texture.wrapT = _), this._texture.image = this._canvas, this._texture.needsUpdate = !0, this._sprite && this._sprite.material && (this._sprite.material.map = this._texture, this._sprite.material.needsUpdate = !0));
|
|
62
|
-
}
|
|
63
|
-
redrawText(t) {
|
|
64
|
-
if (!this._canvas || !this._ctx)
|
|
65
|
-
return;
|
|
66
|
-
const e = this.options.fontSize ?? 18, s = this.options.fontFamily ?? u.fontFamily, a = this.options.padding ?? 4, { sizeChanged: i } = this.measureAndResizeCanvas(t, e, s, a);
|
|
67
|
-
this.drawCenteredText(t, e, s), this.updateTexture(!!i), this.options.stickToViewport && this._cameraRef && this.updateStickyTransform();
|
|
68
|
-
}
|
|
69
|
-
toCssColor(t) {
|
|
70
|
-
return typeof t == "string" ? t : `#${(t instanceof f ? t : new f(t)).getHexString()}`;
|
|
71
|
-
}
|
|
72
|
-
textSetup(t) {
|
|
73
|
-
this._cameraRef = t.camera, this.options.stickToViewport && this._cameraRef && (this._cameraRef.camera.add(this.group), this.updateStickyTransform());
|
|
74
|
-
}
|
|
75
|
-
textUpdate(t) {
|
|
76
|
-
this._sprite && this.options.stickToViewport && this._cameraRef && this.updateStickyTransform();
|
|
77
|
-
}
|
|
78
|
-
getResolution() {
|
|
79
|
-
return {
|
|
80
|
-
width: this._cameraRef?.screenResolution.x ?? 1,
|
|
81
|
-
height: this._cameraRef?.screenResolution.y ?? 1
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
getScreenPixels(t, e, s) {
|
|
85
|
-
const a = t.x >= 0 && t.x <= 1, i = t.y >= 0 && t.y <= 1;
|
|
86
|
-
return {
|
|
87
|
-
px: a ? t.x * e : t.x,
|
|
88
|
-
py: i ? t.y * s : t.y
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
computeWorldExtents(t, e) {
|
|
92
|
-
let s = 1, a = 1;
|
|
93
|
-
if (t.isPerspectiveCamera) {
|
|
94
|
-
const i = t, n = Math.tan(i.fov * Math.PI / 180 / 2) * e;
|
|
95
|
-
s = n * i.aspect, a = n;
|
|
96
|
-
} else if (t.isOrthographicCamera) {
|
|
97
|
-
const i = t;
|
|
98
|
-
s = (i.right - i.left) / 2, a = (i.top - i.bottom) / 2;
|
|
99
|
-
}
|
|
100
|
-
return { worldHalfW: s, worldHalfH: a };
|
|
101
|
-
}
|
|
102
|
-
updateSpriteScale(t, e) {
|
|
103
|
-
if (!this._canvas || !this._sprite)
|
|
104
|
-
return;
|
|
105
|
-
const a = t * 2 / e, i = this._canvas.height, n = Math.max(1e-4, i * a), r = this._canvas.width / this._canvas.height, o = n * r;
|
|
106
|
-
this._sprite.scale.set(o, n, 1);
|
|
107
|
-
}
|
|
108
|
-
updateStickyTransform() {
|
|
109
|
-
if (!this._sprite || !this._cameraRef)
|
|
110
|
-
return;
|
|
111
|
-
const t = this._cameraRef.camera, { width: e, height: s } = this.getResolution(), a = this.options.screenPosition ?? new m(24, 24), { px: i, py: n } = this.getScreenPixels(a, e, s), r = Math.max(1e-3, this.options.zDistance ?? 1), { worldHalfW: o, worldHalfH: h } = this.computeWorldExtents(t, r), p = i / e * 2 - 1, g = 1 - n / s * 2, w = p * o, C = g * h;
|
|
112
|
-
this.group?.position.set(w, C, -r), this.updateSpriteScale(h, s);
|
|
113
|
-
}
|
|
114
|
-
updateText(t) {
|
|
115
|
-
this.options.text = t, this.redrawText(t), this.options.stickToViewport && this._cameraRef && this.updateStickyTransform();
|
|
116
|
-
}
|
|
117
|
-
buildInfo() {
|
|
118
|
-
return {
|
|
119
|
-
...new H(this).buildDebugInfo(),
|
|
120
|
-
type: String(c.type),
|
|
121
|
-
text: this.options.text ?? "",
|
|
122
|
-
sticky: this.options.stickToViewport
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
async function D(...x) {
|
|
127
|
-
return R({
|
|
128
|
-
args: x,
|
|
129
|
-
defaultConfig: { ...u },
|
|
130
|
-
EntityClass: c,
|
|
131
|
-
BuilderClass: k,
|
|
132
|
-
entityType: c.type
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
export {
|
|
136
|
-
b as TEXT_TYPE,
|
|
137
|
-
k as TextBuilder,
|
|
138
|
-
c as ZylemText,
|
|
139
|
-
D as text
|
|
140
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { ColliderDesc } from '@dimforge/rapier3d-compat';
|
|
2
|
-
import { Vector3 } from 'three';
|
|
3
|
-
import { BaseNode } from '../core/base-node';
|
|
4
|
-
import { GameEntityOptions, GameEntity } from './entity';
|
|
5
|
-
import { EntityBuilder } from './builder';
|
|
6
|
-
import { EntityCollisionBuilder } from './builder';
|
|
7
|
-
import { CollisionHandlerDelegate } from '../collision/collision-delegate';
|
|
8
|
-
export type OnHeldParams = {
|
|
9
|
-
delta: number;
|
|
10
|
-
self: ZylemZone;
|
|
11
|
-
visitor: GameEntity<any>;
|
|
12
|
-
heldTime: number;
|
|
13
|
-
globals: any;
|
|
14
|
-
};
|
|
15
|
-
export type OnEnterParams = Pick<OnHeldParams, 'self' | 'visitor' | 'globals'>;
|
|
16
|
-
export type OnExitParams = Pick<OnHeldParams, 'self' | 'visitor' | 'globals'>;
|
|
17
|
-
type ZylemZoneOptions = GameEntityOptions & {
|
|
18
|
-
size?: Vector3;
|
|
19
|
-
static?: boolean;
|
|
20
|
-
onEnter?: (params: OnEnterParams) => void;
|
|
21
|
-
onHeld?: (params: OnHeldParams) => void;
|
|
22
|
-
onExit?: (params: OnExitParams) => void;
|
|
23
|
-
};
|
|
24
|
-
export declare class ZoneCollisionBuilder extends EntityCollisionBuilder {
|
|
25
|
-
collider(options: ZylemZoneOptions): ColliderDesc;
|
|
26
|
-
}
|
|
27
|
-
export declare class ZoneBuilder extends EntityBuilder<ZylemZone, ZylemZoneOptions> {
|
|
28
|
-
protected createEntity(options: Partial<ZylemZoneOptions>): ZylemZone;
|
|
29
|
-
}
|
|
30
|
-
export declare const ZONE_TYPE: unique symbol;
|
|
31
|
-
export declare class ZylemZone extends GameEntity<ZylemZoneOptions> implements CollisionHandlerDelegate {
|
|
32
|
-
static type: symbol;
|
|
33
|
-
private _enteredZone;
|
|
34
|
-
private _exitedZone;
|
|
35
|
-
private _zoneEntities;
|
|
36
|
-
constructor(options?: ZylemZoneOptions);
|
|
37
|
-
handlePostCollision({ delta }: {
|
|
38
|
-
delta: number;
|
|
39
|
-
}): boolean;
|
|
40
|
-
handleIntersectionEvent({ other, delta }: {
|
|
41
|
-
other: any;
|
|
42
|
-
delta: number;
|
|
43
|
-
}): void;
|
|
44
|
-
onEnter(callback: (params: OnEnterParams) => void): this;
|
|
45
|
-
onHeld(callback: (params: OnHeldParams) => void): this;
|
|
46
|
-
onExit(callback: (params: OnExitParams) => void): this;
|
|
47
|
-
entered(other: any): void;
|
|
48
|
-
exited(delta: number, key: string): void;
|
|
49
|
-
held(delta: number, other: any): void;
|
|
50
|
-
}
|
|
51
|
-
type ZoneOptions = BaseNode | Partial<ZylemZoneOptions>;
|
|
52
|
-
export declare function zone(...args: Array<ZoneOptions>): Promise<ZylemZone>;
|
|
53
|
-
export {};
|
|
54
|
-
//# sourceMappingURL=zone.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zone.d.ts","sourceRoot":"","sources":["../../../src/lib/entities/zone.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAG3E,MAAM,MAAM,YAAY,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,GAAG,CAAC;CACb,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC,CAAC;AAC/E,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC,CAAC;AAE9E,KAAK,gBAAgB,GAAG,iBAAiB,GAAG;IAC3C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;IAC1C,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IACxC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;CACxC,CAAC;AAaF,qBAAa,oBAAqB,SAAQ,sBAAsB;IAC/D,QAAQ,CAAC,OAAO,EAAE,gBAAgB,GAAG,YAAY;CAQjD;AAED,qBAAa,WAAY,SAAQ,aAAa,CAAC,SAAS,EAAE,gBAAgB,CAAC;IAC1E,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,SAAS;CAGrE;AAED,eAAO,MAAM,SAAS,eAAiB,CAAC;AAExC,qBAAa,SAAU,SAAQ,UAAU,CAAC,gBAAgB,CAAE,YAAW,wBAAwB;IAC9F,MAAM,CAAC,IAAI,SAAa;IAExB,OAAO,CAAC,YAAY,CAAkC;IACtD,OAAO,CAAC,WAAW,CAAkC;IACrD,OAAO,CAAC,aAAa,CAA+B;gBAExC,OAAO,CAAC,EAAE,gBAAgB;IAK/B,mBAAmB,CAAC,EAAE,KAAK,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO;IAO1D,uBAAuB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;QAAE,KAAK,EAAE,GAAG,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;IAU9E,OAAO,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI;IAKjD,MAAM,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI;IAK/C,MAAM,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI;IAK/C,OAAO,CAAC,KAAK,EAAE,GAAG;IAWlB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;IAkBjC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG;CAc9B;AAED,KAAK,WAAW,GAAG,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAExD,wBAAsB,IAAI,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,CAS1E"}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { ColliderDesc as a, ActiveCollisionTypes as h } from "@dimforge/rapier3d-compat";
|
|
2
|
-
import { Vector3 as l } from "three";
|
|
3
|
-
import { GameEntity as u } from "./entity.js";
|
|
4
|
-
import { EntityCollisionBuilder as c, EntityBuilder as p } from "./builder.js";
|
|
5
|
-
import { createEntity as E } from "./create.js";
|
|
6
|
-
import { state as o } from "../game/game-state.js";
|
|
7
|
-
const d = {
|
|
8
|
-
size: new l(1, 1, 1),
|
|
9
|
-
position: new l(0, 0, 0),
|
|
10
|
-
collision: {
|
|
11
|
-
static: !0
|
|
12
|
-
},
|
|
13
|
-
material: {
|
|
14
|
-
shader: "standard"
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
class f extends c {
|
|
18
|
-
collider(e) {
|
|
19
|
-
const t = e.size || new l(1, 1, 1), i = { x: t.x / 2, y: t.y / 2, z: t.z / 2 };
|
|
20
|
-
let s = a.cuboid(i.x, i.y, i.z);
|
|
21
|
-
return s.setSensor(!0), s.activeCollisionTypes = h.KINEMATIC_FIXED, s;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
class x extends p {
|
|
25
|
-
createEntity(e) {
|
|
26
|
-
return new r(e);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
const Z = Symbol("Zone");
|
|
30
|
-
class r extends u {
|
|
31
|
-
static type = Z;
|
|
32
|
-
_enteredZone = /* @__PURE__ */ new Map();
|
|
33
|
-
_exitedZone = /* @__PURE__ */ new Map();
|
|
34
|
-
_zoneEntities = /* @__PURE__ */ new Map();
|
|
35
|
-
constructor(e) {
|
|
36
|
-
super(), this.options = { ...d, ...e };
|
|
37
|
-
}
|
|
38
|
-
handlePostCollision({ delta: e }) {
|
|
39
|
-
return this._enteredZone.forEach((t, i) => {
|
|
40
|
-
this.exited(e, i);
|
|
41
|
-
}), this._enteredZone.size > 0;
|
|
42
|
-
}
|
|
43
|
-
handleIntersectionEvent({ other: e, delta: t }) {
|
|
44
|
-
this._enteredZone.get(e.uuid) ? this.held(t, e) : (this.entered(e), this._zoneEntities.set(e.uuid, e));
|
|
45
|
-
}
|
|
46
|
-
onEnter(e) {
|
|
47
|
-
return this.options.onEnter = e, this;
|
|
48
|
-
}
|
|
49
|
-
onHeld(e) {
|
|
50
|
-
return this.options.onHeld = e, this;
|
|
51
|
-
}
|
|
52
|
-
onExit(e) {
|
|
53
|
-
return this.options.onExit = e, this;
|
|
54
|
-
}
|
|
55
|
-
entered(e) {
|
|
56
|
-
this._enteredZone.set(e.uuid, 1), this.options.onEnter && this.options.onEnter({
|
|
57
|
-
self: this,
|
|
58
|
-
visitor: e,
|
|
59
|
-
globals: o.globals
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
exited(e, t) {
|
|
63
|
-
const i = this._exitedZone.get(t);
|
|
64
|
-
if (i && i > 1 + e) {
|
|
65
|
-
this._exitedZone.delete(t), this._enteredZone.delete(t);
|
|
66
|
-
const s = this._zoneEntities.get(t);
|
|
67
|
-
this.options.onExit && this.options.onExit({
|
|
68
|
-
self: this,
|
|
69
|
-
visitor: s,
|
|
70
|
-
globals: o.globals
|
|
71
|
-
});
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
this._exitedZone.set(t, 1 + e);
|
|
75
|
-
}
|
|
76
|
-
held(e, t) {
|
|
77
|
-
const i = this._enteredZone.get(t.uuid) ?? 0;
|
|
78
|
-
this._enteredZone.set(t.uuid, i + e), this._exitedZone.set(t.uuid, 1), this.options.onHeld && this.options.onHeld({
|
|
79
|
-
delta: e,
|
|
80
|
-
self: this,
|
|
81
|
-
visitor: t,
|
|
82
|
-
globals: o.globals,
|
|
83
|
-
heldTime: i
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
async function b(...n) {
|
|
88
|
-
return E({
|
|
89
|
-
args: n,
|
|
90
|
-
defaultConfig: d,
|
|
91
|
-
EntityClass: r,
|
|
92
|
-
BuilderClass: x,
|
|
93
|
-
CollisionBuilderClass: f,
|
|
94
|
-
entityType: r.type
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
export {
|
|
98
|
-
Z as ZONE_TYPE,
|
|
99
|
-
x as ZoneBuilder,
|
|
100
|
-
f as ZoneCollisionBuilder,
|
|
101
|
-
r as ZylemZone,
|
|
102
|
-
b as zone
|
|
103
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { Stage } from '../stage/stage';
|
|
2
|
-
import type { BaseGlobals, ZylemGameConfig } from './game-interfaces';
|
|
3
|
-
/**
|
|
4
|
-
* A lightweight, serializable blueprint representing the initial configuration
|
|
5
|
-
* of a `Game`. It should not include runtime references. Use blueprints only to
|
|
6
|
-
* build games.
|
|
7
|
-
*/
|
|
8
|
-
export interface GameBlueprint<TGlobals extends BaseGlobals = BaseGlobals> {
|
|
9
|
-
id: string;
|
|
10
|
-
name?: string;
|
|
11
|
-
config: Partial<ZylemGameConfig<Stage, any, TGlobals>>;
|
|
12
|
-
}
|
|
13
|
-
export declare const gameBlueprintsState: {
|
|
14
|
-
byId: Record<string, GameBlueprint>;
|
|
15
|
-
order: string[];
|
|
16
|
-
currentId: string | null;
|
|
17
|
-
};
|
|
18
|
-
/** Reset the blueprints store back to its initial empty state. */
|
|
19
|
-
export declare function resetGameBlueprints(): void;
|
|
20
|
-
/** Create and register a new `GameBlueprint`. */
|
|
21
|
-
export declare function createGameBlueprint<TGlobals extends BaseGlobals>(config: Partial<ZylemGameConfig<Stage, any, TGlobals>>, options?: {
|
|
22
|
-
id?: string;
|
|
23
|
-
name?: string;
|
|
24
|
-
setCurrent?: boolean;
|
|
25
|
-
}): GameBlueprint<TGlobals>;
|
|
26
|
-
/** Upsert a blueprint into the store. */
|
|
27
|
-
export declare function upsertGameBlueprint<TGlobals extends BaseGlobals>(blueprint: GameBlueprint<TGlobals>): void;
|
|
28
|
-
/** Remove a blueprint by id. */
|
|
29
|
-
export declare function removeGameBlueprint(id: string): void;
|
|
30
|
-
/** Get a blueprint by id. */
|
|
31
|
-
export declare function getGameBlueprint(id: string): GameBlueprint | undefined;
|
|
32
|
-
/** List all blueprints in insertion order. */
|
|
33
|
-
export declare function listGameBlueprints(): GameBlueprint[];
|
|
34
|
-
/** Set the current blueprint id (or clear by passing null). */
|
|
35
|
-
export declare function setCurrentGameBlueprint(id: string | null): void;
|
|
36
|
-
/** Get the current blueprint object, if any. */
|
|
37
|
-
export declare function getCurrentGameBlueprint(): GameBlueprint | null;
|
|
38
|
-
//# sourceMappingURL=game-blueprint.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"game-blueprint.d.ts","sourceRoot":"","sources":["../../../src/lib/game/game-blueprint.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEtE;;;;GAIG;AACH,MAAM,WAAW,aAAa,CAAC,QAAQ,SAAS,WAAW,GAAG,WAAW;IACxE,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;CACvD;AAYD,eAAO,MAAM,mBAAmB;UALnB,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC;WAC5B,MAAM,EAAE;eACF,MAAM,GAAG,IAAI;CAG8C,CAAC;AAEhF,kEAAkE;AAClE,wBAAgB,mBAAmB,IAAI,IAAI,CAK1C;AAED,iDAAiD;AACjD,wBAAgB,mBAAmB,CAAC,QAAQ,SAAS,WAAW,EAC/D,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC,EACtD,OAAO,CAAC,EAAE;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAC;CAAE,GAC7D,aAAa,CAAC,QAAQ,CAAC,CAWzB;AAED,yCAAyC;AACzC,wBAAgB,mBAAmB,CAAC,QAAQ,SAAS,WAAW,EAC/D,SAAS,EAAE,aAAa,CAAC,QAAQ,CAAC,GAChC,IAAI,CAKN;AAED,gCAAgC;AAChC,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAMpD;AAED,6BAA6B;AAC7B,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAEtE;AAED,8CAA8C;AAC9C,wBAAgB,kBAAkB,IAAI,aAAa,EAAE,CAIpD;AAED,+DAA+D;AAC/D,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAE/D;AAED,gDAAgD;AAChD,wBAAgB,uBAAuB,IAAI,aAAa,GAAG,IAAI,CAG9D"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { AspectRatioValue } from '../device/aspect-ratio';
|
|
2
|
-
export interface GameCanvasOptions {
|
|
3
|
-
id: string;
|
|
4
|
-
container?: HTMLElement;
|
|
5
|
-
containerId?: string;
|
|
6
|
-
canvas?: HTMLCanvasElement;
|
|
7
|
-
bodyBackground?: string;
|
|
8
|
-
fullscreen?: boolean;
|
|
9
|
-
aspectRatio: AspectRatioValue | number;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* GameCanvas is a DOM delegate that owns:
|
|
13
|
-
* - container lookup/creation and styling (including fullscreen centering)
|
|
14
|
-
* - body background application
|
|
15
|
-
* - canvas mounting into container
|
|
16
|
-
* - aspect ratio sizing via AspectRatioDelegate
|
|
17
|
-
*/
|
|
18
|
-
export declare class GameCanvas {
|
|
19
|
-
id: string;
|
|
20
|
-
container: HTMLElement;
|
|
21
|
-
canvas: HTMLCanvasElement;
|
|
22
|
-
bodyBackground?: string;
|
|
23
|
-
fullscreen: boolean;
|
|
24
|
-
aspectRatio: number;
|
|
25
|
-
private ratioDelegate;
|
|
26
|
-
constructor(options: GameCanvasOptions);
|
|
27
|
-
applyBodyBackground(): void;
|
|
28
|
-
mountCanvas(): void;
|
|
29
|
-
mountRenderer(rendererDom: HTMLCanvasElement, onResize: (width: number, height: number) => void): void;
|
|
30
|
-
centerIfFullscreen(): void;
|
|
31
|
-
attachAspectRatio(onResize: (width: number, height: number) => void): void;
|
|
32
|
-
destroy(): void;
|
|
33
|
-
private ensureContainer;
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=game-canvas.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"game-canvas.d.ts","sourceRoot":"","sources":["../../../src/lib/game/game-canvas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/E,MAAM,WAAW,iBAAiB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,gBAAgB,GAAG,MAAM,CAAC;CACvC;AAED;;;;;;GAMG;AACH,qBAAa,UAAU;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAG,WAAW,CAAC;IACxB,MAAM,EAAG,iBAAiB,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,aAAa,CAAoC;gBAE7C,OAAO,EAAE,iBAAiB;IAStC,mBAAmB;IAMnB,WAAW;IAOX,aAAa,CAAC,WAAW,EAAE,iBAAiB,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI;IAS/F,kBAAkB;IAUlB,iBAAiB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI;IAiBnE,OAAO;IAKP,OAAO,CAAC,eAAe;CAevB"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { AspectRatioDelegate as s } from "../device/aspect-ratio.js";
|
|
2
|
-
class o {
|
|
3
|
-
id;
|
|
4
|
-
container;
|
|
5
|
-
canvas;
|
|
6
|
-
bodyBackground;
|
|
7
|
-
fullscreen;
|
|
8
|
-
aspectRatio;
|
|
9
|
-
ratioDelegate = null;
|
|
10
|
-
constructor(t) {
|
|
11
|
-
this.id = t.id, this.container = this.ensureContainer(t.containerId ?? t.id, t.container), this.canvas = t.canvas ?? document.createElement("canvas"), this.bodyBackground = t.bodyBackground, this.fullscreen = !!t.fullscreen, this.aspectRatio = (typeof t.aspectRatio == "number", t.aspectRatio);
|
|
12
|
-
}
|
|
13
|
-
applyBodyBackground() {
|
|
14
|
-
this.bodyBackground && (document.body.style.background = this.bodyBackground);
|
|
15
|
-
}
|
|
16
|
-
mountCanvas() {
|
|
17
|
-
for (; this.container.firstChild; )
|
|
18
|
-
this.container.removeChild(this.container.firstChild);
|
|
19
|
-
this.container.appendChild(this.canvas);
|
|
20
|
-
}
|
|
21
|
-
mountRenderer(t, a) {
|
|
22
|
-
for (; this.container.firstChild; )
|
|
23
|
-
this.container.removeChild(this.container.firstChild);
|
|
24
|
-
this.container.appendChild(t), this.canvas = t, this.attachAspectRatio(a);
|
|
25
|
-
}
|
|
26
|
-
centerIfFullscreen() {
|
|
27
|
-
if (!this.fullscreen)
|
|
28
|
-
return;
|
|
29
|
-
const t = this.container.style;
|
|
30
|
-
t.display = "flex", t.alignItems = "center", t.justifyContent = "center", t.position = "fixed", t.inset = "0";
|
|
31
|
-
}
|
|
32
|
-
attachAspectRatio(t) {
|
|
33
|
-
this.ratioDelegate ? (this.ratioDelegate.canvas = this.canvas, this.ratioDelegate.onResize = t, this.ratioDelegate.aspectRatio = this.aspectRatio, this.ratioDelegate.apply()) : (this.ratioDelegate = new s({
|
|
34
|
-
container: this.container,
|
|
35
|
-
canvas: this.canvas,
|
|
36
|
-
aspectRatio: this.aspectRatio,
|
|
37
|
-
onResize: t
|
|
38
|
-
}), this.ratioDelegate.attach());
|
|
39
|
-
}
|
|
40
|
-
destroy() {
|
|
41
|
-
this.ratioDelegate?.detach(), this.ratioDelegate = null;
|
|
42
|
-
}
|
|
43
|
-
ensureContainer(t, a) {
|
|
44
|
-
if (a)
|
|
45
|
-
return a;
|
|
46
|
-
if (t) {
|
|
47
|
-
const i = document.getElementById(t);
|
|
48
|
-
if (i)
|
|
49
|
-
return i;
|
|
50
|
-
}
|
|
51
|
-
const n = t || this.id || "zylem-root", e = document.createElement("main");
|
|
52
|
-
return e.setAttribute("id", n), e.style.position = "relative", e.style.width = "100%", e.style.height = "100%", document.body.appendChild(e), e;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
export {
|
|
56
|
-
o as GameCanvas
|
|
57
|
-
};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { StageInterface } from "../types";
|
|
2
|
-
import { GameInputConfig } from "./game-interfaces";
|
|
3
|
-
import { AspectRatio, AspectRatioValue } from "../device/aspect-ratio";
|
|
4
|
-
import { RetroPresetKey } from "./game-retro-resolutions";
|
|
5
|
-
export type GameConfigLike = Partial<{
|
|
6
|
-
id: string;
|
|
7
|
-
globals: Record<string, any>;
|
|
8
|
-
stages: StageInterface[];
|
|
9
|
-
debug: boolean;
|
|
10
|
-
time: number;
|
|
11
|
-
input: GameInputConfig;
|
|
12
|
-
/** numeric value or key in AspectRatio */
|
|
13
|
-
aspectRatio: AspectRatioValue | keyof typeof AspectRatio;
|
|
14
|
-
/** console/display preset to derive aspect ratio */
|
|
15
|
-
preset: RetroPresetKey;
|
|
16
|
-
/** lock internal render buffer to this resolution (e.g., '256x240' or { width, height }) */
|
|
17
|
-
resolution: string | {
|
|
18
|
-
width: number;
|
|
19
|
-
height: number;
|
|
20
|
-
};
|
|
21
|
-
fullscreen: boolean;
|
|
22
|
-
/** CSS background value for document body */
|
|
23
|
-
bodyBackground: string;
|
|
24
|
-
/** existing container by reference */
|
|
25
|
-
container: HTMLElement;
|
|
26
|
-
/** create/find container by id */
|
|
27
|
-
containerId: string;
|
|
28
|
-
/** optional canvas if caller wants to manage it */
|
|
29
|
-
canvas: HTMLCanvasElement;
|
|
30
|
-
}>;
|
|
31
|
-
export declare class GameConfig {
|
|
32
|
-
id: string;
|
|
33
|
-
globals: Record<string, any>;
|
|
34
|
-
stages: StageInterface[];
|
|
35
|
-
debug: boolean;
|
|
36
|
-
time: number;
|
|
37
|
-
input: GameInputConfig | undefined;
|
|
38
|
-
aspectRatio: number;
|
|
39
|
-
internalResolution: {
|
|
40
|
-
width: number;
|
|
41
|
-
height: number;
|
|
42
|
-
} | undefined;
|
|
43
|
-
fullscreen: boolean;
|
|
44
|
-
bodyBackground: string | undefined;
|
|
45
|
-
container: HTMLElement;
|
|
46
|
-
containerId?: string | undefined;
|
|
47
|
-
canvas?: HTMLCanvasElement | undefined;
|
|
48
|
-
constructor(id: string, globals: Record<string, any>, stages: StageInterface[], debug: boolean, time: number, input: GameInputConfig | undefined, aspectRatio: number, internalResolution: {
|
|
49
|
-
width: number;
|
|
50
|
-
height: number;
|
|
51
|
-
} | undefined, fullscreen: boolean, bodyBackground: string | undefined, container: HTMLElement, containerId?: string | undefined, canvas?: HTMLCanvasElement | undefined);
|
|
52
|
-
}
|
|
53
|
-
export declare function resolveGameConfig(user?: GameConfigLike): GameConfig;
|
|
54
|
-
/**
|
|
55
|
-
* Factory for authoring configuration objects in user code.
|
|
56
|
-
* Returns a plain object that can be passed to `game(...)`.
|
|
57
|
-
*/
|
|
58
|
-
export declare function gameConfig(config: GameConfigLike): GameConfigLike;
|
|
59
|
-
//# sourceMappingURL=game-config.d.ts.map
|