@skewedaspect/sage 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/classes/bindings/toggle.d.ts +4 -4
  2. package/dist/classes/bindings/trigger.d.ts +4 -4
  3. package/dist/classes/bindings/value.d.ts +4 -4
  4. package/dist/classes/entity.d.ts +2 -2
  5. package/dist/classes/eventBus.d.ts +1 -1
  6. package/dist/classes/gameEngine.d.ts +33 -8
  7. package/dist/classes/input/gamepad.d.ts +3 -3
  8. package/dist/classes/input/keyboard.d.ts +3 -3
  9. package/dist/classes/input/mouse.d.ts +3 -3
  10. package/dist/classes/input/readers/gamepad.d.ts +1 -1
  11. package/dist/classes/input/readers/keyboard.d.ts +1 -1
  12. package/dist/classes/input/readers/mouse.d.ts +1 -1
  13. package/dist/classes/loggers/consoleBackend.d.ts +1 -1
  14. package/dist/classes/loggers/nullBackend.d.ts +1 -1
  15. package/dist/engines/scene.d.ts +6 -2
  16. package/dist/interfaces/binding.d.ts +4 -11
  17. package/dist/interfaces/entity.d.ts +9 -5
  18. package/dist/interfaces/game.d.ts +2 -2
  19. package/dist/managers/binding.d.ts +9 -5
  20. package/dist/managers/entity.d.ts +14 -9
  21. package/dist/managers/game.d.ts +11 -5
  22. package/dist/managers/input.d.ts +5 -5
  23. package/dist/managers/level.d.ts +5 -2
  24. package/dist/sage.d.ts +16 -14
  25. package/dist/sage.es.js +541 -356
  26. package/dist/sage.es.js.map +1 -1
  27. package/dist/sage.umd.js +1 -1
  28. package/dist/sage.umd.js.map +1 -1
  29. package/dist/utils/graphics.d.ts +1 -1
  30. package/dist/utils/logger.d.ts +3 -3
  31. package/package.json +13 -13
  32. package/src/classes/bindings/toggle.ts +0 -261
  33. package/src/classes/bindings/trigger.ts +0 -211
  34. package/src/classes/bindings/value.ts +0 -227
  35. package/src/classes/entity.ts +0 -256
  36. package/src/classes/eventBus.ts +0 -259
  37. package/src/classes/gameEngine.ts +0 -125
  38. package/src/classes/input/gamepad.ts +0 -388
  39. package/src/classes/input/keyboard.ts +0 -189
  40. package/src/classes/input/mouse.ts +0 -276
  41. package/src/classes/input/readers/gamepad.ts +0 -179
  42. package/src/classes/input/readers/keyboard.ts +0 -123
  43. package/src/classes/input/readers/mouse.ts +0 -133
  44. package/src/classes/loggers/consoleBackend.ts +0 -135
  45. package/src/classes/loggers/nullBackend.ts +0 -51
  46. package/src/engines/scene.ts +0 -112
  47. package/src/images/sage_logo.svg +0 -172
  48. package/src/images/sage_logo_shape.svg +0 -146
  49. package/src/interfaces/action.ts +0 -30
  50. package/src/interfaces/binding.ts +0 -191
  51. package/src/interfaces/entity.ts +0 -21
  52. package/src/interfaces/game.ts +0 -44
  53. package/src/interfaces/input.ts +0 -221
  54. package/src/interfaces/logger.ts +0 -118
  55. package/src/managers/binding.ts +0 -729
  56. package/src/managers/entity.ts +0 -252
  57. package/src/managers/game.ts +0 -111
  58. package/src/managers/input.ts +0 -233
  59. package/src/managers/level.ts +0 -261
  60. package/src/sage.ts +0 -122
  61. package/src/types/global.d.ts +0 -11
  62. package/src/utils/capabilities.ts +0 -16
  63. package/src/utils/graphics.ts +0 -148
  64. package/src/utils/logger.ts +0 -225
  65. package/src/utils/physics.ts +0 -16
  66. package/src/utils/version.ts +0 -11
