@thewhateverapp/tile-sdk 0.15.1 → 0.15.2
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/dist/pixi/index.d.ts
CHANGED
|
@@ -38,6 +38,6 @@
|
|
|
38
38
|
* }
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
|
-
export { PixiGame, usePixiApp, useApp, useGameLoop, useGameState, useGameInput, Container, Graphics, Text, Sprite, TILE_WIDTH, TILE_HEIGHT, } from '../react/PixiGame.js';
|
|
41
|
+
export { PixiGame, usePixiApp, useApp, useGameLoop, useGameState, useGameInput, useInitialized, Container, Graphics, Text, Sprite, TILE_WIDTH, TILE_HEIGHT, } from '../react/PixiGame.js';
|
|
42
42
|
export type { PixiGameProps } from '../react/PixiGame.js';
|
|
43
43
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/pixi/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pixi/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EACL,QAAQ,EACR,UAAU,EACV,MAAM,EACN,WAAW,EACX,YAAY,EACZ,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pixi/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EACL,QAAQ,EACR,UAAU,EACV,MAAM,EACN,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,cAAc,EAEd,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,MAAM,EAEN,UAAU,EACV,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/pixi/index.js
CHANGED
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
* }
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
|
42
|
-
export { PixiGame, usePixiApp, useApp, useGameLoop, useGameState, useGameInput,
|
|
42
|
+
export { PixiGame, usePixiApp, useApp, useGameLoop, useGameState, useGameInput, useInitialized,
|
|
43
43
|
// Re-exported PIXI classes
|
|
44
44
|
Container, Graphics, Text, Sprite,
|
|
45
45
|
// Constants
|
package/dist/react/PixiGame.d.ts
CHANGED
|
@@ -102,4 +102,37 @@ export declare function useGameState<T extends object>(initialState: T): [React.
|
|
|
102
102
|
* Returns a ref with currently pressed keys.
|
|
103
103
|
*/
|
|
104
104
|
export declare function useGameInput(): React.MutableRefObject<Record<string, boolean>>;
|
|
105
|
+
/**
|
|
106
|
+
* useInitialized - Helper hook for tracking game object initialization
|
|
107
|
+
*
|
|
108
|
+
* Returns an initRef that should be set to true AFTER all game objects are
|
|
109
|
+
* created in useEffect, and checked as the FIRST line in useGameLoop.
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```tsx
|
|
113
|
+
* function GameContent() {
|
|
114
|
+
* const app = usePixiApp();
|
|
115
|
+
* const initRef = useInitialized();
|
|
116
|
+
* const playerRef = useRef<PIXI.Graphics | null>(null);
|
|
117
|
+
*
|
|
118
|
+
* useEffect(() => {
|
|
119
|
+
* if (!app) return;
|
|
120
|
+
* const player = new PIXI.Graphics();
|
|
121
|
+
* // ... setup player ...
|
|
122
|
+
* playerRef.current = player;
|
|
123
|
+
* initRef.current = true; // Set AFTER all refs are ready
|
|
124
|
+
* return () => {
|
|
125
|
+
* initRef.current = false;
|
|
126
|
+
* player.destroy();
|
|
127
|
+
* };
|
|
128
|
+
* }, [app]);
|
|
129
|
+
*
|
|
130
|
+
* useGameLoop((delta) => {
|
|
131
|
+
* if (!initRef.current || !playerRef.current) return; // REQUIRED!
|
|
132
|
+
* // ... safe to use playerRef.current ...
|
|
133
|
+
* });
|
|
134
|
+
* }
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
export declare function useInitialized(): React.MutableRefObject<boolean>;
|
|
105
138
|
//# sourceMappingURL=PixiGame.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PixiGame.d.ts","sourceRoot":"","sources":["../../src/react/PixiGame.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,KAAK,EAAE,EAOZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,IAAI,MAAM,SAAS,CAAC;AAGhC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,UAAU,MAAM,CAAC;AAC9B,eAAO,MAAM,WAAW,MAAM,CAAC;AAY/B;;GAEG;AACH,wBAAgB,UAAU,IAAI,IAAI,CAAC,WAAW,GAAG,IAAI,CAMpD;AAED;;GAEG;AACH,wBAAgB,MAAM,IAAI,IAAI,CAAC,WAAW,GAAG,IAAI,CAEhD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,EACjC,OAAO,GAAE,OAAc,QAexB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,SAAS,CAAC;IACpB,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oBAAoB;IACpB,OAAO,CAAC,EAAE;QACR,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,CAAC;IACF,6BAA6B;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAC;IAC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AC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oBAAoB;IACpB,OAAO,CAAC,EAAE;QACR,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,CAAC;IACF,6BAA6B;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,yCAAyC;IACzC,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,WAAW,KAAK,IAAI,CAAC;CAC3C;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,EACvB,QAAQ,EACR,KAAkB,EAClB,MAAoB,EACpB,UAAqB,EACrB,OAAY,EACZ,MAAc,EACd,OAAO,GACR,EAAE,aAAa,qBAqFf;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAC3C,YAAY,EAAE,CAAC,GACd,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,MAAM,IAAI,CAAC,CASzC;AAED;;;;GAIG;AACH,wBAAgB,YAAY,oDAwB3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,cAAc,IAAI,KAAK,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAEhE"}
|
package/dist/react/PixiGame.js
CHANGED
|
@@ -200,3 +200,38 @@ export function useGameInput() {
|
|
|
200
200
|
}, []);
|
|
201
201
|
return keysRef;
|
|
202
202
|
}
|
|
203
|
+
/**
|
|
204
|
+
* useInitialized - Helper hook for tracking game object initialization
|
|
205
|
+
*
|
|
206
|
+
* Returns an initRef that should be set to true AFTER all game objects are
|
|
207
|
+
* created in useEffect, and checked as the FIRST line in useGameLoop.
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* ```tsx
|
|
211
|
+
* function GameContent() {
|
|
212
|
+
* const app = usePixiApp();
|
|
213
|
+
* const initRef = useInitialized();
|
|
214
|
+
* const playerRef = useRef<PIXI.Graphics | null>(null);
|
|
215
|
+
*
|
|
216
|
+
* useEffect(() => {
|
|
217
|
+
* if (!app) return;
|
|
218
|
+
* const player = new PIXI.Graphics();
|
|
219
|
+
* // ... setup player ...
|
|
220
|
+
* playerRef.current = player;
|
|
221
|
+
* initRef.current = true; // Set AFTER all refs are ready
|
|
222
|
+
* return () => {
|
|
223
|
+
* initRef.current = false;
|
|
224
|
+
* player.destroy();
|
|
225
|
+
* };
|
|
226
|
+
* }, [app]);
|
|
227
|
+
*
|
|
228
|
+
* useGameLoop((delta) => {
|
|
229
|
+
* if (!initRef.current || !playerRef.current) return; // REQUIRED!
|
|
230
|
+
* // ... safe to use playerRef.current ...
|
|
231
|
+
* });
|
|
232
|
+
* }
|
|
233
|
+
* ```
|
|
234
|
+
*/
|
|
235
|
+
export function useInitialized() {
|
|
236
|
+
return useRef(false);
|
|
237
|
+
}
|