@drincs/pixi-vn 0.1.2 → 0.1.3

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.
@@ -0,0 +1,1427 @@
1
+ import * as pixi_js from 'pixi.js';
2
+ import { ContainerOptions, SpriteOptions, TextOptions, Container, Sprite, ContainerEvents, EventEmitter, Texture, TextureSourceLike, Text, UPDATE_PRIORITY, Ticker, TickerCallback, Application, ApplicationOptions } from 'pixi.js';
3
+
4
+ /**
5
+ * CanvasEventNamesType is a type that is used to define the event names for the canvas.
6
+ */
7
+ type CanvasEventNamesType = (string | symbol) extends string | symbol ? (string | symbol) : keyof (string | symbol);
8
+
9
+ /**
10
+ * CanvasEvent is a class that is used to create a pixi event, and connect it to a canvas element, with on().
11
+ * This class should be extended and the fn method should be overridden.
12
+ * You must use the eventDecorator to register the event in the game.
13
+ * @example
14
+ * ```typescript
15
+ * \@eventDecorator() // this is equivalent to eventDecorator("EventTest")
16
+ * export class EventTest extends CanvasEvent<CanvasSprite> {
17
+ * override fn(event: CanvasEventNamesType, sprite: CanvasSprite): void {
18
+ * if (event === 'pointerdown') {
19
+ * sprite.scale.x *= 1.25;
20
+ * sprite.scale.y *= 1.25;
21
+ * }
22
+ * }
23
+ * }
24
+ * ```
25
+ */
26
+ declare class CanvasEvent<C> {
27
+ fn(_event: CanvasEventNamesType, _element: C): void;
28
+ }
29
+
30
+ /**
31
+ * StoredClassModel is a abstract class that contains the methods to store a class in the game.
32
+ * I suggest you extend this class to create your own stored class.
33
+ * @example
34
+ * ```typescript
35
+ * export class CharacterModelBase extends StoredClassModel implements ICharacterModelBase {
36
+ * constructor(tag: string, props: ICharacterModelBase) {
37
+ * super(tag)
38
+ * this.defaultName = props.name
39
+ * this.defaultSurname = props.surname
40
+ * }
41
+ * private defaultName: string = ""
42
+ * get name(): string {
43
+ * return this.getStorageProperty<string>("name") || this.defaultName
44
+ * }
45
+ * set name(value: string) {
46
+ * this.updateStorage({ ...this, name: value })
47
+ * }
48
+ * private defaultSurname?: string
49
+ * get surname(): string | undefined {
50
+ * return this.getStorageProperty<string>("surname") || this.defaultSurname
51
+ * }
52
+ * set surname(value: string | undefined) {
53
+ * this.updateStorage({ ...this, surname: value })
54
+ * }
55
+ * }
56
+ * ```
57
+ */
58
+ declare abstract class StoredClassModel {
59
+ id: string;
60
+ constructor(id: string);
61
+ private get nameClass();
62
+ updateStorage(value: typeof this): void;
63
+ getStorageProperty<T>(key: string): T | undefined;
64
+ }
65
+
66
+ interface ICharacterModelBase {
67
+ name: string;
68
+ surname?: string;
69
+ age?: number;
70
+ icon?: string;
71
+ color?: string;
72
+ }
73
+ /**
74
+ * CharacterModelBase is a class that is used to create a character model.
75
+ * I suggest you extend this class to create your own character models.
76
+ * You must use the saveCharacter function to save the character in the game.
77
+ * @example
78
+ * ```typescript
79
+ * export const liam = new CharacterModelBase('liam', {
80
+ * name: 'Liam',
81
+ * surname: 'Smith',
82
+ * age: 25,
83
+ * icon: "https://pixijs.com/assets/eggHead.png",
84
+ * color: "#9e2e12"
85
+ * });
86
+ * export const alice = new CharacterModelBase('alice', {
87
+ * name: 'Alice',
88
+ * surname: 'Smith',
89
+ * age: 25,
90
+ * icon: "https://pixijs.com/assets/eggHead.png",
91
+ * color: "#9e2e12"
92
+ * });
93
+ * saveCharacter([liam, alice]);
94
+ * ```
95
+ */
96
+ declare class CharacterModelBase extends StoredClassModel implements ICharacterModelBase {
97
+ constructor(tag: string, props: ICharacterModelBase);
98
+ private defaultName;
99
+ get name(): string;
100
+ set name(value: string);
101
+ private defaultSurname?;
102
+ get surname(): string | undefined;
103
+ set surname(value: string | undefined);
104
+ private defaultAge?;
105
+ get age(): number | undefined;
106
+ set age(value: number | undefined);
107
+ icon?: string;
108
+ color?: string;
109
+ }
110
+
111
+ /**
112
+ * Base class for all dialogue models. I suggest you extend this class to create your own dialogue models.
113
+ */
114
+ declare class DialogueModelBase {
115
+ constructor(text: string, characterTag: string | undefined);
116
+ /**
117
+ * The text of the dialogue.
118
+ */
119
+ text: string;
120
+ /**
121
+ * The tag of the character that is speaking.
122
+ */
123
+ characterTag?: string;
124
+ }
125
+
126
+ /**
127
+ * StepHistoryData is a string that will be stored in the history of the game.
128
+ * It is a function converted to string.
129
+ * if the corresponding function of the step has been changed then StepHistoryData is not equal.
130
+ */
131
+ type StepHistoryDataType = string;
132
+
133
+ /**
134
+ * StepLabel is a function that will be executed as the game continues.
135
+ */
136
+ type StepLabelType = (() => void | Promise<void>);
137
+
138
+ /**
139
+ * Label is a class that contains a list of steps, which will be performed as the game continues.
140
+ * You must use the labelDecorator to register the label in the game.
141
+ * For Ren'py this is the equivalent of a label.
142
+ * @example
143
+ * ```typescript
144
+ * \@labelDecorator() // this is equivalent to labelDecorator("StartLabel")
145
+ * export class StartLabel extends Label {
146
+ * override get steps(): StepLabelType[] {
147
+ * return [
148
+ * () => {
149
+ * GameWindowManager.clear()
150
+ * setDialogue({ character: liam, text: "Which test do you want to perform?" })
151
+ * setMenuOptions([
152
+ * new MenuOptionLabel("Events Test", EventsTestLabel),
153
+ * new MenuOptionLabel("Show Image Test", ShowImageTest),
154
+ * ])
155
+ * },
156
+ * () => GameStepManager.jumpLabel(StartLabel),
157
+ * ]
158
+ * }
159
+ * }
160
+ * GameStepManager.callLabel(StartLabel)
161
+ * ```
162
+ */
163
+ declare class Label {
164
+ /**
165
+ * Get the steps of the label.
166
+ * This class should be extended and the steps method should be overridden.
167
+ * Every time you update this list will also be updated when the other game versions load.
168
+ */
169
+ get steps(): StepLabelType[];
170
+ /**
171
+ * Get the corresponding steps number
172
+ * @param externalSteps
173
+ * @returns Numer of corresponding steps, for example, if externalSteps is [ABC, DEF, GHI] and the steps of the label is [ABC, GHT], the result will be 1
174
+ */
175
+ getCorrespondingStepsNumber(externalSteps: StepHistoryDataType[] | StepLabelType[]): number;
176
+ }
177
+
178
+ /**
179
+ * Enumeration of label modes that occurred during the progression of the steps.
180
+ */
181
+ declare enum LabelRunModeEnum {
182
+ OpenByCall = "openbycall",
183
+ OpenByJump = "openbyjump"
184
+ }
185
+
186
+ /**
187
+ * MenuOptionLabel is a class that contains a Label and a text that will be displayed in the menu.
188
+ * @example
189
+ * ```typescript
190
+ * new MenuOptionLabel("Events Test", EventsTestLabel)
191
+ * ```
192
+ */
193
+ declare class MenuOptionLabel {
194
+ text: string;
195
+ label: typeof Label;
196
+ type: LabelRunModeEnum;
197
+ constructor(text: string, label: typeof Label, type?: LabelRunModeEnum);
198
+ }
199
+
200
+ /**
201
+ * Interface for the canvas base memory
202
+ */
203
+ interface ICanvasBaseMemory {
204
+ className: string;
205
+ }
206
+
207
+ /**
208
+ * Interface for the canvas container memory
209
+ */
210
+ interface ICanvasContainerMemory extends ContainerOptions, ICanvasBaseMemory {
211
+ elements: ICanvasBaseMemory[];
212
+ }
213
+
214
+ type EventTagType = string;
215
+
216
+ /**
217
+ * Interface for texture memory
218
+ */
219
+ interface ITextureMemory {
220
+ image: string;
221
+ }
222
+
223
+ interface ICanvasSpriteBaseMemory extends SpriteOptions, ICanvasBaseMemory {
224
+ textureImage: ITextureMemory;
225
+ onEvents: {
226
+ [name: CanvasEventNamesType]: EventTagType;
227
+ };
228
+ }
229
+ /**
230
+ * Interface for the canvas sprite memory
231
+ */
232
+ interface ICanvasSpriteMemory extends ICanvasSpriteBaseMemory {
233
+ className: "CanvasSprite";
234
+ }
235
+
236
+ /**
237
+ * The memory of the image. It uses for save the state of the image.
238
+ */
239
+ interface ICanvasImageMemory extends ICanvasSpriteBaseMemory {
240
+ className: "CanvasImage";
241
+ }
242
+
243
+ /**
244
+ * Interface for the canvas text memory
245
+ */
246
+ interface ICanvasTextMemory extends TextOptions, ICanvasBaseMemory {
247
+ className: "CanvasText";
248
+ onEvents: {
249
+ [name: CanvasEventNamesType]: EventTagType;
250
+ };
251
+ }
252
+
253
+ /**
254
+ * This class is used to create a canvas element to add into a Pixi Application.
255
+ * You can use GameWindowManager.addCanvasElement() to add this element into the application.
256
+ * This class should be implemented and the memory method should be overridden.
257
+ * You must use the canvasElementDecorator to register the canvas in the game.
258
+ * In Ren'Py is a displayable.
259
+ * @example
260
+ * ```typescript
261
+ * \@canvasElementDecorator() // this is equivalent to canvasElementDecorator("CanvasExample")
262
+ * export class CanvasExample extends Container implements CanvasBase<ICanvasExampleMemory> {
263
+ * get memory(): ICanvasExampleMemory {
264
+ * return {
265
+ * className: "CanvasExample",
266
+ * // ... other properties
267
+ * }
268
+ * }
269
+ * set memory(value: ICanvasExampleMemory) {
270
+ * // ... set other properties
271
+ * }
272
+ * }
273
+ * ```
274
+ */
275
+ declare class CanvasBase<T2 extends ICanvasBaseMemory> extends Container {
276
+ /**
277
+ * This method return the memory of the canvas element.
278
+ */
279
+ get memory(): T2;
280
+ /**
281
+ * This method set the memory of the canvas element.
282
+ */
283
+ set memory(_value: T2);
284
+ }
285
+
286
+ /**
287
+ * This class is a extension of the [PIXI.Container class](https://pixijs.com/8.x/examples/basic/container), it has the same properties and methods,
288
+ * but it has the ability to be saved and loaded by the Pixi'VM library.
289
+ * @example
290
+ * ```typescript
291
+ * const container = new CanvasContainer();
292
+ * GameWindowManager.addCanvasElement(container);
293
+ * const texture = await Assets.load('https://pixijs.com/assets/bunny.png');
294
+ * for (let i = 0; i < 25; i++)
295
+ * {
296
+ * const bunny = new CanvasSprite(texture);
297
+ * bunny.x = (i % 5) * 40;
298
+ * bunny.y = Math.floor(i / 5) * 40;
299
+ * container.addChild(bunny);
300
+ * }
301
+ * ```
302
+ */
303
+ declare class CanvasContainer extends Container implements CanvasBase<ICanvasContainerMemory> {
304
+ get memory(): ICanvasContainerMemory;
305
+ set memory(value: ICanvasContainerMemory);
306
+ }
307
+
308
+ /**
309
+ * This class is a extension of the [PIXI.Sprite class](https://pixijs.com/8.x/examples/sprite/basic), it has the same properties and methods,
310
+ * but it has the ability to be saved and loaded by the Pixi'VM library.
311
+ * @example
312
+ * ```typescript
313
+ * const texture = await Assets.load('https://pixijs.com/assets/bunny.png');
314
+ * const sprite = CanvasSprite.from(texture);
315
+ *
316
+ * sprite.anchor.set(0.5);
317
+ * sprite.x = GameWindowManager.screen.width / 2;
318
+ * sprite.y = GameWindowManager.screen.height / 2;
319
+ *
320
+ * sprite.eventMode = 'static';
321
+ * sprite.cursor = 'pointer';
322
+ * sprite.onEvent('pointerdown', EventTest);
323
+ *
324
+ * GameWindowManager.addCanvasElement("bunny", sprite);
325
+ * ```
326
+ */
327
+ declare class CanvasSprite<Memory extends SpriteOptions & ICanvasBaseMemory = ICanvasSpriteMemory> extends Sprite implements CanvasBase<Memory | ICanvasSpriteMemory> {
328
+ get memory(): Memory | ICanvasSpriteMemory;
329
+ set memory(value: ICanvasSpriteMemory);
330
+ private _onEvents;
331
+ get onEvents(): {
332
+ [name: string]: string;
333
+ [name: symbol]: string;
334
+ };
335
+ /**
336
+ * is same function as on(), but it keeps in memory the children.
337
+ * @param event The event type, e.g., 'click', 'mousedown', 'mouseup', 'pointerdown', etc.
338
+ * @param eventClass The class that extends CanvasEvent.
339
+ * @returns
340
+ * @example
341
+ * ```typescript
342
+ * \@eventDecorator()
343
+ * export class EventTest extends CanvasEvent<CanvasSprite> {
344
+ * override fn(event: CanvasEventNamesType, sprite: CanvasSprite): void {
345
+ * if (event === 'pointerdown') {
346
+ * sprite.scale.x *= 1.25;
347
+ * sprite.scale.y *= 1.25;
348
+ * }
349
+ * }
350
+ * }
351
+ * ```
352
+ *
353
+ * ```typescript
354
+ * let sprite = addImage("alien", 'https://pixijs.com/assets/eggHead.png')
355
+ * await sprite.load()
356
+ *
357
+ * sprite.eventMode = 'static';
358
+ * sprite.cursor = 'pointer';
359
+ * sprite.onEvent('pointerdown', EventTest);
360
+ *
361
+ * GameWindowManager.addCanvasElement("bunny", sprite);
362
+ * ```
363
+ */
364
+ onEvent<T extends CanvasEventNamesType, T2 extends typeof CanvasEvent<typeof this>>(event: T, eventClass: T2): this;
365
+ /**
366
+ * on() does not keep in memory the event class, use onEvent() instead
367
+ * @deprecated
368
+ * @private
369
+ * @param event
370
+ * @param fn
371
+ * @param context
372
+ */
373
+ on<T extends keyof ContainerEvents | keyof {
374
+ [K: symbol]: any;
375
+ [K: {} & string]: any;
376
+ }>(event: T, fn: (...args: EventEmitter.ArgumentMap<ContainerEvents & {
377
+ [K: symbol]: any;
378
+ [K: {} & string]: any;
379
+ }>[Extract<T, keyof ContainerEvents | keyof {
380
+ [K: symbol]: any;
381
+ [K: {} & string]: any;
382
+ }>]) => void, context?: any): this;
383
+ static from(source: Texture | TextureSourceLike, skipCache?: boolean): CanvasSprite<any>;
384
+ }
385
+
386
+ /**
387
+ * This class is a extension of the CanvasSprite class, it has the same properties and methods,
388
+ * but it has some features that make texture management easier.
389
+ * You need to use CanvasImage.load() to show the image in the canvas.
390
+ * This class is used for functions like addImage, showCanvasImages and showImageWithDisolveEffect.
391
+ * @example
392
+ * ```typescript
393
+ * let alien = addImage("alien", 'https://pixijs.com/assets/eggHead.png')
394
+ * alien.anchor.set(0.5);
395
+ * alien.x = 100
396
+ * alien.y = 100
397
+ * await alien.load()
398
+ * ```
399
+ */
400
+ declare class CanvasImage extends CanvasSprite<ICanvasImageMemory> {
401
+ get memory(): ICanvasImageMemory;
402
+ set memory(memory: ICanvasImageMemory);
403
+ imageLink: string;
404
+ static from(source: Texture | TextureSourceLike, skipCache?: boolean): CanvasImage;
405
+ /**
406
+ * Load the image in the canvas.
407
+ * @returns a promise that resolves when the image is loaded.
408
+ */
409
+ load(): Promise<void>;
410
+ }
411
+
412
+ /**
413
+ * This class is a extension of the [PIXI.Text class](https://pixijs.com/8.x/examples/text/pixi-text), it has the same properties and methods,
414
+ * but it has the ability to be saved and loaded by the Pixi'VM library.
415
+ * @example
416
+ * ```typescript
417
+ * const text = new CanvasText();
418
+ * text.text = "Hello World"
419
+ * GameWindowManager.addCanvasElement("text", text);
420
+ * ```
421
+ */
422
+ declare class CanvasText extends Text implements CanvasBase<ICanvasTextMemory> {
423
+ get memory(): ICanvasTextMemory;
424
+ set memory(value: ICanvasTextMemory);
425
+ private _onEvents;
426
+ get onEvents(): {
427
+ [name: string]: string;
428
+ [name: symbol]: string;
429
+ };
430
+ /**
431
+ * is same function as on(), but it keeps in memory the children.
432
+ * @param event The event type, e.g., 'click', 'mousedown', 'mouseup', 'pointerdown', etc.
433
+ * @param eventClass The class that extends CanvasEvent.
434
+ * @returns
435
+ * @example
436
+ * ```typescript
437
+ * \@eventDecorator()
438
+ * export class EventTest extends CanvasEvent<CanvasText> {
439
+ * override fn(event: CanvasEventNamesType, text: CanvasText): void {
440
+ * if (event === 'pointerdown') {
441
+ * text.scale.x *= 1.25;
442
+ * text.scale.y *= 1.25;
443
+ * }
444
+ * }
445
+ * }
446
+ * ```
447
+ *
448
+ * ```typescript
449
+ * const text = new CanvasText();
450
+ * text.text = "Hello World"
451
+ *
452
+ * text.eventMode = 'static';
453
+ * text.cursor = 'pointer';
454
+ * text.onEvent('pointerdown', EventTest);
455
+ *
456
+ * GameWindowManager.addCanvasElement("text", text);
457
+ * ```
458
+ */
459
+ onEvent<T extends CanvasEventNamesType, T2 extends typeof CanvasEvent<typeof this>>(event: T, eventClass: T2): this;
460
+ /**
461
+ * on() does not keep in memory the event class, use onEvent() instead
462
+ * @deprecated
463
+ * @private
464
+ * @param event
465
+ * @param fn
466
+ * @param context
467
+ */
468
+ on<T extends keyof ContainerEvents | keyof {
469
+ [K: symbol]: any;
470
+ [K: {} & string]: any;
471
+ }>(event: T, fn: (...args: EventEmitter.ArgumentMap<ContainerEvents & {
472
+ [K: symbol]: any;
473
+ [K: {} & string]: any;
474
+ }>[Extract<T, keyof ContainerEvents | keyof {
475
+ [K: symbol]: any;
476
+ [K: {} & string]: any;
477
+ }>]) => void, context?: any): this;
478
+ }
479
+
480
+ interface ITicker<TArgs extends TickerArgsType> {
481
+ /**
482
+ * Arguments to pass to the ticker
483
+ */
484
+ args: TArgs;
485
+ /**
486
+ * Duration in milliseconds
487
+ */
488
+ duration?: number;
489
+ /**
490
+ * Priority of the ticker
491
+ */
492
+ priority?: UPDATE_PRIORITY;
493
+ }
494
+
495
+ /**
496
+ * StorageElementType are all the types that can be stored in the storage
497
+ */
498
+ type StorageElementType = string | number | boolean | object | undefined | null;
499
+
500
+ type TickerArgsType = {
501
+ [tag: string]: StorageElementType;
502
+ };
503
+ /**
504
+ * A class is used to create a ticker element to add into a Pixi Application.
505
+ * You can use GameWindowManager.addTicker() to add this element into the application.
506
+ * This class should be extended and the fn method should be overridden.
507
+ * You must use the tickerDecorator to register the ticker in the game.
508
+ * In Ren'Py is a transform.
509
+ * @example
510
+ * ```typescript
511
+ * \@tickerDecorator() // this is equivalent to tickerDecorator("TickerRotate")
512
+ * export class TickerRotate extends TickerBase<{ speed?: number }> {
513
+ * override fn(
514
+ * t: Ticker,
515
+ * args: {
516
+ * speed?: number,
517
+ * },
518
+ * tags: string[]
519
+ * ): void {
520
+ * let speed = args.speed === undefined ? 0.1 : args.speed
521
+ * tags.forEach((tag) => {
522
+ * let element = GameWindowManager.getCanvasElement(tag)
523
+ * if (element && element instanceof Container) {
524
+ * if (clockwise)
525
+ * element.rotation += speed * t.deltaTime
526
+ * else
527
+ * element.rotation -= speed * t.deltaTime
528
+ * }
529
+ * })
530
+ * }
531
+ * }
532
+ * ```
533
+ */
534
+ declare class TickerBase<TArgs extends TickerArgsType> implements ITicker<TArgs> {
535
+ constructor(args: TArgs, duration?: number, priority?: UPDATE_PRIORITY);
536
+ args: TArgs;
537
+ duration?: number;
538
+ priority?: UPDATE_PRIORITY;
539
+ /**
540
+ * The method that will be called every frame.
541
+ * This method should be overridden and you can use GameWindowManager.addCanvasElement() to get the canvas element of the canvas, and edit them.
542
+ * @param t The ticker that is calling this method
543
+ * @param args The arguments that you passed when you added the ticker
544
+ * @param tags The tags of the canvas elements that are connected to this ticker
545
+ */
546
+ fn(_t: Ticker, _args: TArgs, _tags: string | string[]): void;
547
+ }
548
+
549
+ /**
550
+ * A ticker that fades the alpha of the canvas element of the canvas.
551
+ * @param args The arguments that are passed to the ticker
552
+ * - speed: The speed of the fade
553
+ * - type: The type of the fade, default is "hide"
554
+ * - limit: The limit of the fade, default is 0 for hide and 1 for show
555
+ * - tagToRemoveAfter?: The tag to remove after the fade is done
556
+ * - startOnlyIfHaveTexture?: If true, the fade only starts if the canvas element have a texture
557
+ * @param duration The duration of the ticker
558
+ * @param priority The priority of the ticker
559
+ * @example
560
+ * ```typescript
561
+ * let bunny = addImage("bunny1", "https://pixijs.com/assets/eggHead.png")
562
+ * await bunny.load()
563
+ * GameWindowManager.addCanvasElement("bunny", bunny);
564
+ * // ...
565
+ * const ticker = new TickerFadeAlpha({
566
+ * speed: 0.01,
567
+ * type: "hide",
568
+ * }),
569
+ * GameWindowManager.addTicker("bunny", ticker)
570
+ * ```
571
+ */
572
+ declare class TickerFadeAlpha extends TickerBase<{
573
+ speed: number;
574
+ type?: "hide" | "show";
575
+ limit?: number;
576
+ tagToRemoveAfter?: string[] | string;
577
+ startOnlyIfHaveTexture?: boolean;
578
+ }> {
579
+ /**
580
+ * The method that will be called every frame to fade the alpha of the canvas element of the canvas.
581
+ * @param delta The delta time
582
+ * @param args The arguments that are passed to the ticker
583
+ * @param tags The tags of the canvas element that are connected to this ticker
584
+ */
585
+ fn(t: Ticker, args: {
586
+ speed?: number;
587
+ type?: "hide" | "show";
588
+ limit?: number;
589
+ tagToRemoveAfter?: string[] | string;
590
+ startOnlyIfHaveTexture?: boolean;
591
+ }, tags: string[]): void;
592
+ }
593
+
594
+ type TickerProgrationType = ITickerProgrationLinear | ITickerProgrationExponential;
595
+ interface ITickerProgrationLinear {
596
+ amt: number;
597
+ limit?: number;
598
+ type: "linear";
599
+ }
600
+ interface ITickerProgrationExponential {
601
+ percentage: number;
602
+ limit?: number;
603
+ type: "exponential";
604
+ }
605
+
606
+ /**
607
+ * A ticker that rotates the canvas element of the canvas.
608
+ * @param args The arguments that are passed to the ticker
609
+ * - speed: The speed of the rotation, default is 0.1
610
+ * - clockwise: The direction of the rotation, default is true
611
+ * - speedProgression: The progression of the speed
612
+ * - startOnlyIfHaveTexture?: If true, the rotation only starts if the canvas element have a texture
613
+ * @param duration The duration of the ticker
614
+ * @param priority The priority of the ticker
615
+ * @example
616
+ * ```typescript
617
+ * let alien = addImage("alien", 'https://pixijs.com/assets/eggHead.png')
618
+ * GameWindowManager.addCanvasElement("alien", alien);
619
+ * const ticker = new TickerRotate({
620
+ * speed: 0.1,
621
+ * clockwise: true,
622
+ * }),
623
+ * GameWindowManager.addTicker("alien", ticker)
624
+ */
625
+ declare class TickerRotate extends TickerBase<{
626
+ speed?: number;
627
+ clockwise?: boolean;
628
+ speedProgression?: TickerProgrationType;
629
+ startOnlyIfHaveTexture?: boolean;
630
+ }> {
631
+ /**
632
+ * The method that will be called every frame to rotate the canvas element of the canvas.
633
+ * @param delta The delta time
634
+ * @param args The arguments that are passed to the ticker
635
+ * @param tags The tags of the canvas element that are connected to this ticker
636
+ */
637
+ fn(t: Ticker, args: {
638
+ speed?: number;
639
+ clockwise?: boolean;
640
+ speedProgression?: TickerProgrationType;
641
+ startOnlyIfHaveTexture?: boolean;
642
+ }, tags: string[]): void;
643
+ }
644
+
645
+ type CanvasElementTagType = string;
646
+
647
+ /**
648
+ * Is a decorator that register a canvas element in the game.
649
+ * @param name Name of the canvas element, by default it will use the class name. If the name is already registered, it will show a warning
650
+ * @returns
651
+ */
652
+ declare function canvasElementDecorator(name?: CanvasElementTagType): (target: typeof CanvasBase<any>) => void;
653
+
654
+ /**
655
+ * Is a function that saves the character. If the character already exists, it will be overwritten.
656
+ * @param character is the character to save
657
+ * @returns
658
+ * @example
659
+ * ```typescript
660
+ * export const liam = new CharacterModelBase('liam', { name: 'Liam'});
661
+ * export const alice = new CharacterModelBase('alice', { name: 'Alice'});
662
+ * saveCharacter([liam, alice]);
663
+ * ```
664
+ */
665
+ declare function saveCharacter<T extends CharacterModelBase = CharacterModelBase>(character: T | T[]): void;
666
+ /**
667
+ * is a function that returns the character by the tag
668
+ * @param tag is the tag of the character
669
+ * @returns the character
670
+ * @example
671
+ * ```typescript
672
+ * const liam = getCharacterByTag('liam');
673
+ * ```
674
+ */
675
+ declare function getCharacterByTag<T extends CharacterModelBase>(tag: string): T | undefined;
676
+
677
+ /**
678
+ * Is a decorator that register a event in the game.
679
+ * Is a required decorator for use the event in the game.
680
+ * Thanks to this decoration the game has the possibility of updating the events to the latest modification and saving the game.
681
+ * @param name is th identifier of the event, by default is the name of the class
682
+ * @returns
683
+ */
684
+ declare function eventDecorator(name?: EventTagType): (target: typeof CanvasEvent<any>) => void;
685
+
686
+ /**
687
+ * LabelTagType is a string containing the name of the label.
688
+ * It is used to GameStepManager.registeredLabels to get the label class.
689
+ */
690
+ type LabelTagType = string;
691
+
692
+ /**
693
+ * Is a decorator that register a label in the game.
694
+ * Is a required decorator for use the label in the game.
695
+ * Thanks to this decoration the game has the possibility of updating the labels to the latest modification and saving the game.
696
+ * @param name is th identifier of the label, by default is the name of the class
697
+ * @returns
698
+ */
699
+ declare function labelDecorator(name?: LabelTagType): (target: typeof Label) => void;
700
+
701
+ /**
702
+ * TickerTagType is a string that represents a ticker tag.
703
+ * It is used to GameWindowManager.tickers to get the ticker class.
704
+ */
705
+ type TickerTagType = string;
706
+
707
+ /**
708
+ * Is a decorator that register a ticker in the game.
709
+ * Is a required decorator for use the ticker in the game.
710
+ * Thanks to this decoration the game has the possibility of updating the tickers to the latest modification and saving the game.
711
+ * @param name is th identifier of the label, by default is the name of the class
712
+ * @returns
713
+ */
714
+ declare function tickerDecorator(name?: TickerTagType): (target: typeof TickerBase<any>) => void;
715
+
716
+ /**
717
+ * Munu is a type that contains a list of Label that a player can choose from.
718
+ * For Ren'py this is the equivalent of a menu.
719
+ */
720
+ type MenuOptionsType = MenuOptionLabel[];
721
+
722
+ /**
723
+ * Set the dialogue to be shown in the game
724
+ * @param text Text of the dialogue
725
+ * @example
726
+ * ```typescript
727
+ * setDialogue("Hello World")
728
+ * setDialogue({
729
+ * character: "characterTag",
730
+ * text: "Hello World"
731
+ * })
732
+ * ```
733
+ */
734
+ declare function setDialogue(props: {
735
+ character: string | CharacterModelBase;
736
+ text: string;
737
+ } | string): void;
738
+ /**
739
+ * Get the dialogue to be shown in the game
740
+ * @returns Dialogue to be shown in the game
741
+ */
742
+ declare function getDialogue(): DialogueModelBase | undefined;
743
+ /**
744
+ * Clear the dialogue to be shown in the game
745
+ */
746
+ declare function clearDialogue(): void;
747
+ /**
748
+ * Set the options to be shown in the game
749
+ * @param options Options to be shown in the game
750
+ * @example
751
+ * ```typescript
752
+ * setMenuOptions([
753
+ * new MenuOptionLabel("Events Test", EventsTestLabel),
754
+ * new MenuOptionLabel("Show Image Test", ShowImageTest),
755
+ * new MenuOptionLabel("Ticker Test", TickerTestLabel),
756
+ * new MenuOptionLabel("Tinting Test", TintingTestLabel),
757
+ * new MenuOptionLabel("Base Canvas Element Test Label", BaseCanvasElementTestLabel)
758
+ * ])
759
+ * ```
760
+ */
761
+ declare function setMenuOptions(options: MenuOptionsType): void;
762
+ /**
763
+ * Get the options to be shown in the game
764
+ * @returns Options to be shown in the game
765
+ */
766
+ declare function getMenuOptions(): MenuOptionsType | undefined;
767
+ /**
768
+ * Clear the options to be shown in the game
769
+ */
770
+ declare function clearMenuOptions(): void;
771
+ /**
772
+ * Get the history of the dialogues
773
+ * @returns the history of the dialogues
774
+ */
775
+ declare function getDialogueHistory(): DialogueModelBase[];
776
+
777
+ /**
778
+ * Clear all game data. This function is used to reset the game.
779
+ */
780
+ declare function clearAllGameDatas(): void;
781
+
782
+ /**
783
+ * Add a image in the canvas.
784
+ * Is the same that showImage, but the image is not shown.
785
+ * If you want to show the image, then you need to use the function CanvasImage.load().
786
+ * @param tag is the unique tag of the image. You can use this tag to refer to this image
787
+ * @param imageUrl is the url of the image.
788
+ * @returns the container of the image.
789
+ * @example
790
+ * ```typescript
791
+ * let alien = addImage("bunny1", "https://pixijs.com/assets/eggHead.png")
792
+ * await alien.load()
793
+ * ```
794
+ */
795
+ declare function addImage(tag: string, imageUrl: string): CanvasImage;
796
+ /**
797
+ * Show a list of images in the canvas, at the same time.
798
+ * @param canvasImages is a list of images to show.
799
+ * @returns the list of images.
800
+ */
801
+ declare function showCanvasImages(canvasImages: CanvasImage[] | CanvasImage): Promise<CanvasImage[]>;
802
+ /**
803
+ * Remove a image from the canvas.
804
+ * @param tag is the unique tag of the image. You can use this tag to refer to this image
805
+ */
806
+ declare function removeCanvasElement(tag: string | string[]): void;
807
+ /**
808
+ * Show a image in the canvas with a disolve effect.
809
+ * Disolve effect is a effect that the image is shown with a fade in.
810
+ * If exist a image with the same tag, then the image is replaced. And the first image is removed after the effect is done.
811
+ * @param tag The unique tag of the image. You can use this tag to refer to this image
812
+ * @param imageUrl The url of the image.
813
+ * @param args The arguments of the effect
814
+ * @param duration The duration of the effect
815
+ * @param priority The priority of the effect
816
+ * @returns The sprite of the image.
817
+ */
818
+ declare function showImageWithDisolveEffect(tag: string, imageUrl: string, speed: number, priority?: UPDATE_PRIORITY): Promise<void>;
819
+
820
+ /**
821
+ * IClassWithArgsHistory is a class that contains the name of a class and the arguments that were used to create it.
822
+ */
823
+ interface IClassWithArgsHistory<TArgs extends TickerArgsType> {
824
+ fn: TickerCallback<any>;
825
+ className: TickerTagType;
826
+ args: TArgs;
827
+ canvasElementTags: string[];
828
+ priority?: UPDATE_PRIORITY;
829
+ duration?: number;
830
+ }
831
+ interface IClassWithArgsHistoryForExport<TArgs extends TickerArgsType> {
832
+ className: TickerTagType;
833
+ args: TArgs;
834
+ canvasElementTags: string[];
835
+ priority?: UPDATE_PRIORITY;
836
+ duration?: number;
837
+ }
838
+
839
+ /**
840
+ * Interface exported canvas
841
+ */
842
+ interface ExportedCanvas {
843
+ currentTickers: IClassWithArgsHistoryForExport<any>[];
844
+ currentElements: {
845
+ [tag: string]: ICanvasBaseMemory;
846
+ };
847
+ childrenTagsOrder: string[];
848
+ }
849
+
850
+ /**
851
+ * Interface exported storage data
852
+ */
853
+ interface ExportedStorage {
854
+ storage: {
855
+ [key: string]: StorageElementType;
856
+ };
857
+ stepOidUsedList: string[];
858
+ }
859
+
860
+ interface IOpenedLabel {
861
+ label: LabelTagType;
862
+ currentStepIndex: number;
863
+ }
864
+
865
+ /**
866
+ * IHistoryStep is a interface that contains:
867
+ * - the browser path that occurred during the progression of the steps.
868
+ * - the storage that occurred during the progression of the steps.
869
+ * - the step data.
870
+ * - the canvas that occurred during the progression of the steps.
871
+ */
872
+ interface IHistoryStep {
873
+ path: string;
874
+ storage: ExportedStorage;
875
+ stepSha1: StepHistoryDataType;
876
+ stepIndex: number;
877
+ canvas: ExportedCanvas;
878
+ openedLabels: IOpenedLabel[];
879
+ }
880
+
881
+ /**
882
+ * Interface exported step data
883
+ */
884
+ interface ExportedStep {
885
+ stepsHistory: IHistoryStep[];
886
+ openedLabels: IOpenedLabel[];
887
+ }
888
+
889
+ interface ISaveData {
890
+ version: string;
891
+ stepData: ExportedStep;
892
+ storageData: ExportedStorage;
893
+ canvasData: ExportedCanvas;
894
+ path: string;
895
+ }
896
+
897
+ /**
898
+ * Get the save data
899
+ * @returns The save data
900
+ */
901
+ declare function getSaveData(): ISaveData;
902
+ /**
903
+ * Get the save data as a JSON string
904
+ * @returns The save data as a JSON string
905
+ * @example
906
+ * ```typescript
907
+ * export function saveGame() {
908
+ * const jsonString = getSaveJson()
909
+ * const blob = new Blob([jsonString], { type: "application/json" });
910
+ * const url = URL.createObjectURL(blob);
911
+ * const a = document.createElement('a');
912
+ * a.href = url;
913
+ * a.download = "save.json";
914
+ * a.click();
915
+ * }
916
+ * ```
917
+ */
918
+ declare function getSaveJson(): string;
919
+ /**
920
+ * Load the save data
921
+ * @param data The save data
922
+ * @param navigate The function to navigate to a path
923
+ */
924
+ declare function loadSave(data: ISaveData, navigate: (path: string) => void): void;
925
+ /**
926
+ * Load the save data from a JSON string
927
+ * @param dataString The save data as a JSON string
928
+ * @param navigate The function to navigate to a path
929
+ * @example
930
+ * ```typescript
931
+ * export function loadGameSave(navigate: (path: string) => void, afterLoad?: () => void) {
932
+ * // load the save data from a JSON file
933
+ * const input = document.createElement('input');
934
+ * input.type = 'file';
935
+ * input.accept = 'application/json';
936
+ * input.onchange = (e) => {
937
+ * const file = (e.target as HTMLInputElement).files?.[0];
938
+ * if (file) {
939
+ * const reader = new FileReader();
940
+ * reader.onload = (e) => {
941
+ * const jsonString = e.target?.result as string;
942
+ * // load the save data from the JSON string
943
+ * loadSaveJsonString(jsonString, navigate);
944
+ * afterLoad && afterLoad();
945
+ * };
946
+ * reader.readAsText(file);
947
+ * }
948
+ * };
949
+ * input.click();
950
+ * }
951
+ * ```
952
+ */
953
+ declare function loadSaveJsonString(dataString: string, navigate: (path: string) => void): void;
954
+
955
+ /**
956
+ * Get a texture from a url.
957
+ * @param imageUrl is the url of the image.
958
+ * @returns the texture of the image, or a text with the error.
959
+ */
960
+ declare function getTexture(imageUrl: string): Promise<Texture | void>;
961
+
962
+ declare const PauseValueType = "Pause";
963
+ type PauseType = {
964
+ type: typeof PauseValueType;
965
+ duration: number;
966
+ };
967
+ declare function Pause(duration: number): PauseType;
968
+
969
+ type RepeatType = "Repeat";
970
+ declare const Repeat: RepeatType;
971
+
972
+ interface ITickersStep<TArgs extends TickerArgsType> extends ITicker<TArgs> {
973
+ /**
974
+ * Ticker class name
975
+ */
976
+ ticker: string;
977
+ /**
978
+ * Duration in milliseconds
979
+ */
980
+ duration: number;
981
+ }
982
+ /**
983
+ * The steps of the tickers
984
+ */
985
+ interface ITickersSteps {
986
+ /**
987
+ * The step number
988
+ */
989
+ currentStepNumber: number;
990
+ /**
991
+ * The steps of the tickers
992
+ */
993
+ steps: (ITickersStep<any> | RepeatType | PauseType)[];
994
+ }
995
+
996
+ /**
997
+ * GameHistoryManager is a class that contains the history of the game.
998
+ */
999
+ declare class GameStepManager {
1000
+ private constructor();
1001
+ /**
1002
+ * stepHistory is a list of label events and steps that occurred during the progression of the steps.
1003
+ */
1004
+ private static _stepsHistory;
1005
+ static get stepsHistory(): IHistoryStep[];
1006
+ static get lastStepIndex(): number;
1007
+ private static _openedLabels;
1008
+ static get openedLabels(): IOpenedLabel[];
1009
+ /**
1010
+ * currentLabel is the current label that occurred during the progression of the steps.
1011
+ */
1012
+ private static get currentLabel();
1013
+ /**
1014
+ * currentLabelStepIndex is the current step index of the current label that occurred during the progression of the steps.
1015
+ */
1016
+ private static get currentLabelStepIndex();
1017
+ /**
1018
+ * lastHistoryStep is the last history step that occurred during the progression of the steps.
1019
+ */
1020
+ private static get lastHistoryStep();
1021
+ /**
1022
+ * Add a label to the history.
1023
+ * @param label The label to add to the history.
1024
+ */
1025
+ private static addStepHistory;
1026
+ /**
1027
+ * Add a label to the history.
1028
+ * @param label The label to add to the history.
1029
+ */
1030
+ private static pushNewLabel;
1031
+ /**
1032
+ * Close the current label and add it to the history.
1033
+ * @returns
1034
+ */
1035
+ private static closeLabel;
1036
+ /**
1037
+ * Close all labels and add them to the history.
1038
+ */
1039
+ private static closeAllLabels;
1040
+ /**
1041
+ * Increase the current step index of the current label.
1042
+ */
1043
+ private static increaseCurrentStepIndex;
1044
+ /**
1045
+ * Execute the next step and add it to the history.
1046
+ * @returns
1047
+ * @example
1048
+ * ```typescript
1049
+ * function nextOnClick() {
1050
+ * setLoading(true)
1051
+ * GameStepManager.runNextStep()
1052
+ * .then(() => {
1053
+ * setUpdate((p) => p + 1)
1054
+ * setLoading(false)
1055
+ * })
1056
+ * .catch((e) => {
1057
+ * setLoading(false)
1058
+ * console.error(e)
1059
+ * })
1060
+ * }
1061
+ * ```
1062
+ */
1063
+ static runNextStep(): Promise<void>;
1064
+ /**
1065
+ * Execute the current step and add it to the history.
1066
+ * @returns
1067
+ */
1068
+ private static runCurrentStep;
1069
+ /**
1070
+ * Execute the label and add it to the history.
1071
+ * Is a call function in Ren'Py.
1072
+ * @param label The label to execute.
1073
+ * @returns
1074
+ * @example
1075
+ * ```typescript
1076
+ * GameStepManager.callLabel(StartLabel)
1077
+ * ```
1078
+ */
1079
+ static callLabel(label: typeof Label | Label): Promise<void>;
1080
+ /**
1081
+ * Execute the label, close all labels and add them to the history.
1082
+ * Is a jump function in Ren'Py.
1083
+ * @param label
1084
+ * @returns
1085
+ * @example
1086
+ * ```typescript
1087
+ * GameStepManager.jumpLabel(StartLabel)
1088
+ * ```
1089
+ */
1090
+ static jumpLabel(label: typeof Label | Label): Promise<void>;
1091
+ /**
1092
+ * Go back to the last step and add it to the history.
1093
+ * @param navigate The navigate function.
1094
+ * @param steps The number of steps to go back.
1095
+ * @returns
1096
+ * @example
1097
+ * ```typescript
1098
+ * export function goBack(navigate: (path: string) => void, afterBack?: () => void) {
1099
+ * GameStepManager.goBack(navigate)
1100
+ * afterBack && afterBack()
1101
+ * }
1102
+ * ```
1103
+ */
1104
+ static goBack(navigate: (path: string) => void, steps?: number): void;
1105
+ private static goBackInstrnal;
1106
+ /**
1107
+ * Add a label to the history.
1108
+ */
1109
+ static clear(): void;
1110
+ /**
1111
+ * Export the history to a JSON string.
1112
+ * @returns The history in a JSON string.
1113
+ */
1114
+ static exportJson(): string;
1115
+ /**
1116
+ * Export the history to an object.
1117
+ * @returns The history in an object.
1118
+ */
1119
+ static export(): ExportedStep;
1120
+ /**
1121
+ * Import the history from a JSON string.
1122
+ * @param dataString The history in a JSON string.
1123
+ */
1124
+ static importJson(dataString: string): void;
1125
+ /**
1126
+ * Import the history from an object.
1127
+ * @param data The history in an object.
1128
+ */
1129
+ static import(data: object): void;
1130
+ }
1131
+
1132
+ declare class GameStorageManager {
1133
+ private static oidsUsed;
1134
+ private static storage;
1135
+ private constructor();
1136
+ static get keysSystem(): {
1137
+ CURRENT_DIALOGUE_MEMORY_KEY: string;
1138
+ LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY: string;
1139
+ CURRENT_MENU_OPTIONS_MEMORY_KEY: string;
1140
+ };
1141
+ /**
1142
+ * Get a new oid that is not used yet
1143
+ * @returns A new oid that is not used yet
1144
+ */
1145
+ static getNewOid(): string;
1146
+ /**
1147
+ * Set a variable in the storage
1148
+ * @param key The key of the variable
1149
+ * @param value The value of the variable. If undefined, the variable will be removed
1150
+ * @returns
1151
+ */
1152
+ static setVariable(key: string, value: StorageElementType): void;
1153
+ /**
1154
+ * Get a variable from the storage
1155
+ * @param key The key of the variable
1156
+ * @returns The value of the variable. If the variable does not exist, it will return undefined
1157
+ */
1158
+ static getVariable<T extends StorageElementType>(key: string): T | undefined;
1159
+ /**
1160
+ * Remove a variable from the storage
1161
+ * @param key The key of the variable
1162
+ * @returns
1163
+ */
1164
+ static removeVariable(key: string): void;
1165
+ /**
1166
+ * Clear the storage and the oidsUsed
1167
+ * @returns
1168
+ */
1169
+ static clear(): void;
1170
+ static exportJson(): string;
1171
+ static export(): ExportedStorage;
1172
+ static importJson(dataString: string): void;
1173
+ static import(data: object): void;
1174
+ }
1175
+
1176
+ /**
1177
+ * This class is responsible for managing the canvas, the tickers, the events, and the window size and the children of the window.
1178
+ */
1179
+ declare class GameWindowManager {
1180
+ private constructor();
1181
+ private static _app;
1182
+ /**
1183
+ * The PIXI Application instance.
1184
+ * It not recommended to use this property directly.
1185
+ */
1186
+ static get app(): Application<pixi_js.Renderer>;
1187
+ private static _isInitialized;
1188
+ /**
1189
+ * If the manager is initialized.
1190
+ */
1191
+ static get isInitialized(): boolean;
1192
+ /**
1193
+ * This is the div that have same size of the canvas.
1194
+ * This is useful to put interface elements.
1195
+ * You can use React or other framework to put elements in this div.
1196
+ */
1197
+ static htmlLayout: HTMLElement;
1198
+ static canvasWidth: number;
1199
+ static canvasHeight: number;
1200
+ static get screen(): pixi_js.Rectangle;
1201
+ /**
1202
+ * Initialize the PIXI Application and the interface div.
1203
+ * This method should be called before any other method.
1204
+ * @param element The html element where I will put the canvas. Example: document.body
1205
+ * @param width The width of the canvas
1206
+ * @param height The height of the canvas
1207
+ * @param options The options of PIXI Application
1208
+ * @example
1209
+ * ```typescript
1210
+ * const body = document.body
1211
+ * if (!body) {
1212
+ * throw new Error('body element not found')
1213
+ * }
1214
+ * await GameWindowManager.initialize(body, 1920, 1080, {
1215
+ * backgroundColor: "#303030"
1216
+ * })
1217
+ * ```
1218
+ */
1219
+ static initialize(element: HTMLElement, width: number, height: number, options?: Partial<ApplicationOptions>): Promise<void>;
1220
+ /**
1221
+ * Add the canvas into a html element.
1222
+ * @param element it is the html element where I will put the canvas. Example: document.body
1223
+ */
1224
+ static addCanvasIntoElement(element: HTMLElement): void;
1225
+ /**
1226
+ * Initialize the interface div and add it into a html element.
1227
+ * @param element it is the html element where I will put the interface div. Example: document.getElementById('root')
1228
+ * @example
1229
+ * ```typescript
1230
+ * const root = document.getElementById('root')
1231
+ * if (!root) {
1232
+ * throw new Error('root element not found')
1233
+ * }
1234
+ * GameWindowManager.initializeHTMLLayout(root)
1235
+ * const reactRoot = createRoot(GameWindowManager.htmlLayout)
1236
+ * reactRoot.render(
1237
+ * <App />
1238
+ * )
1239
+ * ```
1240
+ */
1241
+ static initializeHTMLLayout(element: HTMLElement): void;
1242
+ /**
1243
+ * This method returns the scale of the screen.
1244
+ */
1245
+ static get screenScale(): number;
1246
+ /**
1247
+ * This method returns the width of the screen enlarged by the scale.
1248
+ */
1249
+ static get screenWidth(): number;
1250
+ /**
1251
+ * This method returns the height of the screen enlarged by the scale.
1252
+ */
1253
+ static get screenHeight(): number;
1254
+ /**
1255
+ * This method returns the horizontal margin of the screen.
1256
+ */
1257
+ static get horizontalMargin(): number;
1258
+ /**
1259
+ * This method returns the vertical margin of the screen.
1260
+ */
1261
+ static get verticalMargin(): number;
1262
+ /**
1263
+ * This method is called when the screen is resized.
1264
+ */
1265
+ private static resize;
1266
+ /**
1267
+ * This is a dictionary that contains all Canvas Elements of Canvas, currently.
1268
+ */
1269
+ static get currentCanvasElements(): {
1270
+ [tag: string]: CanvasBase<any>;
1271
+ };
1272
+ private static _children;
1273
+ /**
1274
+ * The order of the children tags.
1275
+ */
1276
+ private static childrenTagsOrder;
1277
+ /**
1278
+ * Add a canvas element to the canvas.
1279
+ * If there is a canvas element with the same tag, it will be removed.
1280
+ * @param tag The tag of the canvas element.
1281
+ * @param canvasElement The canvas elements to be added.
1282
+ * @example
1283
+ * ```typescript
1284
+ * const texture = await Assets.load('https://pixijs.com/assets/bunny.png');
1285
+ * const sprite = CanvasSprite.from(texture);
1286
+ * GameWindowManager.addCanvasElement("bunny", sprite);
1287
+ * ```
1288
+ */
1289
+ static addCanvasElement(tag: string, canvasElement: CanvasBase<any>): void;
1290
+ /**
1291
+ * Remove a canvas element from the canvas.
1292
+ * And remove all tickers that are not connected to any canvas element.
1293
+ * @param tag The tag of the canvas element to be removed.
1294
+ * @returns
1295
+ * @example
1296
+ * ```typescript
1297
+ * GameWindowManager.removeCanvasElement("bunny");
1298
+ * ```
1299
+ */
1300
+ static removeCanvasElement(tag: string | string[]): void;
1301
+ /**
1302
+ * Get a canvas element by the tag.
1303
+ * @param tag The tag of the canvas element.
1304
+ * @returns The canvas element.
1305
+ * @example
1306
+ * ```typescript
1307
+ * const sprite = GameWindowManager.getCanvasElement<CanvasSprite>("bunny");
1308
+ * ```
1309
+ */
1310
+ static getCanvasElement<T extends CanvasBase<any>>(tag: string): T | undefined;
1311
+ /**
1312
+ * Check if a DisplayObject is on the canvas.
1313
+ * @param pixiElement The DisplayObject to be checked.
1314
+ * @returns If the DisplayObject is on the canvas.
1315
+ */
1316
+ static canvasElementIsOnCanvas<T extends Container>(pixiElement: T): boolean;
1317
+ /**
1318
+ * Remove all canvas elements from the canvas.
1319
+ * And remove all tickers that are not connected to any canvas element.
1320
+ */
1321
+ static removeCanvasElements(): void;
1322
+ /**
1323
+ * Edit the tag of a canvas element.
1324
+ * @param oldTag The old tag of the canvas element.
1325
+ * @param newTag The new tag of the canvas element.
1326
+ */
1327
+ static editTagCanvasElement(oldTag: string, newTag: string): void;
1328
+ /** Edit Tickers Methods */
1329
+ /**
1330
+ * Currently tickers that are running.
1331
+ */
1332
+ static get currentTickers(): IClassWithArgsHistory<any>[];
1333
+ private static _currentTickers;
1334
+ /**
1335
+ * The steps of the tickers
1336
+ */
1337
+ static get currentTickersSteps(): {
1338
+ [tag: string]: ITickersSteps;
1339
+ };
1340
+ private static _currentTickersSteps;
1341
+ static currentTickersTimeouts: {
1342
+ [timeout: string]: {
1343
+ tags: string[];
1344
+ ticker: string;
1345
+ };
1346
+ };
1347
+ /**
1348
+ * Run a ticker.
1349
+ * @param canvasEslementTag The tag of the canvas element that will use the ticker.
1350
+ * @param ticker The ticker class to be run.
1351
+ * @param args The arguments to be used in the ticker.
1352
+ * @param duration The time to be used in the ticker. This number is in milliseconds. If it is undefined, the ticker will run forever.
1353
+ * @param priority The priority to be used in the ticker.
1354
+ * @returns
1355
+ * @example
1356
+ * ```typescript
1357
+ * GameWindowManager.addTicker("alien", new TickerRotate({ speed: 0.2 }))
1358
+ * ```
1359
+ */
1360
+ static addTicker<TArgs extends TickerArgsType>(canvasElementTag: string | string[], ticker: TickerBase<TArgs>): void;
1361
+ private static pushTicker;
1362
+ /**
1363
+ * Run a sequence of tickers.
1364
+ * @param tag The tag of canvas element that will use the tickers.
1365
+ * @param steps The steps of the tickers.
1366
+ * @returns
1367
+ * @example
1368
+ * ```typescript
1369
+ * GameWindowManager.addTickersSteps("alien", [
1370
+ * new TickerRotate({ speed: 0.1, clockwise: true }, 2000),
1371
+ * Pause(500),
1372
+ * new TickerRotate({ speed: 0.2, clockwise: false }, 2000),
1373
+ * Repeat,
1374
+ * ])
1375
+ * ```
1376
+ */
1377
+ static addTickersSteps<TArgs extends TickerArgsType>(tag: string, steps: (ITicker<TArgs> | RepeatType | PauseType)[]): void;
1378
+ private static runTickersSteps;
1379
+ private static nextTickerStep;
1380
+ /**
1381
+ * Remove a connection between a canvas element and a ticker.
1382
+ * And remove the ticker if there is no canvas element connected to it.
1383
+ * @param tag The tag of the canvas element that will use the ticker.
1384
+ * @param ticker The ticker class to be removed.
1385
+ * @example
1386
+ * ```typescript
1387
+ * GameWindowManager.removeAssociationBetweenTickerCanvasElement("alien", TickerRotate)
1388
+ * ```
1389
+ */
1390
+ static removeAssociationBetweenTickerCanvasElement(tag: string | string[], ticker: typeof TickerBase<any> | TickerBase<any>): void;
1391
+ /**
1392
+ * Remove all tickers that are not connected to any existing canvas element.
1393
+ */
1394
+ private static removeTickersWithoutAssociatedCanvasElement;
1395
+ private static addTickerTimeoutInfo;
1396
+ private static removeTickerTimeoutInfo;
1397
+ /**
1398
+ * Remove all tickers from the canvas.
1399
+ */
1400
+ static removeTickers(): void;
1401
+ /**
1402
+ * Clear the canvas and the tickers.
1403
+ */
1404
+ static clear(): void;
1405
+ /**
1406
+ * Export the canvas and the tickers to a JSON string.
1407
+ * @returns The JSON string.
1408
+ */
1409
+ static exportJson(): string;
1410
+ /**
1411
+ * Export the canvas and the tickers to an object.
1412
+ * @returns The object.
1413
+ */
1414
+ static export(): ExportedCanvas;
1415
+ /**
1416
+ * Import the canvas and the tickers from a JSON string.
1417
+ * @param dataString The JSON string.
1418
+ */
1419
+ static importJson(dataString: string): void;
1420
+ /**
1421
+ * Import the canvas and the tickers from an object.
1422
+ * @param data The object.
1423
+ */
1424
+ static import(data: object): void;
1425
+ }
1426
+
1427
+ export { CanvasBase, CanvasContainer, CanvasEvent, type CanvasEventNamesType, CanvasImage, CanvasSprite, CanvasText, CharacterModelBase, DialogueModelBase, type ExportedCanvas, type ExportedStep, type ExportedStorage, GameStepManager, GameStorageManager, GameWindowManager, type ICanvasBaseMemory, type ICanvasContainerMemory, type ICanvasImageMemory, type ICanvasSpriteBaseMemory, type ICanvasSpriteMemory, type ICanvasTextMemory as ICanvasTextTextMemory, type IClassWithArgsHistory, type IClassWithArgsHistoryForExport, type IHistoryStep, type IOpenedLabel, type ISaveData, type ITextureMemory, type ITicker, type ITickersSteps, Label, LabelRunModeEnum, MenuOptionLabel, type MenuOptionsType, Pause, type PauseType, PauseValueType, Repeat, type RepeatType, type StepLabelType, type StorageElementType, StoredClassModel, TickerBase, TickerFadeAlpha, type TickerProgrationType, TickerRotate, addImage, canvasElementDecorator, clearAllGameDatas, clearDialogue, clearMenuOptions, eventDecorator, getCharacterByTag, getDialogue, getDialogueHistory, getMenuOptions, getSaveData, getSaveJson, getTexture, labelDecorator, loadSave, loadSaveJsonString, removeCanvasElement, saveCharacter, setDialogue, setMenuOptions, showCanvasImages, showImageWithDisolveEffect, tickerDecorator };