route-graphics 0.0.2-rc1 → 0.0.2-rc3

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Yuusoft
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 CHANGED
@@ -1,10 +1,108 @@
1
+ # RouteGraphics
1
2
 
2
- ## What is RouteGraphics
3
+ A 2D graphics rendering interface that takes JSON input and renders pixels using PixiJS.
3
4
 
4
- RouteGraphics is a rendering interface for 2d visuals and audio. Originally developed to power RouteVN.
5
+ ⚠️ **Warning: This library is under active development and will have breaking changes in future versions.**
5
6
 
6
- The input is a declarative JSON Object
7
- The output is pixels drawn in a canvas
7
+ ## Installation
8
8
 
9
- The implementation uses PixiJS
9
+ ```bash
10
+ npm install route-graphics
11
+ ```
10
12
 
13
+ ## Usage
14
+
15
+ ```javascript
16
+ import RouteGraphics, {
17
+ SpriteRendererPlugin,
18
+ TextRendererPlugin,
19
+ ContainerRendererPlugin,
20
+ TextRevealingRendererPlugin,
21
+ GraphicsRendererPlugin,
22
+ AudioPlugin,
23
+ SliderRendererPlugin,
24
+ KeyframeTransitionPlugin,
25
+ createAssetBufferManager,
26
+ } from 'route-graphics';
27
+
28
+ // Load assets
29
+ const assets = {
30
+ "file:bg1": {
31
+ url: "/public/background-1-1.png",
32
+ type: "image/png",
33
+ },
34
+ "file:circle-red": {
35
+ url: "/public/circle-red.png",
36
+ type: "image/png",
37
+ },
38
+ "file:bgm-1": {
39
+ url: "/public/bgm-1.mp3",
40
+ type: "audio/mpeg",
41
+ },
42
+ };
43
+
44
+ const assetBufferManager = createAssetBufferManager();
45
+ await assetBufferManager.load(assets);
46
+ const assetBufferMap = assetBufferManager.getBufferMap();
47
+
48
+ // Initialize RouteGraphics
49
+ const app = new RouteGraphics();
50
+ await app.init({
51
+ width: 1920,
52
+ height: 1080,
53
+ eventHandler: (event, data) => {
54
+ // Handle events
55
+ },
56
+ plugins: [
57
+ new SpriteRendererPlugin(),
58
+ new TextRendererPlugin(),
59
+ new ContainerRendererPlugin(),
60
+ new TextRevealingRendererPlugin(),
61
+ new GraphicsRendererPlugin(),
62
+ new AudioPlugin(),
63
+ new SliderRendererPlugin(),
64
+ new KeyframeTransitionPlugin(),
65
+ ],
66
+ });
67
+
68
+ // Load assets and render
69
+ await app.loadAssets(assetBufferMap);
70
+ document.body.appendChild(app.canvas);
71
+
72
+ // Render frame with elements and transitions
73
+ app.render({
74
+ elements: [
75
+ {
76
+ id: "sprite1",
77
+ type: "sprite",
78
+ texture: "file:circle-red",
79
+ x: 100,
80
+ y: 100,
81
+ }
82
+ ],
83
+ transitions: []
84
+ });
85
+ ```
86
+
87
+ ## Features
88
+
89
+ - 2D graphics rendering
90
+ - Sprite management
91
+ - Text rendering with reveal effects
92
+ - Container layouts
93
+ - Transitions and animations
94
+ - Interactive elements
95
+ - Audio playback
96
+
97
+ ## Development
98
+
99
+ ```bash
100
+ # Install dependencies
101
+ bun install
102
+
103
+ # Build
104
+ bun run vt:generate
105
+
106
+ # Lint
107
+ bun run lint
108
+ ```