@@ -1,7 +1,7 @@
1
- import type { GameEventBus } from '../eventBus.ts';
2
- import type { Action } from '../../interfaces/action.ts';
3
- import type { Binding, ToggleBindingDefinition } from '../../interfaces/binding.ts';
4
- import type { DeviceValueReader, InputState } from '../../interfaces/input.ts';
1
+ import { GameEventBus } from "../eventBus.d.ts";
2
+ import { Action } from "../../interfaces/action.d.ts";
3
+ import { Binding, ToggleBindingDefinition } from "../../interfaces/binding.d.ts";
4
+ import { DeviceValueReader, InputState } from "../../interfaces/input.d.ts";
5
5
  /**
6
6
  * Options for configuring a toggle binding
7
7
  */
@@ -1,7 +1,7 @@
1
- import type { GameEventBus } from '../eventBus.ts';
2
- import type { Action } from '../../interfaces/action.ts';
3
- import type { Binding, TriggerBindingDefinition } from '../../interfaces/binding.ts';
4
- import type { DeviceValueReader, InputState } from '../../interfaces/input.ts';
1
+ import { GameEventBus } from "../eventBus.d.ts";
2
+ import { Action } from "../../interfaces/action.d.ts";
3
+ import { Binding, TriggerBindingDefinition } from "../../interfaces/binding.d.ts";
4
+ import { DeviceValueReader, InputState } from "../../interfaces/input.d.ts";
5
5
  /**
6
6
  * All supported edge modes for validation
7
7
  */
@@ -1,7 +1,7 @@
1
- import type { GameEventBus } from '../eventBus.ts';
2
- import type { Action } from '../../interfaces/action.ts';
3
- import type { Binding, ValueBindingDefinition } from '../../interfaces/binding.ts';
4
- import type { DeviceValueReader, InputState } from '../../interfaces/input.ts';
1
+ import { GameEventBus } from "../eventBus.d.ts";
2
+ import { Action } from "../../interfaces/action.d.ts";
3
+ import { Binding, ValueBindingDefinition } from "../../interfaces/binding.d.ts";
4
+ import { DeviceValueReader, InputState } from "../../interfaces/input.d.ts";
5
5
  /**
6
6
  * Options for configuring a value binding
7
7
  */
@@ -1,5 +1,5 @@
1
- import type { GameEntityBehaviorConstructor } from '../interfaces/entity.ts';
2
- import { type GameEvent, GameEventBus } from './eventBus.ts';
1
+ import { GameEntityBehaviorConstructor } from "../interfaces/entity.d.ts";
2
+ import { GameEvent, GameEventBus } from "./eventBus.d.ts";
3
3
  /**
4
4
  * Interface representing the context of a game entity.
5
5
  * @template EntityState - The type of the state object.
@@ -1,4 +1,4 @@
1
- import { LoggingUtility } from '../utils/logger.ts';
1
+ import { LoggingUtility } from "../utils/logger.d.ts";
2
2
  /**
3
3
  * A generic game event type.
4
4
  *
@@ -1,12 +1,16 @@
1
1
  import { AbstractEngine, HavokPlugin } from '@babylonjs/core';
2
- import { GameCanvas } from '../interfaces/game.ts';
3
- import { SceneEngine } from '../engines/scene.ts';
4
- import { BindingManager } from '../managers/binding.ts';
5
- import { GameManager } from '../managers/game.ts';
6
- import { GameEntityManager } from '../managers/entity.ts';
7
- import { UserInputManager } from '../managers/input.ts';
8
- import { GameEventBus } from './eventBus.ts';
9
- import { LoggingUtility } from '../utils/logger.ts';
2
+ import { GameCanvas } from "../interfaces/game.d.ts";
3
+ import { SceneEngine } from "../engines/scene.d.ts";
4
+ import { BindingManager } from "../managers/binding.d.ts";
5
+ import { GameManager } from "../managers/game.d.ts";
6
+ import { GameEntityManager } from "../managers/entity.d.ts";
7
+ import { UserInputManager } from "../managers/input.d.ts";
8
+ import { GameEventBus } from "./eventBus.d.ts";
9
+ import { LoggingUtility } from "../utils/logger.d.ts";
10
+ /**
11
+ * Type definition for game lifecycle hook functions
12
+ */
13
+ export type GameHook = (gameEngine: SkewedAspectGameEngine) => Promise<void>;
10
14
  /**
11
15
  * Interface representing the engines used in the game.
12
16
  */
