@skewedaspect/sage 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +8 -8
  7. package/dist/classes/input/gamepad.d.ts +1 -1
  8. package/dist/classes/input/keyboard.d.ts +1 -1
  9. package/dist/classes/input/mouse.d.ts +1 -1
  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 +2 -2
  16. package/dist/interfaces/binding.d.ts +4 -11
  17. package/dist/interfaces/entity.d.ts +5 -5
  18. package/dist/interfaces/game.d.ts +2 -2
  19. package/dist/managers/binding.d.ts +5 -5
  20. package/dist/managers/entity.d.ts +7 -7
  21. package/dist/managers/game.d.ts +5 -5
  22. package/dist/managers/input.d.ts +3 -3
  23. package/dist/managers/level.d.ts +1 -2
  24. package/dist/sage.d.ts +16 -14
  25. package/dist/sage.es.js +129 -71
  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 +11 -7
  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,12 @@
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
10
  /**
11
11
  * Interface representing the engines used in the game.
12
12
  */
@@ -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
  */
@@ -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
  */
@@ -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
  */
@@ -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;
@@ -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,9 @@
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
9
  }
@@ -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
  */
@@ -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.
@@ -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;
@@ -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
  */
@@ -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;
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";