@drincs/pixi-vn 1.6.4 → 1.8.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 (48) hide show
  1. package/README.md +47 -53
  2. package/dist/{HistoryChoiceMenuOption-DM4wqiGt.d.ts → HistoryChoiceMenuOption-BP9Tsbyd.d.ts} +1 -2
  3. package/dist/{HistoryChoiceMenuOption-iazqoVVm.d.cts → HistoryChoiceMenuOption-DSSNUXEq.d.cts} +1 -2
  4. package/dist/canvas.cjs +2 -2
  5. package/dist/canvas.d.cts +56 -51
  6. package/dist/canvas.d.ts +56 -51
  7. package/dist/canvas.mjs +2 -2
  8. package/dist/characters.cjs +1 -1
  9. package/dist/characters.mjs +1 -1
  10. package/dist/{chunk-L4IHQ3VT.mjs → chunk-3SLELYPF.mjs} +1 -1
  11. package/dist/chunk-6HI66YQL.mjs +1 -0
  12. package/dist/chunk-XYO5SLSM.mjs +1 -0
  13. package/dist/core.cjs +1 -1
  14. package/dist/core.mjs +1 -1
  15. package/dist/history.cjs +1 -1
  16. package/dist/history.d.cts +1 -1
  17. package/dist/history.d.ts +1 -1
  18. package/dist/history.mjs +1 -1
  19. package/dist/index.cjs +2 -9
  20. package/dist/index.d.cts +289 -114
  21. package/dist/index.d.ts +289 -114
  22. package/dist/index.mjs +2 -9
  23. package/dist/motion.cjs +1 -1
  24. package/dist/motion.d.cts +3 -1
  25. package/dist/motion.d.ts +3 -1
  26. package/dist/motion.mjs +1 -1
  27. package/dist/narration.cjs +2 -2
  28. package/dist/narration.d.cts +3 -3
  29. package/dist/narration.d.ts +3 -3
  30. package/dist/narration.mjs +2 -2
  31. package/dist/pixi/browser.js +183 -171
  32. package/dist/sound.cjs +1 -1
  33. package/dist/sound.d.cts +337 -132
  34. package/dist/sound.d.ts +337 -132
  35. package/dist/sound.mjs +1 -1
  36. package/dist/storage.cjs +1 -1
  37. package/dist/storage.d.cts +63 -12
  38. package/dist/storage.d.ts +63 -12
  39. package/dist/storage.mjs +1 -1
  40. package/dist/vite.cjs +1 -1
  41. package/dist/vite.d.cts +10 -1
  42. package/dist/vite.d.ts +10 -1
  43. package/dist/vite.mjs +1 -1
  44. package/package.json +21 -13
  45. package/dist/chunk-D45QSSXG.mjs +0 -1
  46. package/dist/chunk-EWW7VYPM.mjs +0 -1
  47. package/dist/chunk-ZW3MIPMS.mjs +0 -1
  48. /package/dist/{chunk-XSN6P5JL.mjs → chunk-JMOSOAGB.mjs} +0 -0
package/README.md CHANGED
@@ -10,55 +10,54 @@
10
10
  <a target="_blank" href="https://discord.gg/E95FZWakzp" rel="noopener noreferrer nofollow"><img alt="Discord" src="https://img.shields.io/discord/1263071210011496501?color=7289da&label=discord"></a>
11
11
  </p>
12
12
 
