@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,225 +0,0 @@
1
- //----------------------------------------------------------------------------------------------------------------------
2
- // Logger Utility
3
- //----------------------------------------------------------------------------------------------------------------------
4
-
5
- import type {
6
- LogLevel,
7
- LoggerInterface,
8
- LoggingBackend,
9
- } from '../interfaces/logger.ts';
10
-
11
- import { ConsoleBackend } from '../classes/loggers/consoleBackend.ts';
12
- import { NullBackend } from '../classes/loggers/nullBackend.ts';
13
-
14
- //----------------------------------------------------------------------------------------------------------------------
15
-
16
- /**
17
- * Implementation of Logger interface.
18
- * Each instance is bound to a specific category and backend.
19
- */
20
- export class SAGELogger implements LoggerInterface
21
- {
22
- private category : string;
23
- private backend : LoggingBackend;
24
- private minLevel : LogLevel;
25
-
26
- constructor(category : string, minLevel : LogLevel = 'none', backend : LoggingBackend = new NullBackend())
27
- {
28
- this.category = category;
29
- this.backend = backend;
30
- this.minLevel = minLevel;
31
- }
32
-
33
- /**
34
- * Update the logger's backend and minimum level
35
- */
36
- public updateSettings(backend : LoggingBackend, minLevel : LogLevel) : void
37
- {
38
- this.backend = backend;
39
- this.minLevel = minLevel;
40
- }
41
-
42
- trace(message : string, ...args : any[]) : void
43
- {
44
- if(this.shouldLog('trace'))
45
- {
46
- this.backend.trace(this.category, message, ...args);
47
- }
48
- }
49
-
50
- debug(message : string, ...args : any[]) : void
51
- {
52
- if(this.shouldLog('debug'))
53
- {
54
- this.backend.debug(this.category, message, ...args);
55
- }
56
- }
57
-
58
- info(message : string, ...args : any[]) : void
59
- {
60
- if(this.shouldLog('info'))
61
- {
62
- this.backend.info(this.category, message, ...args);
63
- }
64
- }
65
-
66
- warn(message : string, ...args : any[]) : void
67
- {
68
- if(this.shouldLog('warn'))
69
- {
70
- this.backend.warn(this.category, message, ...args);
71
- }
72
- }
73
-
74
- error(message : string, ...args : any[]) : void
75
- {
76
- if(this.shouldLog('error'))
77
- {
78
- this.backend.error(this.category, message, ...args);
79
- }
80
- }
81
-
82
- time(label : string) : void
83
- {
84
- if(this.minLevel !== 'none')
85
- {
86
- this.backend.time(this.category, label);
87
- }
88
- }
89
-
90
- timeEnd(label : string) : void
91
- {
92
- if(this.minLevel !== 'none')
93
- {
94
- this.backend.timeEnd(this.category, label);
95
- }
96
- }
97
-
98
- /**
99
- * Determine if a message at the given level should be logged based on the current minimum level.
100
- */
101
- private shouldLog(level : LogLevel) : boolean
102
- {
103
- if(this.minLevel === 'none')
104
- {
105
- return false;
106
- }
107
-
108
- switch (this.minLevel)
109
- {
110
- case 'trace':
111
- return true;
112
- case 'debug':
113
- return level !== 'trace';
114
- case 'info':
115
- return level === 'info' || level === 'warn' || level === 'error';
116
- case 'warn':
117
- return level === 'warn' || level === 'error';
118
- case 'error':
119
- return level === 'error';
120
- default:
121
- return false;
122
- }
123
- }
124
- }
125
-
126
- //----------------------------------------------------------------------------------------------------------------------
127
-
128
- /**
129
- * A utility for creating loggers and managing logging configuration.
130
- */
131
- export class LoggingUtility
132
- {
133
- private backend : LoggingBackend;
134
- private level : LogLevel;
135
- private loggers : Map<string, LoggerInterface>;
136
-
137
- /**
138
- * Create a new LoggingUtility.
139
- *
140
- * @param level - The minimum logging level (defaults to INFO)
141
- * @param backend - The logging backend to use (defaults to ConsoleBackend)
142
- */
143
- constructor(level : LogLevel = 'debug', backend : LoggingBackend = new ConsoleBackend())
144
- {
145
- this.backend = backend;
146
- this.level = level;
147
- this.loggers = new Map();
148
- }
149
-
150
- /**
151
- * Set the logging backend.
152
- *
153
- * @param backend - The logging backend to use
154
- */
155
- public setBackend(backend : LoggingBackend) : void
156
- {
157
- this.backend = backend;
158
-
159
- // Update all existing loggers to use the new backend
160
- this.loggers.forEach((logger) =>
161
- {
162
- if(logger instanceof SAGELogger)
163
- {
164
- logger.updateSettings(this.backend, this.level);
165
- }
166
- });
167
- }
168
-
169
- /**
170
- * Set the minimum logging level.
171
- *
172
- * @param level - The minimum logging level to display
173
- */
174
- public setLevel(level : LogLevel) : void
175
- {
176
- this.level = level;
177
-
178
- // Update all existing loggers to use the new level
179
- this.loggers.forEach((logger) =>
180
- {
181
- if(logger instanceof SAGELogger)
182
- {
183
- logger.updateSettings(this.backend, this.level);
184
- }
185
- });
186
- }
187
-
188
- /**
189
- * Get the current minimum logging level.
190
- */
191
- public getLevel() : LogLevel
192
- {
193
- return this.level;
194
- }
195
-
196
- /**
197
- * Get a logger for the specified category.
198
- *
199
- * @param category - The category for this logger (typically class/module name)
200
- * @returns A Logger instance for the specified category
201
- */
202
- public getLogger(category : string) : LoggerInterface
203
- {
204
- if(!this.loggers.has(category))
205
- {
206
- this.loggers.set(category, new SAGELogger(category, this.level, this.backend));
207
- }
208
-
209
- const logger = this.loggers.get(category);
210
- // Check for undefined instead of using non-null assertion
211
- if(logger === undefined)
212
- {
213
- throw new Error(`Failed to create logger for category: ${ category }`);
214
- }
215
-
216
- return logger;
217
- }
218
- }
219
-
220
- //----------------------------------------------------------------------------------------------------------------------
221
-
222
- export { ConsoleBackend } from '../classes/loggers/consoleBackend.ts';
223
- export { NullBackend } from '../classes/loggers/nullBackend.ts';
224
-
225
- //----------------------------------------------------------------------------------------------------------------------
@@ -1,16 +0,0 @@
1
- //----------------------------------------------------------------------------------------------------------------------
2
- // Physics Utility
3
- //----------------------------------------------------------------------------------------------------------------------
4
-
5
- import HavokPhysics from '@babylonjs/havok';
6
- import { HavokPlugin } from '@babylonjs/core';
7
-
8
- //----------------------------------------------------------------------------------------------------------------------
9
-
10
- export async function createPhysics() : Promise<HavokPlugin>
11
- {
12
- const hk = await HavokPhysics();
13
- return new HavokPlugin(true, hk);
14
- }
15
-
16
- //----------------------------------------------------------------------------------------------------------------------
@@ -1,11 +0,0 @@
1
- //----------------------------------------------------------------------------------------------------------------------
2
- // Version utility for SAGE
3
- //----------------------------------------------------------------------------------------------------------------------
4
-
5
- /**
6
- * The current version of the SAGE engine.
7
- * This is automatically pulled from package.json during build.
8
- */
9
- export const VERSION = __APP_VERSION__ ?? '0.0.0';
10
-
11
- //----------------------------------------------------------------------------------------------------------------------