@@ -34,6 +38,9 @@ export declare class SkewedAspectGameEngine {
34
38
  eventBus: GameEventBus;
35
39
  logger: LoggingUtility;
36
40
  private _log;
41
+ private _beforeStartHook;
42
+ private _onStartHook;
43
+ private _onTeardownHook;
37
44
  /**
38
45
  * Creates an instance of SkewedAspectGameEngine.
39
46
  * @param canvas - The game canvas.
@@ -45,6 +52,24 @@ export declare class SkewedAspectGameEngine {
45
52
  * @param managers - The managers used in the game.
46
53
  */
47
54
  constructor(canvas: GameCanvas, renderEngine: AbstractEngine, physics: HavokPlugin, eventBus: GameEventBus, logger: LoggingUtility, engines: Engines, managers: Managers);
55
+ /**
56
+ * Register a function to be called before the game engine starts
57
+ * @param hook - Async function to be called before start
58
+ * @throws Error if a hook is already registered
59
+ */
60
+ onBeforeStart(hook: GameHook): void;
61
+ /**
62
+ * Register a function to be called after the game engine starts
63
+ * @param hook - Async function to be called after start
64
+ * @throws Error if a hook is already registered
65
+ */
66
+ onStart(hook: GameHook): void;
67
+ /**
68
+ * Register a function to be called when the game engine stops
69
+ * @param hook - Async function to be called during teardown
70
+ * @throws Error if a hook is already registered
71
+ */
72
+ onTeardown(hook: GameHook): void;
48
73
  /**
49
74
  * Starts the game engine.
50
75
  */
@@ -1,4 +1,4 @@
1
- import type { GamepadDevice, GamepadInputState } from '../../interfaces/input.ts';
1
+ import { GamepadDevice, GamepadInputState } from "../../interfaces/input.d.ts";
2
2
  /**
3
3
  * Callback type for gamepad device connection events
4
4
  */
@@ -64,9 +64,9 @@ export declare class GamepadInputPlugin {
64
64
  */
65
65
  pollGamepads(): void;
66
66
  /**
67
- * Destroy the gamepad resource access and clean up event listeners
67
+ * Tears down the gamepad resource access and cleans up event listeners
68
68
  */
69
- destroy(): void;
69
+ $teardown(): Promise<void>;
70
70
  /**
71
71
  * Set up gamepad event listeners
72
72
  */
@@ -1,4 +1,4 @@
1
- import type { KeyboardDevice, KeyboardInputState } from '../../interfaces/input.ts';
1
+ import { KeyboardDevice, KeyboardInputState } from "../../interfaces/input.d.ts";
2
2
  /**
3
3
  * Callback type for keyboard device connection events
4
4
  */
@@ -40,9 +40,9 @@ export declare class KeyboardInputPlugin {
40
40
  */
41
41
  getDevice(): KeyboardDevice;
42
42
  /**
43
- * Destroy the keyboard resource access and clean up event listeners
43
+ * Tears down the keyboard resource access and cleans up event listeners
44
44
  */
45
- destroy(): void;
45
+ $teardown(): Promise<void>;
46
46
  /**
47
47
  * Set up keyboard event listeners
48
48
  */
@@ -1,4 +1,4 @@
1
- import type { MouseDevice, MouseInputState } from '../../interfaces/input.ts';
1
+ import { MouseDevice, MouseInputState } from "../../interfaces/input.d.ts";
2
2
  /**
3
3
  * Callback type for mouse device connection events
4
4
  */
@@ -46,9 +46,9 @@ export declare class MouseInputPlugin {
46
46
  */
47
47
  getDevice(): MouseDevice;
48
48
  /**
49
- * Destroy the mouse resource access and clean up event listeners
49
+ * Tears down the mouse resource access and cleans up event listeners
50
50
  */
51
- destroy(): void;
51
+ $teardown(): Promise<void>;
52
52
  /**
53
53
  * Set up mouse event listeners
54
54
  */
@@ -1,4 +1,4 @@
1
- import type { DeviceValueReader, GamepadValueReaderDefinition, InputState } from '../../../interfaces/input.ts';
1
+ import { DeviceValueReader, GamepadValueReaderDefinition, InputState } from "../../../interfaces/input.d.ts";
2
2
  /**
3
3
  * Types of gamepad input sources
4
4
  */
@@ -1,4 +1,4 @@
1
- import type { DeviceValueReader, InputState, KeyboardValueReaderDefinition } from '../../../interfaces/input.ts';
1
+ import { DeviceValueReader, InputState, KeyboardValueReaderDefinition } from "../../../interfaces/input.d.ts";
2
2
  /**
3
3
  * Types of keyboard input sources
4
4
  */
@@ -1,4 +1,4 @@
1
- import type { DeviceValueReader, InputState, MouseValueReaderDefinition } from '../../../interfaces/input.ts';
1
+ import { DeviceValueReader, InputState, MouseValueReaderDefinition } from "../../../interfaces/input.d.ts";
2
2
  /**
3
3
  * Types of mouse input sources
4
4
  */
@@ -1,4 +1,4 @@
1
- import type { LoggingBackend } from '../../interfaces/logger.ts';
1
+ import { LoggingBackend } from "../../interfaces/logger.d.ts";
2
2
  /**
3
3
  * A logging backend that logs to the console.
4
4
  */
@@ -1,4 +1,4 @@
1
- import type { LoggingBackend } from '../../interfaces/logger.ts';
1
+ import { LoggingBackend } from "../../interfaces/logger.d.ts";
2
2
  /**
3
3
  * A logging backend that does nothing (discards all logs).
4
4
  * Useful for production environments or when you want to completely disable logging.
@@ -1,6 +1,6 @@
1
1
  import { AbstractEngine, HavokPlugin, Scene } from '@babylonjs/core';
2
- import type { GameCanvas } from '../interfaces/game.ts';
3
- import { type LoggingUtility } from '../utils/logger.ts';
2
+ import { GameCanvas } from "../interfaces/game.d.ts";
3
+ import { LoggingUtility } from "../utils/logger.d.ts";
4
4
  export declare class SceneEngine {
5
5
  private _engine;
6
6
  private _physics;
@@ -8,4 +8,8 @@ export declare class SceneEngine {
8
8
  constructor(engine: AbstractEngine, physics: HavokPlugin, logger?: LoggingUtility);
9
9
  private _buildDemoScene;
10
10
  loadScene(canvas: GameCanvas): Promise<Scene>;
11
+ /**
12
+ * Tears down the scene engine and cleans up any resources
13
+ */
14
+ $teardown(): Promise<void>;
11
15
  }
@@ -1,6 +1,6 @@
1
- import type { GameEventBus } from '../classes/eventBus.ts';
2
- import type { DeviceValueReader, DeviceValueReaderDefinition, InputState } from './input.ts';
3
- import type { Action } from './action.ts';
1
+ import { GameEventBus } from "../classes/eventBus.d.ts";
2
+ import { DeviceValueReader, DeviceValueReaderDefinition, InputState } from "./input.d.ts";
3
+ import { Action } from "./action.d.ts";
4
4
  /**
5
5
  * Types of bindings supported by the system
6
6
  */
@@ -93,17 +93,10 @@ export interface ValueBindingDefinition extends BindingDefinitionBase {
93
93
  deadzone?: number;
94
94
  };
95
95
  }
96
- /**
97
- * Generic binding definition (for any other binding types)
98
- */
99
- export interface GenericBindingDefinition extends BindingDefinitionBase {
100
- type: Exclude<BindingType, 'trigger' | 'toggle' | 'value'>;
101
- options?: Record<string, any>;
102
- }
103
96
  /**
104
97
  * Union type of all binding definitions
105
98
  */
106
- export type BindingDefinition = TriggerBindingDefinition | ToggleBindingDefinition | ValueBindingDefinition | GenericBindingDefinition;
99
+ export type BindingDefinition = TriggerBindingDefinition | ToggleBindingDefinition | ValueBindingDefinition;
107
100
  /**
108
101
  * Base interface for all input bindings
109
102
  */
@@ -1,9 +1,13 @@
1
- import { GameEntityBehavior } from '../classes/entity.ts';
2
- import { Action } from './action.ts';
1
+ import { GameEntityBehavior } from "../classes/entity.d.ts";
2
+ import { Action } from "./action.d.ts";
3
3
  export type GameEntityBehaviorConstructor<RequiredState extends object = object> = new () => GameEntityBehavior<RequiredState>;
4
- export interface GameEntityDefinition {
4
+ export interface GameEntityDefinition<State extends object = object> {
5
5
  type: string;
6
- defaultState: Record<string, any>;
7
- behaviors: GameEntityBehaviorConstructor[];
8
6
  actions?: Action[];
7
+ defaultState: State;
8
+ behaviors: GameEntityBehaviorConstructor[];
9
+ onBeforeCreate?: (state: State) => Promise<State | undefined> | State | undefined;
10
+ onCreate?: (state: State) => Promise<State | undefined> | State | undefined;
11
+ onBeforeDestroy?: (state: State) => Promise<State | undefined> | State | undefined;
12
+ onDestroy?: (state: State) => Promise<void> | void;
9
13
  }
@@ -1,6 +1,6 @@
1
1
  import { EngineOptions, NullEngineOptions, WebGPUEngineOptions } from '@babylonjs/core';
2
- import type { LogLevel } from './logger.ts';
3
- import { BindingDefinition } from './binding.ts';
2
+ import { LogLevel } from "./logger.d.ts";
3
+ import { BindingDefinition } from "./binding.d.ts";
4
4
  export type GameCanvas = HTMLCanvasElement | OffscreenCanvas | null;
5
5
  /** Specifies which rendering engine to force using */
6
6
  export type EngineType = 'webgl' | 'webgpu' | 'auto';
@@ -1,8 +1,8 @@
1
- import { GameEventBus } from '../classes/eventBus.ts';
2
- import { type Binding, type BindingDefinition, type Context } from '../interfaces/binding.ts';
3
- import type { InputDevice, InputState } from '../interfaces/input.ts';
4
- import type { Action } from '../interfaces/action.ts';
5
- import { LoggingUtility } from '../utils/logger.ts';
1
+ import { GameEventBus } from "../classes/eventBus.d.ts";
2
+ import { Binding, BindingDefinition, Context } from "../interfaces/binding.d.ts";
3
+ import { InputDevice, InputState } from "../interfaces/input.d.ts";
4
+ import { Action } from "../interfaces/action.d.ts";
5
+ import { LoggingUtility } from "../utils/logger.d.ts";
6
6
  /**
7
7
  * Configuration object structure for binding manager
8
8
  */
@@ -182,4 +182,8 @@ export declare class BindingManager {
182
182
  * @param config - The configuration to import
183
183
  */
184
184
  importConfiguration(config: BindingConfiguration): void;
185
+ /**
186
+ * Tears down the binding manager and cleans up any resources
187
+ */
188
+ $teardown(): Promise<void>;
185
189
  }
@@ -1,8 +1,8 @@
1
- import { GameEntity } from '../classes/entity.ts';
2
- import { GameEventBus } from '../classes/eventBus.ts';
3
- import type { GameEntityDefinition } from '../interfaces/entity.ts';
4
- import type { BindingManager } from '../managers/binding.ts';
5
- import { LoggingUtility } from '../utils/logger.ts';
1
+ import { GameEntity } from "../classes/entity.d.ts";
2
+ import { GameEventBus } from "../classes/eventBus.d.ts";
3
+ import { GameEntityDefinition } from "../interfaces/entity.d.ts";
4
+ import { BindingManager } from "../managers/binding.d.ts";
5
+ import { LoggingUtility } from "../utils/logger.d.ts";
6
6
  export declare class GameEntityManager {
7
7
  /** The event bus for the entity manager. */
8
8
  private eventBus;
@@ -27,12 +27,12 @@ export declare class GameEntityManager {
27
27
  * @param newAction - The action being registered
28
28
  * @returns true if the actions are compatible, false if they have conflicting options
29
29
  */
30
- private areActionsCompatible;
30
+ private _areActionsCompatible;
31
31
  /**
32
32
  * Registers actions defined in the entity definition with the binding manager
33
33
  * @param entityDef - The entity definition containing actions to register
34
34
  */
35
- private registerEntityActions;
35
+ private _registerEntityActions;
36
36
  $frameUpdate(dt: number): void;
37
37
  /**
38
38
  * Registers a new entity definition.
@@ -45,12 +45,12 @@ export declare class GameEntityManager {
45
45
  * @param initialState - The initial state of the entity.
46
46
  * @returns The created entity.
47
47
  */
48
- createEntity<State extends object = object>(type: string, initialState?: Partial<State>): GameEntity<State>;
48
+ createEntity<State extends object = object>(type: string, initialState?: Partial<State>): Promise<GameEntity<State>>;
49
49
  /**
50
50
  * Destroys the entity with the given ID.
51
51
  * @param entityID - The ID of the entity to destroy.
52
52
  */
53
- destroyEntity(entityID: string): void;
53
+ destroyEntity(entityID: string): Promise<void>;
54
54
  /**
55
55
  * Gets the entity with the given ID.
56
56
  * @param entityID - The ID of the entity to get.
@@ -67,4 +67,9 @@ export declare class GameEntityManager {
67
67
  * @param entityID - The ID of the entity to remove.
68
68
  */
69
69
  removeEntity(entityID: string): void;
70
+ /**
71
+ * Tears down all entities and releases resources
72
+ * @returns A promise that resolves when all entities have been destroyed
73
+ */
74
+ $teardown(): Promise<void>;
70
75
  }
@@ -1,9 +1,9 @@
1
1
  import { AbstractEngine } from '@babylonjs/core';
2
- import { GameCanvas } from '../interfaces/game.ts';
3
- import { GameEntityManager } from './entity.ts';
4
- import { UserInputManager } from './input.ts';
5
- import { SceneEngine } from '../engines/scene.ts';
6
- import { LoggingUtility } from '../utils/logger.ts';
2
+ import { GameCanvas } from "../interfaces/game.d.ts";
3
+ import { GameEntityManager } from "./entity.d.ts";
4
+ import { UserInputManager } from "./input.d.ts";
5
+ import { SceneEngine } from "../engines/scene.d.ts";
6
+ import { LoggingUtility } from "../utils/logger.d.ts";
7
7
  export declare class GameManager {
8
8
  private _engine;
9
9
  private _entityManager;
@@ -11,10 +11,16 @@ export declare class GameManager {
11
11
  private _sceneEngine;
12
12
  private _currentScene;
13
13
  private _log;
14
+ private _boundResizeHandler;
14
15
  started: boolean;
15
16
  constructor(engine: AbstractEngine, sceneEngine: SceneEngine, entityManager: GameEntityManager, inputManager: UserInputManager, logger?: LoggingUtility);
16
17
  private _renderLoop;
17
18
  private _resizeHandler;
18
19
  start(canvas: GameCanvas): Promise<void>;
19
20
  stop(): Promise<void>;
21
+ /**
22
+ * Tears down any resources held by the GameManager
23
+ * This handles unregistering event listeners and any other cleanup
24
+ */
25
+ $teardown(): Promise<void>;
20
26
  }
@@ -1,6 +1,6 @@
1
- import type { InputDevice } from '../interfaces/input.ts';
2
- import { GameEventBus } from '../classes/eventBus.ts';
3
- import { LoggingUtility } from '../utils/logger.ts';
1
+ import { InputDevice } from "../interfaces/input.d.ts";
2
+ import { GameEventBus } from "../classes/eventBus.d.ts";
3
+ import { LoggingUtility } from "../utils/logger.d.ts";
4
4
  /**
5
5
  * Manager for handling user input from various devices (keyboard, mouse, gamepad)
6
6
  */
@@ -32,9 +32,9 @@ export declare class UserInputManager {
32
32
  */
33
33
  private _publishInputChanged;
34
34
  /**
35
- * Destroy the input manager and clean up event listeners
35
+ * Tears down the input manager and clean up event listeners
36
36
  */
37
- $destroy(): void;
37
+ $teardown(): Promise<void>;
38
38
  /**
39
39
  * Get all input devices
40
40
  *
@@ -1,6 +1,5 @@
1
1
  import { Engine, Scene } from '@babylonjs/core';
2
- import '@babylonjs/loaders';
3
- import { GameEntityManager } from './entity.ts';
2
+ import { GameEntityManager } from "./entity.d.ts";
4
3
  export interface LevelLoadOptions {
5
4
  rootUrl: string;
6
5
  filename: string;
@@ -34,6 +33,10 @@ export declare class LevelManager {
34
33
  * Disposes the current scene and container (if any), freeing up memory.
35
34
  */
36
35
  disposeCurrentScene(): void;
36
+ /**
37
+ * Tears down the level manager and cleans up any resources
38
+ */
39
+ $teardown(): Promise<void>;
37
40
  /**
38
41
  * Returns the current active scene, if one is loaded.
39
42
  */
package/dist/sage.d.ts CHANGED
@@ -1,22 +1,24 @@
1
- import { GameCanvas, RenderEngineOptions, SageOptions } from './interfaces/game.ts';
2
- import { SkewedAspectGameEngine } from './classes/gameEngine.ts';
3
- import { GameEventBus } from './classes/eventBus.ts';
1
+ import { GameCanvas, RenderEngineOptions, SageOptions } from "./interfaces/game.d.ts";
2
+ import { SkewedAspectGameEngine } from "./classes/gameEngine.d.ts";
3
+ import { GameEventBus } from "./classes/eventBus.d.ts";
4
+ import { GameEntityDefinition } from "./interfaces/entity.d.ts";
4
5
  /**
5
6
  * Creates an instance of SkewedAspectGameEngine.
6
7
  * @param canvas - The game canvas.
8
+ * @param entities - The game entities.
7
9
  * @param options - The game engine options including rendering options and log level.
8
10
  * @returns A promise that resolves to an instance of SkewedAspectGameEngine.
9
11
  */
10
- export declare function createGameEngine(canvas: GameCanvas, options?: SageOptions): Promise<SkewedAspectGameEngine>;
12
+ export declare function createGameEngine(canvas: GameCanvas, entities: GameEntityDefinition[], options?: SageOptions): Promise<SkewedAspectGameEngine>;
11
13
  export type { GameCanvas, RenderEngineOptions, SageOptions };
12
- export * from './interfaces/action.ts';
13
- export * from './interfaces/binding.ts';
14
- export * from './interfaces/entity.ts';
15
- export * from './interfaces/game.ts';
16
- export * from './interfaces/input.ts';
17
- export * from './interfaces/logger.ts';
14
+ export * from "./interfaces/action.d.ts";
15
+ export * from "./interfaces/binding.d.ts";
16
+ export * from "./interfaces/entity.d.ts";
17
+ export * from "./interfaces/game.d.ts";
18
+ export * from "./interfaces/input.d.ts";
19
+ export * from "./interfaces/logger.d.ts";
18
20
  export { GameEventBus, SkewedAspectGameEngine };
19
- export * from './classes/eventBus.ts';
20
- export * from './classes/entity.ts';
21
- export * from './utils/logger.ts';
22
- export * from './utils/version.ts';
21
+ export * from "./classes/eventBus.d.ts";
22
+ export * from "./classes/entity.d.ts";
23
+ export * from "./utils/logger.d.ts";
24
+ export * from "./utils/version.d.ts";