pixi-solid 0.0.1

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 (90) hide show
  1. package/LICENSE.txt +21 -0
  2. package/README.md +115 -0
  3. package/dist/examples/AnimatedSprite.example.jsx +17 -0
  4. package/dist/examples/AnimatedSprite.example.jsx.map +1 -0
  5. package/dist/examples/BitmapText.example.jsx +8 -0
  6. package/dist/examples/BitmapText.example.jsx.map +1 -0
  7. package/dist/examples/Container.example.jsx +8 -0
  8. package/dist/examples/Container.example.jsx.map +1 -0
  9. package/dist/examples/Graphics.example.jsx +7 -0
  10. package/dist/examples/Graphics.example.jsx.map +1 -0
  11. package/dist/examples/HTMLText.example.jsx +5 -0
  12. package/dist/examples/HTMLText.example.jsx.map +1 -0
  13. package/dist/examples/MeshPlane.example.jsx +6 -0
  14. package/dist/examples/MeshPlane.example.jsx.map +1 -0
  15. package/dist/examples/MeshRope.example.jsx +10 -0
  16. package/dist/examples/MeshRope.example.jsx.map +1 -0
  17. package/dist/examples/MeshSimple.example.jsx +9 -0
  18. package/dist/examples/MeshSimple.example.jsx.map +1 -0
  19. package/dist/examples/NineSliceSprite.example.jsx +7 -0
  20. package/dist/examples/NineSliceSprite.example.jsx.map +1 -0
  21. package/dist/examples/ParticleContainer.example.jsx +30 -0
  22. package/dist/examples/ParticleContainer.example.jsx.map +1 -0
  23. package/dist/examples/PerspectiveMesh.example.jsx +6 -0
  24. package/dist/examples/PerspectiveMesh.example.jsx.map +1 -0
  25. package/dist/examples/PixiApplication.example.jsx +12 -0
  26. package/dist/examples/PixiApplication.example.jsx.map +1 -0
  27. package/dist/examples/PixiCanvas.example.jsx +12 -0
  28. package/dist/examples/PixiCanvas.example.jsx.map +1 -0
  29. package/dist/examples/PixiStage.example.jsx +12 -0
  30. package/dist/examples/PixiStage.example.jsx.map +1 -0
  31. package/dist/examples/RenderContainer.example.jsx +8 -0
  32. package/dist/examples/RenderContainer.example.jsx.map +1 -0
  33. package/dist/examples/RenderLayer.example.jsx +10 -0
  34. package/dist/examples/RenderLayer.example.jsx.map +1 -0
  35. package/dist/examples/Sprite.example.jsx +6 -0
  36. package/dist/examples/Sprite.example.jsx.map +1 -0
  37. package/dist/examples/Text.example.jsx +9 -0
  38. package/dist/examples/Text.example.jsx.map +1 -0
  39. package/dist/examples/TilingSprite.example.jsx +6 -0
  40. package/dist/examples/TilingSprite.example.jsx.map +1 -0
  41. package/dist/examples/useTick.example.jsx +12 -0
  42. package/dist/examples/useTick.example.jsx.map +1 -0
  43. package/dist/examples/useTicker.example.jsx +8 -0
  44. package/dist/examples/useTicker.example.jsx.map +1 -0
  45. package/dist/index.js +7 -0
  46. package/dist/index.js.map +1 -0
  47. package/dist/pixi-application.jsx +86 -0
  48. package/dist/pixi-application.jsx.map +1 -0
  49. package/dist/pixi-canvas.jsx +65 -0
  50. package/dist/pixi-canvas.jsx.map +1 -0
  51. package/dist/pixi-components.jsx +214 -0
  52. package/dist/pixi-components.jsx.map +1 -0
  53. package/dist/pixi-events.js +40 -0
  54. package/dist/pixi-events.js.map +1 -0
  55. package/dist/pixi-stage.jsx +30 -0
  56. package/dist/pixi-stage.jsx.map +1 -0
  57. package/dist/renderer.jsx +74 -0
  58. package/dist/renderer.jsx.map +1 -0
  59. package/dist/types/examples/AnimatedSprite.example.d.ts +1 -0
  60. package/dist/types/examples/BitmapText.example.d.ts +1 -0
  61. package/dist/types/examples/Container.example.d.ts +1 -0
  62. package/dist/types/examples/Graphics.example.d.ts +1 -0
  63. package/dist/types/examples/HTMLText.example.d.ts +1 -0
  64. package/dist/types/examples/MeshPlane.example.d.ts +1 -0
  65. package/dist/types/examples/MeshRope.example.d.ts +1 -0
  66. package/dist/types/examples/MeshSimple.example.d.ts +1 -0
  67. package/dist/types/examples/NineSliceSprite.example.d.ts +1 -0
  68. package/dist/types/examples/ParticleContainer.example.d.ts +1 -0
  69. package/dist/types/examples/PerspectiveMesh.example.d.ts +1 -0
  70. package/dist/types/examples/PixiApplication.example.d.ts +1 -0
  71. package/dist/types/examples/PixiCanvas.example.d.ts +1 -0
  72. package/dist/types/examples/PixiStage.example.d.ts +1 -0
  73. package/dist/types/examples/RenderContainer.example.d.ts +1 -0
  74. package/dist/types/examples/RenderLayer.example.d.ts +1 -0
  75. package/dist/types/examples/Sprite.example.d.ts +1 -0
  76. package/dist/types/examples/Text.example.d.ts +1 -0
  77. package/dist/types/examples/TilingSprite.example.d.ts +1 -0
  78. package/dist/types/examples/useTick.example.d.ts +1 -0
  79. package/dist/types/examples/useTicker.example.d.ts +1 -0
  80. package/dist/types/index.d.ts +10 -0
  81. package/dist/types/pixi-application.d.ts +45 -0
  82. package/dist/types/pixi-canvas.d.ts +23 -0
  83. package/dist/types/pixi-components.d.ts +182 -0
  84. package/dist/types/pixi-events.d.ts +7 -0
  85. package/dist/types/pixi-stage.d.ts +25 -0
  86. package/dist/types/renderer.d.ts +2 -0
  87. package/dist/types/use-ticker.d.ts +31 -0
  88. package/dist/use-ticker.jsx +39 -0
  89. package/dist/use-ticker.jsx.map +1 -0
  90. package/package.json +50 -0
