@drincs/pixi-vn 0.3.5 → 0.4.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.
- package/README.md +2 -81
- package/dist/index.d.mts +245 -149
- package/dist/index.d.ts +245 -149
- package/dist/index.js +94 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +91 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Pixi'VN -
|
|
1
|
+
# Pixi'VN - PixiJS Visual Novel Engine
|
|
2
2
|
|
|
3
3
|
Pixi'VN is a npm package that provides various features for creating visual novels.
|
|
4
4
|
|
|
@@ -9,85 +9,6 @@ Pixi'VN is based on [Pixi.js](https://pixijs.com/), a modern 2D rendering engine
|
|
|
9
9
|
In addition to managing the Pixi.js "Canvas", Pixi'VN offers the possibility of adding an HTML Element with the same dimensions as the "Canvas" to add interactions with the user.
|
|
10
10
|
This allows the use of systems such as React, Vue, Angular, etc. to create much more complex interfaces with excellent performance.
|
|
11
11
|
|
|
12
|
-
## Get Started
|
|
13
|
-
|
|
14
|
-
### Installation
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
npm install @drincs/pixi-vn
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
### Usage
|
|
21
|
-
|
|
22
|
-
For the following example, we will use React to create the interface and Pixi'VN to manage the visual novel.
|
|
23
|
-
|
|
24
|
-
```typescript
|
|
25
|
-
// main.tsx
|
|
26
|
-
|
|
27
|
-
import { GameWindowManager } from '@drincs/pixi-vn'
|
|
28
|
-
import { createRoot } from 'react-dom/client'
|
|
29
|
-
import App from './App'
|
|
30
|
-
import './index.css'
|
|
31
|
-
|
|
32
|
-
// Canvas setup with PIXI
|
|
33
|
-
const body = document.body
|
|
34
|
-
if (!body) {
|
|
35
|
-
throw new Error('body element not found')
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
GameWindowManager.initialize(body, 1920, 1080, {
|
|
39
|
-
backgroundColor: "#303030"
|
|
40
|
-
}).then(() => {
|
|
41
|
-
// React setup with ReactDOM
|
|
42
|
-
const root = document.getElementById('root')
|
|
43
|
-
if (!root) {
|
|
44
|
-
throw new Error('root element not found')
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
GameWindowManager.initializeHTMLLayout(root)
|
|
48
|
-
const reactRoot = createRoot(GameWindowManager.htmlLayout)
|
|
49
|
-
|
|
50
|
-
reactRoot.render(
|
|
51
|
-
<App />
|
|
52
|
-
)
|
|
53
|
-
})
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
This is the HTML file that will be used to load the application.
|
|
57
|
-
|
|
58
|
-
```html
|
|
59
|
-
<!-- index.html -->
|
|
60
|
-
<!doctype html>
|
|
61
|
-
<html lang="en">
|
|
62
|
-
<head>
|
|
63
|
-
<meta charset="UTF-8" />
|
|
64
|
-
<link rel="icon" type="image/svg+xml" href="/pixiVN.svg" />
|
|
65
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
66
|
-
<title>Pixi'VN</title>
|
|
67
|
-
</head>
|
|
68
|
-
<body>
|
|
69
|
-
<div id="root"></div>
|
|
70
|
-
<script type="module" src="/src/main.tsx"></script>
|
|
71
|
-
</body>
|
|
72
|
-
</html>
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
```css
|
|
76
|
-
/* index.css */
|
|
77
|
-
:root {
|
|
78
|
-
background-color: #242424;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
body {
|
|
82
|
-
margin: 0;
|
|
83
|
-
display: flex;
|
|
84
|
-
}
|
|
85
|
-
```
|
|
86
|
-
|
|
87
12
|
## Wiki
|
|
88
13
|
|
|
89
|
-
For more information, visit the [
|
|
90
|
-
|
|
91
|
-
## Why Pixi'VN?
|
|
92
|
-
|
|
93
|
-
The reason why Pixi'VN was born is that current systems for creating a visual novel are based on dated systems and have many shortcomings.
|
|
14
|
+
For more information, visit the [Web Page](https://pixi-vn.web.app/)
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as pixi_js from 'pixi.js';
|
|
2
2
|
import { ContainerOptions, SpriteOptions, TextOptions, Container, Sprite, ContainerEvents, EventEmitter, Texture, TextureSourceLike, Text, UPDATE_PRIORITY, Ticker, TickerCallback, Application, ApplicationOptions } from 'pixi.js';
|
|
3
|
+
export { Assets } from 'pixi.js';
|
|
3
4
|
import deepDiff from 'deep-diff';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -273,11 +274,11 @@ declare class ChoiceMenuOptionLabel {
|
|
|
273
274
|
*/
|
|
274
275
|
constructor(text: string, label: typeof Label, type?: LabelRunModeEnum);
|
|
275
276
|
}
|
|
276
|
-
|
|
277
|
+
type IStoratedChoiceMenuOptionLabel = {
|
|
277
278
|
text: string;
|
|
278
279
|
label: LabelIdType;
|
|
279
280
|
type: LabelRunModeEnum;
|
|
280
|
-
}
|
|
281
|
+
};
|
|
281
282
|
|
|
282
283
|
/**
|
|
283
284
|
* Munu is a type that contains a list of Label that a player can choose from.
|
|
@@ -295,11 +296,29 @@ declare function Pause(duration: number): PauseType;
|
|
|
295
296
|
type RepeatType = "Repeat";
|
|
296
297
|
declare const Repeat: RepeatType;
|
|
297
298
|
|
|
299
|
+
type StorageElementPrimaryType = string | number | boolean | undefined | null | StorageElementPrimaryType[];
|
|
300
|
+
type StorageElementInternalType = StorageElementPrimaryType | Record<string | number | symbol, StorageElementPrimaryType> | StorageElementInternalType[];
|
|
298
301
|
/**
|
|
299
302
|
* StorageElementType are all the types that can be stored in the storage
|
|
300
303
|
*/
|
|
301
|
-
type StorageElementType =
|
|
304
|
+
type StorageElementType = StorageElementInternalType | Record<string | number | symbol, StorageElementInternalType> | {
|
|
305
|
+
[key: string | number | symbol]: StorageElementType;
|
|
306
|
+
};
|
|
302
307
|
|
|
308
|
+
type DialogueData = {
|
|
309
|
+
/**
|
|
310
|
+
* The text of the dialogue.
|
|
311
|
+
*/
|
|
312
|
+
text: string;
|
|
313
|
+
/**
|
|
314
|
+
* The id of the character that is speaking.
|
|
315
|
+
*/
|
|
316
|
+
characterId?: string;
|
|
317
|
+
/**
|
|
318
|
+
* Other parameters that can be stored in the dialogue.
|
|
319
|
+
*/
|
|
320
|
+
oltherParams?: Record<string | number | symbol, StorageElementType>;
|
|
321
|
+
};
|
|
303
322
|
/**
|
|
304
323
|
* Base class for all dialogue models.
|
|
305
324
|
* You can extend this class, but it is not reccomended. You can use the oltherParams property to store any other data you need.
|
|
@@ -308,13 +327,13 @@ type StorageElementType = string | number | boolean | object | undefined | null;
|
|
|
308
327
|
* setDialogue(new DialogueBaseModel("Hello World", character))
|
|
309
328
|
* ```
|
|
310
329
|
*/
|
|
311
|
-
declare class DialogueBaseModel<TCharacter extends CharacterBaseModel = CharacterBaseModel> {
|
|
330
|
+
declare class DialogueBaseModel<TCharacter extends CharacterBaseModel = CharacterBaseModel> implements DialogueData {
|
|
312
331
|
/**
|
|
313
332
|
* @param text The text of the dialogue.
|
|
314
333
|
* @param character The id of the character that is speaking.
|
|
315
334
|
* @param oltherParams Other parameters that can be stored in the dialogue.
|
|
316
335
|
*/
|
|
317
|
-
constructor(text: string, character
|
|
336
|
+
constructor(text: string | DialogueData, character?: string | TCharacter, oltherParams?: {
|
|
318
337
|
[key: string]: StorageElementType;
|
|
319
338
|
});
|
|
320
339
|
/**
|
|
@@ -331,6 +350,12 @@ declare class DialogueBaseModel<TCharacter extends CharacterBaseModel = Characte
|
|
|
331
350
|
oltherParams: {
|
|
332
351
|
[key: string]: StorageElementType;
|
|
333
352
|
};
|
|
353
|
+
/**
|
|
354
|
+
* Export the dialogue to a DialogueBaseData object.
|
|
355
|
+
*
|
|
356
|
+
* @returns The data of the dialogue.
|
|
357
|
+
*/
|
|
358
|
+
export(): DialogueData;
|
|
334
359
|
}
|
|
335
360
|
|
|
336
361
|
/**
|
|
@@ -519,11 +544,26 @@ declare class CanvasSprite<Memory extends SpriteOptions & ICanvasBaseMemory = IC
|
|
|
519
544
|
static from(source: Texture | TextureSourceLike, skipCache?: boolean): CanvasSprite<any>;
|
|
520
545
|
}
|
|
521
546
|
|
|
547
|
+
interface CanvasImageOptions extends SpriteOptions {
|
|
548
|
+
/**
|
|
549
|
+
* The image link to load in the canvas.
|
|
550
|
+
*/
|
|
551
|
+
textureImage?: string;
|
|
552
|
+
}
|
|
522
553
|
/**
|
|
523
554
|
* This class is a extension of the CanvasSprite class, it has the same properties and methods,
|
|
524
555
|
* but it has some features that make texture management easier.
|
|
525
556
|
* You need to use CanvasImage.load() to show the image in the canvas.
|
|
526
|
-
* This class is used for functions like addImage,
|
|
557
|
+
* This class is used for functions like addImage, loadImages and showImageWithDissolveTransition.
|
|
558
|
+
* @example
|
|
559
|
+
* ```typescript
|
|
560
|
+
* let alien = new CanvasImage({ textureImage: 'https://pixijs.com/assets/eggHead.png' })
|
|
561
|
+
* alien.anchor.set(0.5);
|
|
562
|
+
* alien.x = 100
|
|
563
|
+
* alien.y = 100
|
|
564
|
+
* await alien.load()
|
|
565
|
+
* GameWindowManager.addCanvasElement("alien", alien)
|
|
566
|
+
* ```
|
|
527
567
|
* @example
|
|
528
568
|
* ```typescript
|
|
529
569
|
* let alien = addImage("alien", 'https://pixijs.com/assets/eggHead.png')
|
|
@@ -534,6 +574,7 @@ declare class CanvasSprite<Memory extends SpriteOptions & ICanvasBaseMemory = IC
|
|
|
534
574
|
* ```
|
|
535
575
|
*/
|
|
536
576
|
declare class CanvasImage extends CanvasSprite<ICanvasImageMemory> {
|
|
577
|
+
constructor(options?: CanvasImageOptions | Texture | undefined);
|
|
537
578
|
get memory(): ICanvasImageMemory;
|
|
538
579
|
set memory(memory: ICanvasImageMemory);
|
|
539
580
|
imageLink: string;
|
|
@@ -682,16 +723,33 @@ declare class TickerBase<TArgs extends TickerArgsType> implements ITicker<TArgs>
|
|
|
682
723
|
fn(_t: Ticker, _args: TArgs, _tags: string | string[]): void;
|
|
683
724
|
}
|
|
684
725
|
|
|
726
|
+
type TickerFadeAlphaProps = {
|
|
727
|
+
/**
|
|
728
|
+
* The speed of the fade
|
|
729
|
+
*/
|
|
730
|
+
speed?: number;
|
|
731
|
+
/**
|
|
732
|
+
* The type of the fade
|
|
733
|
+
* @default "hide"
|
|
734
|
+
*/
|
|
735
|
+
type?: "hide" | "show";
|
|
736
|
+
/**
|
|
737
|
+
* The limit of the fade
|
|
738
|
+
* @default type === "hide" ? 0 : 1
|
|
739
|
+
*/
|
|
740
|
+
limit?: number;
|
|
741
|
+
/**
|
|
742
|
+
* The tag to remove after the fade is done
|
|
743
|
+
*/
|
|
744
|
+
tagToRemoveAfter?: string[] | string;
|
|
745
|
+
/**
|
|
746
|
+
* If true, the fade only starts if the canvas element have a texture
|
|
747
|
+
*/
|
|
748
|
+
startOnlyIfHaveTexture?: boolean;
|
|
749
|
+
};
|
|
750
|
+
|
|
685
751
|
/**
|
|
686
752
|
* A ticker that fades the alpha of the canvas element of the canvas.
|
|
687
|
-
* @param args The arguments that are passed to the ticker
|
|
688
|
-
* - speed: The speed of the fade
|
|
689
|
-
* - type: The type of the fade, default is "hide"
|
|
690
|
-
* - limit: The limit of the fade, default is 0 for hide and 1 for show
|
|
691
|
-
* - tagToRemoveAfter?: The tag to remove after the fade is done
|
|
692
|
-
* - startOnlyIfHaveTexture?: If true, the fade only starts if the canvas element have a texture
|
|
693
|
-
* @param duration The duration of the ticker
|
|
694
|
-
* @param priority The priority of the ticker
|
|
695
753
|
* @example
|
|
696
754
|
* ```typescript
|
|
697
755
|
* let bunny = addImage("bunny1", "https://pixijs.com/assets/eggHead.png")
|
|
@@ -705,153 +763,22 @@ declare class TickerBase<TArgs extends TickerArgsType> implements ITicker<TArgs>
|
|
|
705
763
|
* GameWindowManager.addTicker("bunny", ticker)
|
|
706
764
|
* ```
|
|
707
765
|
*/
|
|
708
|
-
declare class TickerFadeAlpha extends TickerBase<{
|
|
709
|
-
speed: number;
|
|
710
|
-
type?: "hide" | "show";
|
|
711
|
-
limit?: number;
|
|
712
|
-
tagToRemoveAfter?: string[] | string;
|
|
713
|
-
startOnlyIfHaveTexture?: boolean;
|
|
714
|
-
}> {
|
|
766
|
+
declare class TickerFadeAlpha extends TickerBase<TickerFadeAlphaProps> {
|
|
715
767
|
/**
|
|
716
768
|
* The method that will be called every frame to fade the alpha of the canvas element of the canvas.
|
|
717
769
|
* @param delta The delta time
|
|
718
770
|
* @param args The arguments that are passed to the ticker
|
|
719
771
|
* @param tags The tags of the canvas element that are connected to this ticker
|
|
720
772
|
*/
|
|
721
|
-
fn(t: Ticker, args:
|
|
722
|
-
speed?: number;
|
|
723
|
-
type?: "hide" | "show";
|
|
724
|
-
limit?: number;
|
|
725
|
-
tagToRemoveAfter?: string[] | string;
|
|
726
|
-
startOnlyIfHaveTexture?: boolean;
|
|
727
|
-
}, tags: string[]): void;
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
type TickerProgrationType = ITickerProgrationLinear | ITickerProgrationExponential;
|
|
731
|
-
interface ITickerProgrationLinear {
|
|
732
|
-
amt: number;
|
|
733
|
-
limit?: number;
|
|
734
|
-
type: "linear";
|
|
735
|
-
}
|
|
736
|
-
interface ITickerProgrationExponential {
|
|
737
|
-
percentage: number;
|
|
738
|
-
limit?: number;
|
|
739
|
-
type: "exponential";
|
|
773
|
+
fn(t: Ticker, args: TickerFadeAlphaProps, tags: string[]): void;
|
|
740
774
|
}
|
|
741
775
|
|
|
742
|
-
/**
|
|
743
|
-
* A ticker that rotates the canvas element of the canvas.
|
|
744
|
-
* @param args The arguments that are passed to the ticker
|
|
745
|
-
* - speed: The speed of the rotation, default is 0.1
|
|
746
|
-
* - clockwise: The direction of the rotation, default is true
|
|
747
|
-
* - speedProgression: The progression of the speed
|
|
748
|
-
* - startOnlyIfHaveTexture?: If true, the rotation only starts if the canvas element have a texture
|
|
749
|
-
* @param duration The duration of the ticker
|
|
750
|
-
* @param priority The priority of the ticker
|
|
751
|
-
* @example
|
|
752
|
-
* ```typescript
|
|
753
|
-
* let alien = addImage("alien", 'https://pixijs.com/assets/eggHead.png')
|
|
754
|
-
* GameWindowManager.addCanvasElement("alien", alien);
|
|
755
|
-
* const ticker = new TickerRotate({
|
|
756
|
-
* speed: 0.1,
|
|
757
|
-
* clockwise: true,
|
|
758
|
-
* }),
|
|
759
|
-
* GameWindowManager.addTicker("alien", ticker)
|
|
760
|
-
*/
|
|
761
|
-
declare class TickerRotate extends TickerBase<{
|
|
762
|
-
speed?: number;
|
|
763
|
-
clockwise?: boolean;
|
|
764
|
-
speedProgression?: TickerProgrationType;
|
|
765
|
-
startOnlyIfHaveTexture?: boolean;
|
|
766
|
-
}> {
|
|
767
|
-
/**
|
|
768
|
-
* The method that will be called every frame to rotate the canvas element of the canvas.
|
|
769
|
-
* @param delta The delta time
|
|
770
|
-
* @param args The arguments that are passed to the ticker
|
|
771
|
-
* @param tags The tags of the canvas element that are connected to this ticker
|
|
772
|
-
*/
|
|
773
|
-
fn(t: Ticker, args: {
|
|
774
|
-
speed?: number;
|
|
775
|
-
clockwise?: boolean;
|
|
776
|
-
speedProgression?: TickerProgrationType;
|
|
777
|
-
startOnlyIfHaveTexture?: boolean;
|
|
778
|
-
}, tags: string[]): void;
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
type CanvasElementTagType = string;
|
|
782
|
-
|
|
783
|
-
/**
|
|
784
|
-
* Is a decorator that register a canvas element in the game.
|
|
785
|
-
* @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
|
|
786
|
-
* @returns
|
|
787
|
-
*/
|
|
788
|
-
declare function canvasElementDecorator(name?: CanvasElementTagType): (target: typeof CanvasBase<any>) => void;
|
|
789
|
-
|
|
790
|
-
/**
|
|
791
|
-
* Is a function that saves the character. If the character already exists, it will be overwritten.
|
|
792
|
-
* @param character is the character to save
|
|
793
|
-
* @returns
|
|
794
|
-
* @example
|
|
795
|
-
* ```typescript
|
|
796
|
-
* export const liam = new CharacterBaseModel('liam', { name: 'Liam'});
|
|
797
|
-
* export const alice = new CharacterBaseModel('alice', { name: 'Alice'});
|
|
798
|
-
* saveCharacter([liam, alice]);
|
|
799
|
-
* ```
|
|
800
|
-
*/
|
|
801
|
-
declare function saveCharacter<T extends CharacterBaseModel = CharacterBaseModel>(character: T | T[]): void;
|
|
802
|
-
/**
|
|
803
|
-
* is a function that returns the character by the id
|
|
804
|
-
* @param id is the id of the character
|
|
805
|
-
* @returns the character
|
|
806
|
-
* @example
|
|
807
|
-
* ```typescript
|
|
808
|
-
* const liam = getCharacterById('liam');
|
|
809
|
-
* ```
|
|
810
|
-
*/
|
|
811
|
-
declare function getCharacterById<T extends CharacterBaseModel>(id: string): T | undefined;
|
|
812
|
-
/**
|
|
813
|
-
* is a function that returns all characters
|
|
814
|
-
* @returns all characters
|
|
815
|
-
* @example
|
|
816
|
-
* ```typescript
|
|
817
|
-
* const allCharacters = getAllCharacters();
|
|
818
|
-
* ```
|
|
819
|
-
*/
|
|
820
|
-
declare function getAllCharacters<T extends CharacterBaseModel>(): T[];
|
|
821
|
-
|
|
822
|
-
/**
|
|
823
|
-
* Is a decorator that register a event in the game.
|
|
824
|
-
* Is a required decorator for use the event in the game.
|
|
825
|
-
* Thanks to this decoration the game has the possibility of updating the events to the latest modification and saving the game.
|
|
826
|
-
* @param name is th identifier of the event, by default is the name of the class
|
|
827
|
-
* @returns
|
|
828
|
-
*/
|
|
829
|
-
declare function eventDecorator(name?: EventIdType): (target: typeof CanvasEvent<any>) => void;
|
|
830
|
-
|
|
831
|
-
/**
|
|
832
|
-
* Is a decorator that register a label in the game.
|
|
833
|
-
* Is a required decorator for use the label in the game.
|
|
834
|
-
* Thanks to this decoration the game has the possibility of updating the labels to the latest modification and saving the game.
|
|
835
|
-
* @param name is th identifier of the label, by default is the name of the class
|
|
836
|
-
* @returns
|
|
837
|
-
*/
|
|
838
|
-
declare function labelDecorator(name?: LabelIdType): (target: typeof Label) => void;
|
|
839
|
-
|
|
840
776
|
/**
|
|
841
777
|
* is a string that represents a ticker id.
|
|
842
778
|
* It is used to GameWindowManager.tickers to get the ticker class.
|
|
843
779
|
*/
|
|
844
780
|
type TickerIdType = string;
|
|
845
781
|
|
|
846
|
-
/**
|
|
847
|
-
* Is a decorator that register a ticker in the game.
|
|
848
|
-
* Is a required decorator for use the ticker in the game.
|
|
849
|
-
* Thanks to this decoration the game has the possibility of updating the tickers to the latest modification and saving the game.
|
|
850
|
-
* @param name is th identifier of the label, by default is the name of the class
|
|
851
|
-
* @returns
|
|
852
|
-
*/
|
|
853
|
-
declare function tickerDecorator(name?: TickerIdType): (target: typeof TickerBase<any>) => void;
|
|
854
|
-
|
|
855
782
|
/**
|
|
856
783
|
* IClassWithArgsHistory is a class that contains the name of a class and the arguments that were used to create it.
|
|
857
784
|
*/
|
|
@@ -1007,6 +934,175 @@ interface ITickersSteps {
|
|
|
1007
934
|
steps: (ITickersStep<any> | RepeatType | PauseType)[];
|
|
1008
935
|
}
|
|
1009
936
|
|
|
937
|
+
type TickerProgrationType = ITickerProgrationLinear | ITickerProgrationExponential;
|
|
938
|
+
type ITickerProgrationLinear = {
|
|
939
|
+
amt: number;
|
|
940
|
+
limit?: number;
|
|
941
|
+
type: "linear";
|
|
942
|
+
};
|
|
943
|
+
type ITickerProgrationExponential = {
|
|
944
|
+
percentage: number;
|
|
945
|
+
limit?: number;
|
|
946
|
+
type: "exponential";
|
|
947
|
+
};
|
|
948
|
+
|
|
949
|
+
type TickerMoveProps = {
|
|
950
|
+
/**
|
|
951
|
+
* The speed of the movement
|
|
952
|
+
* @default 0.1
|
|
953
|
+
*/
|
|
954
|
+
speed?: number;
|
|
955
|
+
/**
|
|
956
|
+
* The destination of the movement
|
|
957
|
+
*/
|
|
958
|
+
destination: {
|
|
959
|
+
y: number;
|
|
960
|
+
x: number;
|
|
961
|
+
};
|
|
962
|
+
/**
|
|
963
|
+
* The progression of the speed
|
|
964
|
+
*/
|
|
965
|
+
speedProgression?: TickerProgrationType;
|
|
966
|
+
/**
|
|
967
|
+
* If true, the rotation only starts if the canvas element have a texture
|
|
968
|
+
*/
|
|
969
|
+
startOnlyIfHaveTexture?: boolean;
|
|
970
|
+
};
|
|
971
|
+
|
|
972
|
+
/**
|
|
973
|
+
* A ticker that moves the canvas element of the canvas.
|
|
974
|
+
* @example
|
|
975
|
+
* ```typescript
|
|
976
|
+
* let alien = addImage("alien", 'https://pixijs.com/assets/eggHead.png')
|
|
977
|
+
* GameWindowManager.addCanvasElement("alien", alien);
|
|
978
|
+
* const ticker = new TickerMove({
|
|
979
|
+
* speed: 0.1,
|
|
980
|
+
* destination: { x: 100, y: 100 },
|
|
981
|
+
* }),
|
|
982
|
+
* ```
|
|
983
|
+
*/
|
|
984
|
+
declare class TickerMove extends TickerBase<TickerMoveProps> {
|
|
985
|
+
/**
|
|
986
|
+
* The method that will be called every frame to move the canvas element of the canvas.
|
|
987
|
+
* @param t The ticker that is calling this method
|
|
988
|
+
* @param args The arguments that are passed to the ticker
|
|
989
|
+
* @param tags The tags of the canvas element that are connected to this ticker
|
|
990
|
+
*/
|
|
991
|
+
fn(t: Ticker, args: TickerMoveProps, tags: string[]): void;
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
type TickerRotateProps = {
|
|
995
|
+
/**
|
|
996
|
+
* The speed of the rotation
|
|
997
|
+
* @default 0.1
|
|
998
|
+
*/
|
|
999
|
+
speed?: number;
|
|
1000
|
+
/**
|
|
1001
|
+
* The direction of the rotation
|
|
1002
|
+
* @default true
|
|
1003
|
+
*/
|
|
1004
|
+
clockwise?: boolean;
|
|
1005
|
+
/**
|
|
1006
|
+
* The progression of the speed
|
|
1007
|
+
*/
|
|
1008
|
+
speedProgression?: TickerProgrationType;
|
|
1009
|
+
/**
|
|
1010
|
+
* If true, the rotation only starts if the canvas element have a texture
|
|
1011
|
+
*/
|
|
1012
|
+
startOnlyIfHaveTexture?: boolean;
|
|
1013
|
+
};
|
|
1014
|
+
|
|
1015
|
+
/**
|
|
1016
|
+
* A ticker that rotates the canvas element of the canvas.
|
|
1017
|
+
* @example
|
|
1018
|
+
* ```typescript
|
|
1019
|
+
* let alien = addImage("alien", 'https://pixijs.com/assets/eggHead.png')
|
|
1020
|
+
* GameWindowManager.addCanvasElement("alien", alien);
|
|
1021
|
+
* const ticker = new TickerRotate({
|
|
1022
|
+
* speed: 0.1,
|
|
1023
|
+
* clockwise: true,
|
|
1024
|
+
* }),
|
|
1025
|
+
* GameWindowManager.addTicker("alien", ticker)
|
|
1026
|
+
* ```
|
|
1027
|
+
*/
|
|
1028
|
+
declare class TickerRotate extends TickerBase<TickerRotateProps> {
|
|
1029
|
+
/**
|
|
1030
|
+
* The method that will be called every frame to rotate the canvas element of the canvas.
|
|
1031
|
+
* @param delta The delta time
|
|
1032
|
+
* @param args The arguments that are passed to the ticker
|
|
1033
|
+
* @param tags The tags of the canvas element that are connected to this ticker
|
|
1034
|
+
*/
|
|
1035
|
+
fn(t: Ticker, args: TickerRotateProps, tags: string[]): void;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
type CanvasElementTagType = string;
|
|
1039
|
+
|
|
1040
|
+
/**
|
|
1041
|
+
* Is a decorator that register a canvas element in the game.
|
|
1042
|
+
* @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
|
|
1043
|
+
* @returns
|
|
1044
|
+
*/
|
|
1045
|
+
declare function canvasElementDecorator(name?: CanvasElementTagType): (target: typeof CanvasBase<any>) => void;
|
|
1046
|
+
|
|
1047
|
+
/**
|
|
1048
|
+
* Is a function that saves the character. If the character already exists, it will be overwritten.
|
|
1049
|
+
* @param character is the character to save
|
|
1050
|
+
* @returns
|
|
1051
|
+
* @example
|
|
1052
|
+
* ```typescript
|
|
1053
|
+
* export const liam = new CharacterBaseModel('liam', { name: 'Liam'});
|
|
1054
|
+
* export const alice = new CharacterBaseModel('alice', { name: 'Alice'});
|
|
1055
|
+
* saveCharacter([liam, alice]);
|
|
1056
|
+
* ```
|
|
1057
|
+
*/
|
|
1058
|
+
declare function saveCharacter<T extends CharacterBaseModel = CharacterBaseModel>(character: T | T[]): void;
|
|
1059
|
+
/**
|
|
1060
|
+
* is a function that returns the character by the id
|
|
1061
|
+
* @param id is the id of the character
|
|
1062
|
+
* @returns the character
|
|
1063
|
+
* @example
|
|
1064
|
+
* ```typescript
|
|
1065
|
+
* const liam = getCharacterById('liam');
|
|
1066
|
+
* ```
|
|
1067
|
+
*/
|
|
1068
|
+
declare function getCharacterById<T extends CharacterBaseModel>(id: string): T | undefined;
|
|
1069
|
+
/**
|
|
1070
|
+
* is a function that returns all characters
|
|
1071
|
+
* @returns all characters
|
|
1072
|
+
* @example
|
|
1073
|
+
* ```typescript
|
|
1074
|
+
* const allCharacters = getAllCharacters();
|
|
1075
|
+
* ```
|
|
1076
|
+
*/
|
|
1077
|
+
declare function getAllCharacters<T extends CharacterBaseModel>(): T[];
|
|
1078
|
+
|
|
1079
|
+
/**
|
|
1080
|
+
* Is a decorator that register a event in the game.
|
|
1081
|
+
* Is a required decorator for use the event in the game.
|
|
1082
|
+
* Thanks to this decoration the game has the possibility of updating the events to the latest modification and saving the game.
|
|
1083
|
+
* @param name is th identifier of the event, by default is the name of the class
|
|
1084
|
+
* @returns
|
|
1085
|
+
*/
|
|
1086
|
+
declare function eventDecorator(name?: EventIdType): (target: typeof CanvasEvent<any>) => void;
|
|
1087
|
+
|
|
1088
|
+
/**
|
|
1089
|
+
* Is a decorator that register a label in the game.
|
|
1090
|
+
* Is a required decorator for use the label in the game.
|
|
1091
|
+
* Thanks to this decoration the game has the possibility of updating the labels to the latest modification and saving the game.
|
|
1092
|
+
* @param name is th identifier of the label, by default is the name of the class
|
|
1093
|
+
* @returns
|
|
1094
|
+
*/
|
|
1095
|
+
declare function labelDecorator(name?: LabelIdType): (target: typeof Label) => void;
|
|
1096
|
+
|
|
1097
|
+
/**
|
|
1098
|
+
* Is a decorator that register a ticker in the game.
|
|
1099
|
+
* Is a required decorator for use the ticker in the game.
|
|
1100
|
+
* Thanks to this decoration the game has the possibility of updating the tickers to the latest modification and saving the game.
|
|
1101
|
+
* @param name is th identifier of the label, by default is the name of the class
|
|
1102
|
+
* @returns
|
|
1103
|
+
*/
|
|
1104
|
+
declare function tickerDecorator(name?: TickerIdType): (target: typeof TickerBase<any>) => void;
|
|
1105
|
+
|
|
1010
1106
|
/**
|
|
1011
1107
|
* Set the dialogue to be shown in the game
|
|
1012
1108
|
* @param text Text of the dialogue
|
|
@@ -1100,7 +1196,7 @@ declare function addImage(tag: string, imageUrl: string): CanvasImage;
|
|
|
1100
1196
|
* @param canvasImages is a list of images to show.
|
|
1101
1197
|
* @returns the list of images.
|
|
1102
1198
|
*/
|
|
1103
|
-
declare function
|
|
1199
|
+
declare function loadImages(canvasImages: CanvasImage[] | CanvasImage): Promise<CanvasImage[]>;
|
|
1104
1200
|
/**
|
|
1105
1201
|
* Remove a image from the canvas.
|
|
1106
1202
|
* @param tag is the unique tag of the image. You can use this tag to refer to this image
|
|
@@ -1657,4 +1753,4 @@ declare class GameWindowManager {
|
|
|
1657
1753
|
static import(data: object): void;
|
|
1658
1754
|
}
|
|
1659
1755
|
|
|
1660
|
-
export { CanvasBase, CanvasContainer, CanvasEvent, type CanvasEventNamesType, CanvasImage, CanvasSprite, CanvasText, CharacterBaseModel, type CharacterBaseModelProps, ChoiceMenuOptionLabel, type ChoiceMenuOptionsType, DialogueBaseModel, 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 IDialogueHistory, type IHistoryStep, type IHistoryStepData, type IOpenedLabel, type ISaveData, type ITextureMemory, type ITicker, type ITickersSteps, Label, LabelRunModeEnum, Pause, type PauseType, PauseValueType, Repeat, type RepeatType, type StepLabelResultType, type StepLabelType, type StorageElementType, StoredClassModel, TickerBase, TickerFadeAlpha, type TickerProgrationType, TickerRotate, addImage, canvasElementDecorator, clearAllGameDatas, clearChoiceMenuOptions, clearDialogue, eventDecorator, getAllCharacters, getCharacterById, getChoiceMenuOptions, getDialogue, getDialogueHistory, getFlag, getSaveData, getSaveJson, getTexture, labelDecorator, loadSaveData, loadSaveJson, removeCanvasElement, saveCharacter, setChoiceMenuOptions, setDialogue, setFlag,
|
|
1756
|
+
export { CanvasBase, CanvasContainer, CanvasEvent, type CanvasEventNamesType, CanvasImage, CanvasSprite, CanvasText, CharacterBaseModel, type CharacterBaseModelProps, ChoiceMenuOptionLabel, type ChoiceMenuOptionsType, DialogueBaseModel, 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 IDialogueHistory, type IHistoryStep, type IHistoryStepData, type IOpenedLabel, type ISaveData, type ITextureMemory, type ITicker, type ITickersSteps, Label, LabelRunModeEnum, Pause, type PauseType, PauseValueType, Repeat, type RepeatType, type StepLabelResultType, type StepLabelType, type StorageElementType, StoredClassModel, TickerBase, TickerFadeAlpha, type TickerFadeAlphaProps, TickerMove, type TickerProgrationType, TickerRotate, type TickerRotateProps, addImage, canvasElementDecorator, clearAllGameDatas, clearChoiceMenuOptions, clearDialogue, eventDecorator, getAllCharacters, getCharacterById, getChoiceMenuOptions, getDialogue, getDialogueHistory, getFlag, getSaveData, getSaveJson, getTexture, labelDecorator, loadImages, loadSaveData, loadSaveJson, removeCanvasElement, saveCharacter, setChoiceMenuOptions, setDialogue, setFlag, showImageWithDissolveTransition, tickerDecorator };
|