13
-
14
13
  Pixi’VN is a very versatile and powerful 2D game engine. It is based on JavaScript/TypeScript and [PixiJS](https://pixijs.com/).
15
14
 
16
15
  It provides the following features:
17
16
 
18
- * narrative management
19
- * provides a 2D canvas
20
- * providing functionality to play sounds and music
21
- * storage to set and get game variables.
22
- * saves the current state of the entire game at each "story step" giving the possibility to go back
23
- * functionality to save and load the current state of the game.
17
+ - narrative management
18
+ - provides a 2D canvas
19
+ - providing functionality to play sounds and music
20
+ - storage to set and get game variables.
21
+ - saves the current state of the entire game at each "story step" giving the possibility to go back
22
+ - functionality to save and load the current state of the game.
24
23
 
25
24
  For a quick start, various [project templates](#project-initialization) are available. Less experienced developers can use these templates without much knowledge of JavaScript/TypeScript.
26
25
 
27
26
  You have the option to use various types of narrative languages ​​(in addition to JavaScript/TypeScript). Currently you can use the following:
28
27
 
29
- * [*ink*](https://pixi-vn.web.app/ink/ink)
30
- * [Ren'Py](https://pixi-vn.web.app/renpy/renpy)
28
+ - [_ink_](https://pixi-vn.web.app/ink/ink)
29
+ - [Ren'Py](https://pixi-vn.web.app/renpy/renpy)
31
30
 
32
31
  Pixi’VN does not provide built-in components to create the game UI. Instead, you should use external JavaScript frameworks to build your UI. This allows you to leverage systems such as React, Vue, etc., to create complex and high-performance **UI screens**.
33
32
 
34
- * [React](https://pixi-vn.web.app/start/interface-react)
35
- * [Vue](https://pixi-vn.web.app/start/interface-vue)
36
- * [PixiJS](https://pixi-vn.web.app/start/interface-pixijs)
33
+ - [React](https://pixi-vn.web.app/start/interface-react)
34
+ - [Vue](https://pixi-vn.web.app/start/interface-vue)
35
+ - [PixiJS](https://pixi-vn.web.app/start/interface-pixijs)
37
36
 
38
37
  ## Wiki
39
38
 
40
- * [Why Pixi’VN?](https://pixi-vn.web.app/start/why)
41
- * [Ren'Py vs Pixi’VN](https://pixi-vn.web.app/start/versus-renpy)
42
- * [Quick Start](https://pixi-vn.web.app/start/getting-started)
43
- * [Templates](https://pixi-vn.web.app/start/templates)
44
- * Make your first:
45
- * [Visual Novel](https://pixi-vn.web.app/start/make-visual-novel)
46
- * [Point & Click Adventure](https://pixi-vn.web.app/nqtr/make-point-and-click)
47
- * [RPG game](https://pixi-vn.web.app/start/make-rpg)
48
- * [IDE or graphical editor](https://pixi-vn.web.app/start/make-ide)
49
- * [Game engine](https://pixi-vn.web.app/start/make-game-engine)
39
+ - [Why Pixi’VN?](https://pixi-vn.web.app/start/why)
40
+ - [Ren'Py vs Pixi’VN](https://pixi-vn.web.app/start/versus-renpy)
41
+ - [Quick Start](https://pixi-vn.web.app/start/getting-started)
42
+ - [Templates](https://pixi-vn.web.app/start/templates)
43
+ - Make your first:
44
+ - [Visual Novel](https://pixi-vn.web.app/start/make-visual-novel)
45
+ - [Point & Click Adventure](https://pixi-vn.web.app/nqtr/make-point-and-click)
46
+ - [RPG game](https://pixi-vn.web.app/start/make-rpg)
47
+ - [IDE or graphical editor](https://pixi-vn.web.app/start/make-ide)
48
+ - [Game engine](https://pixi-vn.web.app/start/make-game-engine)
50
49
 
51
50
  ## Prerequisites
52
51
 
53
52
  Before starting, you must have the following tools installed:
54
53
 
55
- * [Node.js](https://nodejs.org/) version 18 or higher.
56
- * Text editor with TypeScript support, such as:
57
- * [Visual Studio Code](https://code.visualstudio.com/)
58
- * [Cursor](https://www.cursor.com/)
59
- * [VSCodium](https://vscodium.com/)
60
- * (Recommended) [Git](https://git-scm.com/)
61
- * A [GitHub account](https://github.com/)
54
+ - [Node.js](https://nodejs.org/) version 18 or higher.
55
+ - Text editor with TypeScript support, such as:
56
+ - [Visual Studio Code](https://code.visualstudio.com/)
57
+ - [Cursor](https://www.cursor.com/)
58
+ - [VSCodium](https://vscodium.com/)
59
+ - (Recommended) [Git](https://git-scm.com/)
60
+ - A [GitHub account](https://github.com/)
62
61
 
63
62
  ## Project Initialization
64
63
 
@@ -114,39 +113,40 @@ Before using the Pixi’VN engine, you must initialize the game. You can do this
114
113
 
115
114
  This function has the following parameters:
116
115
 
117
- * `element`: The HTML element to append the canvas to.
118
- * `options`: Equivalent to the options you can use when initializing a [PixiJS Application](https://pixijs.com/8.x/guides/basics/getting-started#creating-an-application). The following options are mandatory:
119
- * `width`: The width of the canvas.
120
- * `height`: The height of the canvas.
121
- * `devtoolsOptions`: Equivalent to the options you can use when initializing the [PixiJS Devtools](https://pixi-vn.web.app/it/start/canvas#use-pixijs-devtools-with-pixivn).
116
+ - `element`: The HTML element to append the canvas to.
117
+ - `options`: Equivalent to the options you can use when initializing a [PixiJS Application](https://pixijs.com/8.x/guides/basics/getting-started#creating-an-application). The following options are mandatory:
118
+ - `width`: The width of the canvas.
119
+ - `height`: The height of the canvas.
120
+ - `devtoolsOptions`: Equivalent to the options you can use when initializing the [PixiJS Devtools](https://pixi-vn.web.app/it/start/canvas#use-pixijs-devtools-with-pixivn).
122
121
 
123
122
  ```ts title="src/main.tsx"
124
123
  import { Game } from "@drincs/pixi-vn";
125
124
 
126
- // Canvas setup with PIXI
127
- const body = document.body
125
+ const body = document.body;
128
126
  if (!body) {
129
- throw new Error('body element not found')
127
+ throw new Error("body element not found");
130
128
  }
131
129
 
132
130
  Game.init(body, {
133
- height: 1080,
134
- width: 1920,
135
- backgroundColor: "#303030",
136
- resizeMode: "contain",
131
+ height: 1080,
132
+ width: 1920,
133
+ backgroundColor: "#303030",
137
134
  }).then(() => {
138
- // ...
135
+ // ...
136
+ Game.start("start", {});
139
137
  });
140
138
 
141
139
  // read more here: https://pixi-vn.web.app/start/other-narrative-features.html#how-manage-the-end-of-the-game
142
140
  Game.onEnd(async (props) => {
143
- Game.clear();
144
- props.navigate("/");
141
+ Game.clear();
142
+ // navigate to main menu
145
143
  });
146
144
 
147
- Game.onError((type, error, { notify }) => {
148
- notify("allert_error_occurred");
145
+ Game.addOnError((error, props) => {
146
+ console.error(`Error occurred`, error);
149
147
  });
148
+
149
+ Game.onNavigate((path) => navigateTo(path));
150
150
  ```
151
151
 
152
152
  ```html title="index.html"
@@ -165,12 +165,9 @@ Game.onError((type, error, { notify }) => {
165
165
  ```
166
166
 
167
167
  ```css title="styles.css"
168
- :root {
169
- background-color: #242424;
170
- }
171
-
172
168
  html,
173
169
  body {
170
+ background-color: #242424;
174
171
  height: 100%;
175
172
  }
176
173
 
@@ -182,6 +179,3 @@ body {
182
179
  }
183
180
  ```
184
181
 
185
-
186
-
187
-
@@ -3,7 +3,6 @@ import { Difference } from 'microdiff';
3
3
  import { a as StorageElementType } from './StorageElementType-DkJ394kq.js';
4
4
 
5
5
  type CloseType = "close";
6
- declare const Close: CloseType;
7
6
 
8
7
  /**
9
8
  * is a string containing the name of the label.
@@ -180,4 +179,4 @@ type HistoryChoiceMenuOption = {
180
179
  hidden: boolean;
181
180
  };
182
181
 
183
- export { type ChoiceOptionInterface as C, type DialogueInterface as D, type HistoryStep as H, type LabelIdType as L, type NarrationHistory as N, type OpenedLabel as O, type StepLabelType as S, type LabelRunModeType as a, type CloseChoiceOptionInterface as b, type CloseType as c, type StepLabelPropsType as d, type StepLabelResultType as e, type StoredIndexedChoiceInterface as f, type StoredChoiceInterface as g, Close as h, type HistoryChoiceMenuOption as i };
182
+ export type { ChoiceOptionInterface as C, DialogueInterface as D, HistoryStep as H, LabelIdType as L, NarrationHistory as N, OpenedLabel as O, StepLabelType as S, LabelRunModeType as a, CloseChoiceOptionInterface as b, CloseType as c, StepLabelPropsType as d, StepLabelResultType as e, StoredIndexedChoiceInterface as f, StoredChoiceInterface as g, HistoryChoiceMenuOption as h };
@@ -3,7 +3,6 @@ import { Difference } from 'microdiff';
3
3
  import { a as StorageElementType } from './StorageElementType-DkJ394kq.cjs';
4
4
 
5
5
  type CloseType = "close";
6
- declare const Close: CloseType;
7
6
 
8
7
  /**
9
8
  * is a string containing the name of the label.
@@ -180,4 +179,4 @@ type HistoryChoiceMenuOption = {
180
179
  hidden: boolean;
181
180
  };
182
181
 
183
- export { type ChoiceOptionInterface as C, type DialogueInterface as D, type HistoryStep as H, type LabelIdType as L, type NarrationHistory as N, type OpenedLabel as O, type StepLabelType as S, type LabelRunModeType as a, type CloseChoiceOptionInterface as b, type CloseType as c, type StepLabelPropsType as d, type StepLabelResultType as e, type StoredIndexedChoiceInterface as f, type StoredChoiceInterface as g, Close as h, type HistoryChoiceMenuOption as i };
182
+ export type { ChoiceOptionInterface as C, DialogueInterface as D, HistoryStep as H, LabelIdType as L, NarrationHistory as N, OpenedLabel as O, StepLabelType as S, LabelRunModeType as a, CloseChoiceOptionInterface as b, CloseType as c, StepLabelPropsType as d, StepLabelResultType as e, StoredIndexedChoiceInterface as f, StoredChoiceInterface as g, HistoryChoiceMenuOption as h };