package/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) [year] [fullname]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,115 @@
1
+ # Pixi-Solid
2
+
3
+ A custom renderer for [PixiJS](https://pixijs.com/) that lets you build your scene with [SolidJS](https://www.solidjs.com/) JSX components and its fine-grained signals based reactivity.
4
+
5
+ [![NPM Version](https://img.shields.io/npm/v/pixi-solid.svg)](https://www.npmjs.com/package/pixi-solid)
6
+ [![License](https://img.shields.io/npm/l/pixi-solid.svg)](https://github.com/your-username/pixi-solid/blob/main/LICENSE)
7
+
8
+ ## Why Pixi-Solid?
9
+
10
+ `pixi-solid` combines the power of two amazing libraries:
11
+
12
+ - **PixiJS:** A fast, lightweight, and powerful 2D rendering library.
13
+ - **SolidJS:** A declarative, performant, and reactive JavaScript library for building user interfaces.
14
+
15
+ By using `pixi-solid`, you can write your PixiJS applications declaratively using JSX, manage state with Solid's powerful reactivity system, and structure your scene as a tree of reusable components. This leads to more maintainable and readable code for complex graphical applications.
16
+
17
+ It is intended to provide nice abstractions for encapsulating useful functionality and state management to represent the core logic of your application.
18
+
19
+ In some cases when creating high performance applications like games which may have lots of fast changing state and logic every frame it may be beneficial to escape from SolidJS and use Pixi imperatively.
20
+ In these cases you may want to create an imperative component and update it every frame with the `useTick` method and then wrap it inside a `<Container />` component as an easy way of packaging it.
21
+
22
+ ## Getting Started
23
+
24
+ ### Installation
25
+
26
+ To install `pixi-solid` along with its peer dependencies, run:
27
+
28
+ ```bash
29
+ npm install pixi-solid pixi.js solid-js
30
+ # or
31
+ yarn add pixi-solid pixi.js solid-js
32
+ # or
33
+ pnpm add pixi-solid pixi.js solid-js
34
+ ```
35
+
36
+ You will also need to configure your build tool to handle Solid's JSX. For Vite, you can use `vite-plugin-solid`.
37
+
38
+ ### Basic Usage
39
+
40
+ Here's a simple example to get you started. This will render a "Hello World" text on the screen that follows your mouse.
41
+
42
+ ```jsx
43
+ import { render } from "solid-js/web";
44
+ import { PixiApplication, PixiStage, usePixiApp } from "pixi-solid";
45
+ import { Text, FederatedPointerEvent } from "pixi.js";
46
+ import { createSignal, onMount } from "solid-js";
47
+
48
+ const FollowText = () => {
49
+ const [position, setPosition] = createSignal({ x: 0, y: 0 });
50
+
51
+ const handlePointerMove = (e: FederatedPointerEvent) => {
52
+ setPosition({ x: e.global.x, y: e.global.y });
53
+ };
54
+
55
+ return (
56
+ <Text
57
+ text="Hello World"
58
+ onglobalpointermove={handlePointerMove}
59
+ anchor={{ x: 0.5, y: 0.5 }}
60
+ x={position().x}
61
+ y={position().y}
62
+ style={{ fill: "white", fontSize: 24 }}
63
+ />
64
+ );
65
+ };
66
+
67
+ const App = () => (
68
+ <div style={{ width: "100vw", height: "100vh", display: "flex", "flex-direction": "column" }}>
69
+ <PixiApplication background={"#1099bb"}>
70
+ <PixiCanvas>
71
+ <PixiStage eventMode={"static"}>
72
+ <FollowText />
73
+ </PixiStage>
74
+ </PixiCanvas>
75
+ </PixiApplication>
76
+ </div>
77
+ );
78
+
79
+ render(() => <App />, document.getElementById("root"));
80
+ ```
81
+
82
+ ## Core Components & Hooks
83
+
84
+ ### `<PixiApplication>`
85
+
86
+ This component creates the main PixiJS `Application` instance and provides it to all child components via context. Any options passed to it are forwarded to the `Application` constructor.
87
+
88
+ ### `<PixiCanvas>`
89
+
90
+ This component creates a `div` and mounts the PixiJS canvas into it. It automatically handles resizing the canvas to fit the container. Your scene components should be placed as children of `<PixiCanvas>`.
91
+
92
+ ### `<PixiStage>`
93
+
94
+ This component gives us a reference to the Pixi stage which is the top level container of your scene. It is useful for listening to global events.
95
+
96
+ ### `usePixiApp()`
97
+
98
+ A hook to get access to the PixiJS `Application` instance.
99
+
100
+ ### `useTicker()`
101
+
102
+ A hook to get access to the Pixi ticker instance.
103
+
104
+ ### `useTick()`
105
+
106
+ A hook to auto subscribe and unsubscribe to the ticker in sync with the components lifecycle.
107
+ Any function passed in here will be called every frame whilst the component is mounted.
108
+
109
+ ## Contributing
110
+
111
+ Contributions are welcome! This project is still in its early stages, so feel free to open an issue to report a bug, suggest a feature, or submit a pull request.
112
+
113
+ ## License
114
+
115
+ This project is licensed under the MIT License.
@@ -0,0 +1,17 @@
1
+ import { Texture } from "pixi.js";
2
+ import { AnimatedSprite } from "pixi-solid";
3
+ export const MyAnimatedSpriteComponent = () => {
4
+ let spriteRef;
5
+ const textures = [
6
+ Texture.from("path/to/your/image1.png"),
7
+ Texture.from("path/to/your/image2.png"),
8
+ Texture.from("path/to/your/image3.png"),
9
+ ];
10
+ const handlePointerDown = (e) => {
11
+ if (!spriteRef)
12
+ return;
13
+ spriteRef.play();
14
+ };
15
+ return (<AnimatedSprite textures={textures} ref={spriteRef} autoPlay={true} onpointerdown={handlePointerDown} animationSpeed={0.1} x={100} y={150} anchor={{ x: 0.5, y: 0.5 }}/>);
16
+ };
17
+ //# sourceMappingURL=AnimatedSprite.example.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnimatedSprite.example.jsx","sourceRoot":"","sources":["../../src/examples/AnimatedSprite.example.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,EAAE;IAC5C,IAAI,SAA0C,CAAC;IAE/C,MAAM,QAAQ,GAAG;QACf,OAAO,CAAC,IAAI,CAAC,yBAAyB,CAAC;QACvC,OAAO,CAAC,IAAI,CAAC,yBAAyB,CAAC;QACvC,OAAO,CAAC,IAAI,CAAC,yBAAyB,CAAC;KACxC,CAAC;IAEF,MAAM,iBAAiB,GAAG,CAAC,CAAsB,EAAE,EAAE;QACnD,IAAI,CAAC,SAAS;YAAE,OAAO;QACvB,SAAS,CAAC,IAAI,EAAE,CAAC;IACnB,CAAC,CAAC;IAEF,OAAO,CACL,CAAC,cAAc,CACb,QAAQ,CAAC,CAAC,QAAQ,CAAC,CACnB,GAAG,CAAC,CAAC,SAAS,CAAC,CACf,QAAQ,CAAC,CAAC,IAAI,CAAC,CACf,aAAa,CAAC,CAAC,iBAAiB,CAAC,CACjC,cAAc,CAAC,CAAC,GAAG,CAAC,CACpB,CAAC,CAAC,CAAC,GAAG,CAAC,CACP,CAAC,CAAC,CAAC,GAAG,CAAC,CACP,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAC3B,CACH,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { BitmapFont } from "pixi.js";
2
+ import { BitmapText } from "pixi-solid";
3
+ // Assume a bitmap font is loaded, e.g., using Assets.load
4
+ // BitmapFont.from("my-font-name", { fill: "#ffffff", fontSize: 32 });
5
+ export const MyBitmapTextComponent = () => {
6
+ return (<BitmapText text="Hello World" style={{ fontFamily: "my-font-name", fontSize: 32, fill: "#ffcc00" }} x={100} y={150} anchor={{ x: 0.5, y: 0.5 }}/>);
7
+ };
8
+ //# sourceMappingURL=BitmapText.example.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BitmapText.example.jsx","sourceRoot":"","sources":["../../src/examples/BitmapText.example.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,0DAA0D;AAC1D,sEAAsE;AAEtE,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,OAAO,CACL,CAAC,UAAU,CACT,IAAI,CAAC,aAAa,CAClB,KAAK,CAAC,CAAC,EAAE,UAAU,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CACrE,CAAC,CAAC,CAAC,GAAG,CAAC,CACP,CAAC,CAAC,CAAC,GAAG,CAAC,CACP,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAC3B,CACH,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { Texture } from "pixi.js";
2
+ import { Container, Sprite } from "pixi-solid";
3
+ export const MyContainerComponent = () => {
4
+ return (<Container x={50} y={50}>
5
+ <Sprite texture={Texture.from("path/to/your/image.png")} x={100} y={150} anchor={{ x: 0.5, y: 0.5 }}/>
6
+ </Container>);
7
+ };
8
+ //# sourceMappingURL=Container.example.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Container.example.jsx","sourceRoot":"","sources":["../../src/examples/Container.example.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,OAAO,CACL,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CACtB;MAAA,CAAC,MAAM,CACL,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAChD,CAAC,CAAC,CAAC,GAAG,CAAC,CACP,CAAC,CAAC,CAAC,GAAG,CAAC,CACP,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAE/B;IAAA,EAAE,SAAS,CAAC,CACb,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { Graphics } from "pixi-solid";
2
+ export const MyGraphicsComponent = () => {
3
+ return (<Graphics ref={(graphics) => {
4
+ graphics.rect(50, 50, 100, 100).fill(0xff0000);
5
+ }}/>);
6
+ };
7
+ //# sourceMappingURL=Graphics.example.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Graphics.example.jsx","sourceRoot":"","sources":["../../src/examples/Graphics.example.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACtC,OAAO,CACL,CAAC,QAAQ,CACP,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE;YAChB,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjD,CAAC,CAAC,EACF,CACH,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { HTMLText } from "pixi-solid";
2
+ export const MyHTMLTextComponent = () => {
3
+ return (<HTMLText text={'<p style="color:white; font-size: 24px;">Hello <b>World</b></p>'} x={100} y={150}/>);
4
+ };
5
+ //# sourceMappingURL=HTMLText.example.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HTMLText.example.jsx","sourceRoot":"","sources":["../../src/examples/HTMLText.example.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACtC,OAAO,CACL,CAAC,QAAQ,CACP,IAAI,CAAC,CAAC,iEAAiE,CAAC,CACxE,CAAC,CAAC,CAAC,GAAG,CAAC,CACP,CAAC,CAAC,CAAC,GAAG,CAAC,EACP,CACH,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { Texture } from "pixi.js";
2
+ import { MeshPlane } from "pixi-solid";
3
+ export const MyMeshPlaneComponent = () => {
4
+ return <MeshPlane texture={Texture.from("path/to/your/image.png")}/>;
5
+ };
6
+ //# sourceMappingURL=MeshPlane.example.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MeshPlane.example.jsx","sourceRoot":"","sources":["../../src/examples/MeshPlane.example.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,EAAG,CAAC;AACxE,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { Point, Texture } from "pixi.js";
2
+ import { MeshRope } from "pixi-solid";
3
+ export const MyMeshRopeComponent = () => {
4
+ const points = [];
5
+ for (let i = 0; i < 20; i++) {
6
+ points.push(new Point(i * 40, Math.sin(i * 0.5) * 30));
7
+ }
8
+ return <MeshRope texture={Texture.from("path/to/rope.png")} points={points}/>;
9
+ };
10
+ //# sourceMappingURL=MeshRope.example.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MeshRope.example.jsx","sourceRoot":"","sources":["../../src/examples/MeshRope.example.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACtC,MAAM,MAAM,GAAG,EAAE,CAAC;IAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5B,MAAM,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACzD,CAAC;IAED,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,EAAG,CAAC;AACjF,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { Texture } from "pixi.js";
2
+ import { MeshSimple } from "pixi-solid";
3
+ export const MyMeshSimpleComponent = () => {
4
+ const vertices = new Float32Array([-100, -100, 100, -100, 100, 100, -100, 100]);
5
+ const uvs = new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]);
6
+ const indices = new Uint32Array([0, 1, 2, 0, 2, 3]);
7
+ return (<MeshSimple texture={Texture.from("path/to/your/image.png")} vertices={vertices} uvs={uvs} indices={indices}/>);
8
+ };
9
+ //# sourceMappingURL=MeshSimple.example.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MeshSimple.example.jsx","sourceRoot":"","sources":["../../src/examples/MeshSimple.example.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,MAAM,QAAQ,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IAChF,MAAM,GAAG,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACvD,MAAM,OAAO,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAEpD,OAAO,CACL,CAAC,UAAU,CACT,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAChD,QAAQ,CAAC,CAAC,QAAQ,CAAC,CACnB,GAAG,CAAC,CAAC,GAAG,CAAC,CACT,OAAO,CAAC,CAAC,OAAO,CAAC,EACjB,CACH,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { Texture } from "pixi.js";
2
+ import { NineSliceSprite } from "pixi-solid";
3
+ export const MyNineSliceSpriteComponent = () => {
4
+ // Assumes a texture that is a 3x3 grid for slicing
5
+ return (<NineSliceSprite texture={Texture.from("path/to/your/nine-slice-image.png")} leftWidth={20} topHeight={20} rightWidth={20} bottomHeight={20} width={200} height={100}/>);
6
+ };
7
+ //# sourceMappingURL=NineSliceSprite.example.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NineSliceSprite.example.jsx","sourceRoot":"","sources":["../../src/examples/NineSliceSprite.example.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,EAAE;IAC7C,mDAAmD;IACnD,OAAO,CACL,CAAC,eAAe,CACd,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC,CAC3D,SAAS,CAAC,CAAC,EAAE,CAAC,CACd,SAAS,CAAC,CAAC,EAAE,CAAC,CACd,UAAU,CAAC,CAAC,EAAE,CAAC,CACf,YAAY,CAAC,CAAC,EAAE,CAAC,CACjB,KAAK,CAAC,CAAC,GAAG,CAAC,CACX,MAAM,CAAC,CAAC,GAAG,CAAC,EACZ,CACH,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { Particle, Texture } from "pixi.js";
2
+ import { ParticleContainer, useTick } from "pixi-solid";
3
+ import { onMount } from "solid-js";
4
+ export const MyParticleContainerComponent = () => {
5
+ // Get a ref to the ParticleContainer
6
+ let particleContainer;
7
+ // Create the particle instances
8
+ const particles = Array.from({ length: 100 }, () => new Particle({
9
+ texture: Texture.from("path/to/your/particle.png"),
10
+ x: Math.random() * 800,
11
+ y: Math.random() * 600,
12
+ anchorX: 0.5,
13
+ anchorY: 0.5,
14
+ }));
15
+ // Update the particles imperatively in a useTick hook
16
+ useTick((ticker) => {
17
+ particles.forEach((particle) => {
18
+ particle.rotation += 0.01 * ticker.deltaTime;
19
+ particle.x = Math.sin(particle.rotation) * 100 + 400;
20
+ particle.y = Math.cos(particle.rotation) * 100 + 300;
21
+ });
22
+ });
23
+ onMount(() => {
24
+ if (!particleContainer)
25
+ return;
26
+ particleContainer.addParticle(...particles);
27
+ });
28
+ return <ParticleContainer ref={particleContainer}/>;
29
+ };
30
+ //# sourceMappingURL=ParticleContainer.example.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ParticleContainer.example.jsx","sourceRoot":"","sources":["../../src/examples/ParticleContainer.example.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,EAAE;IAC/C,qCAAqC;IACrC,IAAI,iBAAqD,CAAC;IAE1D,gCAAgC;IAChC,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAC1B,EAAE,MAAM,EAAE,GAAG,EAAE,EACf,GAAG,EAAE,CACH,IAAI,QAAQ,CAAC;QACX,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,2BAA2B,CAAC;QAClD,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG;QACtB,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG;QACtB,OAAO,EAAE,GAAG;QACZ,OAAO,EAAE,GAAG;KACb,CAAC,CACL,CAAC;IAEF,sDAAsD;IACtD,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QACjB,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;YAC7B,QAAQ,CAAC,QAAQ,IAAI,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC;YAC7C,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC;YACrD,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC;QACvD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,EAAE;QACX,IAAI,CAAC,iBAAiB;YAAE,OAAO;QAC/B,iBAAiB,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,iBAAiB,CAAC,EAAG,CAAC;AACvD,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { Texture } from "pixi.js";
2
+ import { PerspectiveMesh } from "pixi-solid";
3
+ export const MyPerspectiveMeshComponent = () => {
4
+ return <PerspectiveMesh texture={Texture.from("path/to/your/image.png")}/>;
5
+ };
6
+ //# sourceMappingURL=PerspectiveMesh.example.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PerspectiveMesh.example.jsx","sourceRoot":"","sources":["../../src/examples/PerspectiveMesh.example.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,EAAE;IAC7C,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,EAAG,CAAC;AAC9E,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { Texture } from "pixi.js";
2
+ import { PixiApplication, PixiCanvas, PixiStage, Sprite } from "pixi-solid";
3
+ export const PixiApplicationExample = () => {
4
+ return (<PixiApplication background="#1099bb">
5
+ <PixiCanvas>
6
+ <PixiStage>
7
+ <Sprite texture={Texture.WHITE} x={120} y={80}/>
8
+ </PixiStage>
9
+ </PixiCanvas>
10
+ </PixiApplication>);
11
+ };
12
+ //# sourceMappingURL=PixiApplication.example.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PixiApplication.example.jsx","sourceRoot":"","sources":["../../src/examples/PixiApplication.example.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAE5E,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,EAAE;IACzC,OAAO,CACL,CAAC,eAAe,CAAC,UAAU,CAAC,SAAS,CACnC;MAAA,CAAC,UAAU,CACT;QAAA,CAAC,SAAS,CACR;UAAA,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAChD;QAAA,EAAE,SAAS,CACb;MAAA,EAAE,UAAU,CACd;IAAA,EAAE,eAAe,CAAC,CACnB,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { Texture } from "pixi.js";
2
+ import { PixiApplication, PixiCanvas, PixiStage, Sprite } from "pixi-solid";
3
+ export const PixiCanvasExample = () => {
4
+ return (<PixiApplication>
5
+ <PixiCanvas style={{ background: "#1099bb" }}>
6
+ <PixiStage>
7
+ <Sprite texture={Texture.WHITE} x={100} y={100}/>
8
+ </PixiStage>
9
+ </PixiCanvas>
10
+ </PixiApplication>);
11
+ };
12
+ //# sourceMappingURL=PixiCanvas.example.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PixiCanvas.example.jsx","sourceRoot":"","sources":["../../src/examples/PixiCanvas.example.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAE5E,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE;IACpC,OAAO,CACL,CAAC,eAAe,CACd;MAAA,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAC3C;QAAA,CAAC,SAAS,CACR;UAAA,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EACjD;QAAA,EAAE,SAAS,CACb;MAAA,EAAE,UAAU,CACd;IAAA,EAAE,eAAe,CAAC,CACnB,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { Texture } from "pixi.js";
2
+ import { PixiApplication, PixiCanvas, PixiStage, Sprite } from "pixi-solid";
3
+ export const PixiStageExample = () => {
4
+ return (<PixiApplication>
5
+ <PixiCanvas>
6
+ <PixiStage>
7
+ <Sprite texture={Texture.WHITE} x={50} y={50}/>
8
+ </PixiStage>
9
+ </PixiCanvas>
10
+ </PixiApplication>);
11
+ };
12
+ //# sourceMappingURL=PixiStage.example.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PixiStage.example.jsx","sourceRoot":"","sources":["../../src/examples/PixiStage.example.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAE5E,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,OAAO,CACL,CAAC,eAAe,CACd;MAAA,CAAC,UAAU,CACT;QAAA,CAAC,SAAS,CACR;UAAA,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAC/C;QAAA,EAAE,SAAS,CACb;MAAA,EAAE,UAAU,CACd;IAAA,EAAE,eAAe,CAAC,CACnB,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { Texture } from "pixi.js";
2
+ import { RenderContainer, Sprite } from "pixi-solid";
3
+ export const MyRenderContainerComponent = () => {
4
+ return (<RenderContainer>
5
+ <Sprite texture={Texture.from("path/to/your/image.png")}/>
6
+ </RenderContainer>);
7
+ };
8
+ //# sourceMappingURL=RenderContainer.example.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RenderContainer.example.jsx","sourceRoot":"","sources":["../../src/examples/RenderContainer.example.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAErD,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,EAAE;IAC7C,OAAO,CACL,CAAC,eAAe,CACd;MAAA,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,EAC1D;IAAA,EAAE,eAAe,CAAC,CACnB,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { Texture } from "pixi.js";
2
+ import { RenderLayer, Sprite } from "pixi-solid";
3
+ export const MyRenderLayerComponent = () => {
4
+ // A RenderLayer can contain other objects.
5
+ // It's used for advanced rendering effects.
6
+ return (<RenderLayer>
7
+ <Sprite texture={Texture.from("path/to/your/image.png")}/>
8
+ </RenderLayer>);
9
+ };
10
+ //# sourceMappingURL=RenderLayer.example.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RenderLayer.example.jsx","sourceRoot":"","sources":["../../src/examples/RenderLayer.example.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,EAAE;IACzC,2CAA2C;IAC3C,4CAA4C;IAC5C,OAAO,CACL,CAAC,WAAW,CACV;MAAA,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,EAC1D;IAAA,EAAE,WAAW,CAAC,CACf,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { Texture } from "pixi.js";
2
+ import { Sprite } from "pixi-solid";
3
+ export const MySpriteComponent = () => {
4
+ return (<Sprite texture={Texture.from("path/to/your/image.png")} x={100} y={150} anchor={{ x: 0.5, y: 0.5 }}/>);
5
+ };
6
+ //# sourceMappingURL=Sprite.example.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sprite.example.jsx","sourceRoot":"","sources":["../../src/examples/Sprite.example.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE;IACpC,OAAO,CACL,CAAC,MAAM,CACL,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAChD,CAAC,CAAC,CAAC,GAAG,CAAC,CACP,CAAC,CAAC,CAAC,GAAG,CAAC,CACP,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAC3B,CACH,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { Text } from "pixi-solid";
2
+ export const MyTextComponent = () => {
3
+ return (<Text text="Hello World" x={100} y={150} style={{
4
+ fill: "white",
5
+ fontSize: 24,
6
+ fontFamily: "Arial",
7
+ }}/>);
8
+ };
9
+ //# sourceMappingURL=Text.example.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Text.example.jsx","sourceRoot":"","sources":["../../src/examples/Text.example.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,OAAO,CACL,CAAC,IAAI,CACH,IAAI,CAAC,aAAa,CAClB,CAAC,CAAC,CAAC,GAAG,CAAC,CACP,CAAC,CAAC,CAAC,GAAG,CAAC,CACP,KAAK,CAAC,CAAC;YACL,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE,EAAE;YACZ,UAAU,EAAE,OAAO;SACpB,CAAC,EACF,CACH,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { Texture } from "pixi.js";
2
+ import { TilingSprite } from "pixi-solid";
3
+ export const MyTilingSpriteComponent = () => {
4
+ return (<TilingSprite texture={Texture.from("path/to/your/image.png")} width={800} height={600} tilePosition={{ x: 0, y: 0 }}/>);
5
+ };
6
+ //# sourceMappingURL=TilingSprite.example.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TilingSprite.example.jsx","sourceRoot":"","sources":["../../src/examples/TilingSprite.example.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,EAAE;IAC1C,OAAO,CACL,CAAC,YAAY,CACX,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAChD,KAAK,CAAC,CAAC,GAAG,CAAC,CACX,MAAM,CAAC,CAAC,GAAG,CAAC,CACZ,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAC7B,CACH,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { Texture } from "pixi.js";
2
+ import { Sprite, useTick } from "pixi-solid";
3
+ export const UseTickExample = () => {
4
+ let spriteRef;
5
+ useTick((ticker) => {
6
+ if (spriteRef) {
7
+ spriteRef.rotation += 0.01 * ticker.deltaTime;
8
+ }
9
+ });
10
+ return <Sprite ref={spriteRef} texture={Texture.WHITE} x={100} y={100}/>;
11
+ };
12
+ //# sourceMappingURL=useTick.example.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTick.example.jsx","sourceRoot":"","sources":["../../src/examples/useTick.example.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,IAAI,SAAkC,CAAC;IAEvC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QACjB,IAAI,SAAS,EAAE,CAAC;YACd,SAAS,CAAC,QAAQ,IAAI,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC;QAChD,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAG,CAAC;AAC5E,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { Container, useTicker } from "pixi-solid";
2
+ import { onMount } from "solid-js";
3
+ export const MyComponent = () => {
4
+ const ticker = useTicker();
5
+ onMount(() => console.log("Ticker running:", ticker.started));
6
+ return <Container />;
7
+ };
8
+ //# sourceMappingURL=useTicker.example.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTicker.example.jsx","sourceRoot":"","sources":["../../src/examples/useTicker.example.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAElD,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE;IAC9B,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,OAAO,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IAE9D,OAAO,CAAC,SAAS,CAAC,AAAD,EAAG,CAAC;AACvB,CAAC,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ export { PixiApplication, usePixiApp } from "./pixi-application";
2
+ export { PixiCanvas } from "./pixi-canvas";
3
+ export { AnimatedSprite, BitmapText, Container, Graphics, HTMLText, MeshPlane, MeshRope, MeshSimple, NineSliceSprite, ParticleContainer, PerspectiveMesh, RenderContainer, RenderLayer, Sprite, Text, TilingSprite, } from "./pixi-components";
4
+ export { PIXI_EVENT_NAMES } from "./pixi-events";
5
+ export { PixiStage } from "./pixi-stage";
6
+ export { useTick, useTicker } from "./use-ticker";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EACL,cAAc,EACd,UAAU,EACV,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,UAAU,EACV,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,WAAW,EACX,MAAM,EACN,IAAI,EACJ,YAAY,GACb,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,86 @@
1
+ import { Application } from "pixi.js";
2
+ import { createContext, createEffect, createResource, onCleanup, Show, splitProps, useContext, } from "solid-js";
3
+ const PixiAppContext = createContext();
4
+ /**
5
+ * A custom SolidJS hook to access the root PIXI.Application instance.
6
+ * This hook must be called from a component that is a descendant of `PixiApplication`.
7
+ *
8
+ * @returns The PIXI.Application instance provided by the `PixiApplication` component.
9
+ * @throws Will throw an error if used outside of a `PixiApplication` context provider.
10
+ * @example
11
+ * ```tsx
12
+ * const MyComponent = () => {
13
+ * const app = usePixiApp();
14
+ *
15
+ * createEffect(() => {
16
+ * console.log('App resolution:', app.renderer.resolution);
17
+ * });
18
+ *
19
+ * return <Sprite texture={Texture.WHITE} />;
20
+ * };
21
+ * ```
22
+ */
23
+ export const usePixiApp = () => {
24
+ const app = useContext(PixiAppContext);
25
+ if (!app) {
26
+ throw new Error("usePixiApp must be used within a PixiApplication");
27
+ }
28
+ return app;
29
+ };
30
+ /**
31
+ * A SolidJS component that creates and manages a PIXI.Application instance.
32
+ * It provides the application instance through context to be used by child components
33
+ * and custom hooks like `usePixiApp`, `useTick`, and `useTicker`.
34
+ *
35
+ * This component should only be used once in your application.
36
+ *
37
+ * @param props The properties to configure the Pixi.js Application.
38
+ *
39
+ * **Example**
40
+ * {@includeCode ./examples/PixiApplication.example.tsx}
41
+ */
42
+ export const PixiApplication = (props) => {
43
+ const [_solidProps, initialisationProps] = splitProps(props, ["ref", "children"]);
44
+ // TODO: Reinitialise the pixi app if any of the initialisationProps change that we can't set at runtime
45
+ const [appResource] = createResource(async () => {
46
+ // Enforce singleton pattern: Check if an app already exists
47
+ // @ts-expect-error
48
+ if (globalThis.__PIXI_DEVTOOLS__) {
49
+ throw new Error("Only one PixiApplication can be active at a time. Multiple instances detected.");
50
+ }
51
+ const app = new Application();
52
+ await app.init({
53
+ autoDensity: true,
54
+ resolution: Math.min(window.devicePixelRatio, 2),
55
+ sharedTicker: true,
56
+ ...initialisationProps,
57
+ });
58
+ return app;
59
+ });
60
+ createEffect(() => {
61
+ const app = appResource();
62
+ if (app) {
63
+ if (props.ref) {
64
+ // Solid converts the ref prop to a callback function
65
+ props.ref(app.stage);
66
+ }
67
+ // TODO: Go through the other props that can be set at runtime and apply them here
68
+ // e.g. backgroundColor => app.renderer.backgroundColor, etc.
69
+ app.ticker.autoStart = false;
70
+ app.ticker.start();
71
+ // @ts-expect-error
72
+ globalThis.__PIXI_DEVTOOLS__ = {
73
+ app,
74
+ };
75
+ onCleanup(() => {
76
+ app.destroy(true, { children: true });
77
+ // @ts-expect-error
78
+ globalThis.__PIXI_DEVTOOLS__ = undefined;
79
+ });
80
+ }
81
+ });
82
+ return (<Show when={appResource()}>
83
+ {(app) => <PixiAppContext.Provider value={app()}>{props.children}</PixiAppContext.Provider>}
84
+ </Show>);
85
+ };
86
+ //# sourceMappingURL=pixi-application.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pixi-application.jsx","sourceRoot":"","sources":["../src/pixi-application.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,OAAO,EACL,aAAa,EACb,YAAY,EACZ,cAAc,EACd,SAAS,EACT,IAAI,EACJ,UAAU,EACV,UAAU,GACX,MAAM,UAAU,CAAC;AAElB,MAAM,cAAc,GAAG,aAAa,EAAe,CAAC;AAEpD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE;IAC7B,MAAM,GAAG,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IACvC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAcF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAA2B,EAAE,EAAE;IAC7D,MAAM,CAAC,WAAW,EAAE,mBAAmB,CAAC,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC;IAElF,wGAAwG;IAExG,MAAM,CAAC,WAAW,CAAC,GAAG,cAAc,CAAC,KAAK,IAAI,EAAE;QAC9C,4DAA4D;QAC5D,mBAAmB;QACnB,IAAI,UAAU,CAAC,iBAAiB,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CACb,gFAAgF,CACjF,CAAC;QACJ,CAAC;QAED,MAAM,GAAG,GAAG,IAAI,WAAW,EAAE,CAAC;QAC9B,MAAM,GAAG,CAAC,IAAI,CAAC;YACb,WAAW,EAAE,IAAI;YACjB,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC,CAAC;YAChD,YAAY,EAAE,IAAI;YAClB,GAAG,mBAAmB;SACvB,CAAC,CAAC;QAEH,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CAAC;IAEH,YAAY,CAAC,GAAG,EAAE;QAChB,MAAM,GAAG,GAAG,WAAW,EAAE,CAAC;QAC1B,IAAI,GAAG,EAAE,CAAC;YACR,IAAI,KAAK,CAAC,GAAG,EAAE,CAAC;gBACd,qDAAqD;gBACpD,KAAK,CAAC,GAAqC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAC1D,CAAC;YAED,kFAAkF;YAClF,6DAA6D;YAE7D,GAAG,CAAC,MAAM,CAAC,SAAS,GAAG,KAAK,CAAC;YAC7B,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YAEnB,mBAAmB;YACnB,UAAU,CAAC,iBAAiB,GAAG;gBAC7B,GAAG;aACJ,CAAC;YAEF,SAAS,CAAC,GAAG,EAAE;gBACb,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;gBACtC,mBAAmB;gBACnB,UAAU,CAAC,iBAAiB,GAAG,SAAS,CAAC;YAC3C,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,CACL,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,CACxB;MAAA,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC,QAAQ,CAAC,CAC7F;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC"}