rapid-render 0.1.3 → 0.1.4
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 +26 -78
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,22 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
<img src="./screenshot/logo.png" alt="Rapid.js Logo" width="100" style="image-rendering: pixelated;">
|
|
3
|
-
</p>
|
|
4
|
-
|
|
5
|
-
<a href="https://nightre.github.io/Rapid.js/docs/index.html"><h1 align="center">Rapid.js</h1></a>
|
|
6
|
-
|
|
7
|
-
A highly efficient ([stress-test](./docs/examples.html)) and lightweight WebGL-based 2D rendering engine focused on rendering capabilities. Rapid.js provides a simple and intuitive API for developers to quickly build high-performance 2D
|
|
8
|
-
games, while staying completely independent from your game's architecture and logic.
|
|
1
|
+
# Rapid.js
|
|
9
2
|
|
|
3
|
+
A highly efficient [stress-test](https://nightre.github.io/Rapid.js/docs/examples.htm) and lightweight WebGL-based 2D rendering engine focused on rendering capabilities.
|
|
10
4
|
|
|
11
5
|
### [Website](https://nightre.github.io/Rapid.js/docs/index.html)
|
|
12
6
|
|
|
13
|
-
#### [Document](https://nightre.github.io/Rapid.js/docs/docs.html)
|
|
14
|
-
|
|
15
|
-
#### [API Docs](https://nightre.github.io/Rapid.js/docs/api/index.html)
|
|
7
|
+
#### [Document](https://nightre.github.io/Rapid.js/docs/docs.html) | [API Docs](https://nightre.github.io/Rapid.js/docs/api/index.html) | [Examples](https://nightre.github.io/Rapid.js/docs/examples.html)
|
|
16
8
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
# Features
|
|
9
|
+
## Features
|
|
20
10
|
|
|
21
11
|
* **Fast Rendering**
|
|
22
12
|
* **TileMap** - YSort, isometric
|
|
@@ -26,91 +16,49 @@ games, while staying completely independent from your game's architecture and lo
|
|
|
26
16
|
* **Custom Shaders**
|
|
27
17
|
* **Mask**
|
|
28
18
|
|
|
29
|
-
|
|
30
|
-
> This project is under active development! Please expect bugs, report any issues you find, and contributions are welcome.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
# Install
|
|
19
|
+
## Install
|
|
34
20
|
|
|
35
|
-
```
|
|
21
|
+
```bash
|
|
36
22
|
npm i rapid-render
|
|
37
23
|
```
|
|
38
24
|
|
|
39
|
-
Or
|
|
25
|
+
Or via CDN:
|
|
40
26
|
|
|
41
27
|
```html
|
|
42
28
|
<script src="https://unpkg.com/rapid-render/dist/rapid.umd.cjs"></script>
|
|
43
29
|
```
|
|
44
30
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
```js
|
|
48
|
-
import { Rapid } from "rapid-render"
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
# Usage
|
|
52
|
-
|
|
53
|
-
Rapid.js is a focused WebGL-based 2D rendering engine that provides rendering capabilities only. It does not include any game architecture, state management, physics, or other game-related systems - it's purely a rendering engine. This intentional design choice means you have complete freedom to structure your game however you want.
|
|
54
|
-
|
|
55
|
-
Here's a simple example showing how to use Rapid.js to create a bouncing box:
|
|
56
|
-
|
|
57
|
-
First, create a canvas element in your HTML:
|
|
58
|
-
|
|
59
|
-
```html
|
|
60
|
-
<canvas id="gameCanvas" width="500" height="500"></canvas>
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
Then, add the following JavaScript code:
|
|
31
|
+
## Quick Start
|
|
64
32
|
|
|
65
33
|
```js
|
|
66
34
|
import { Rapid, Color, Vec2 } from "rapid-render"
|
|
67
35
|
|
|
68
|
-
// Initialize
|
|
36
|
+
// Initialize
|
|
69
37
|
const rapid = new Rapid({
|
|
70
38
|
canvas: document.getElementById("gameCanvas"),
|
|
71
39
|
backgroundColor: Color.fromHex("E6F0FF")
|
|
72
40
|
})
|
|
73
41
|
|
|
74
|
-
//
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
position.y += velocity.y
|
|
82
|
-
|
|
83
|
-
// Simple collision with boundaries
|
|
84
|
-
if (position.x < 0 || position.x > 400) velocity.x *= -1
|
|
85
|
-
if (position.y < 0 || position.y > 400) velocity.y *= -1
|
|
86
|
-
|
|
87
|
-
// Render using the recommended render callback method
|
|
88
|
-
rapid.render(() => {
|
|
89
|
-
rapid.renderRect({
|
|
90
|
-
offset: position,
|
|
91
|
-
width: 50,
|
|
92
|
-
height: 50,
|
|
93
|
-
color: Color.Red
|
|
94
|
-
})
|
|
42
|
+
// Render example
|
|
43
|
+
rapid.render(() => {
|
|
44
|
+
rapid.renderRect({
|
|
45
|
+
offset: new Vec2(100, 100),
|
|
46
|
+
width: 50,
|
|
47
|
+
height: 50,
|
|
48
|
+
color: Color.Red
|
|
95
49
|
})
|
|
96
|
-
|
|
97
|
-
// ...
|
|
98
|
-
// rapid.endRender();
|
|
99
|
-
requestAnimationFrame(gameLoop);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
gameLoop()
|
|
50
|
+
})
|
|
103
51
|
```
|
|
104
52
|
|
|
105
|
-
|
|
53
|
+
For more examples and detailed documentation, visit our [website](https://nightre.github.io/Rapid.js/docs/index.html).
|
|
54
|
+
|
|
55
|
+
## Roadmap
|
|
106
56
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
57
|
+
* Frame Buffer Object (FBO)
|
|
58
|
+
* Light System
|
|
59
|
+
* Line Texture
|
|
60
|
+
* Particle System
|
|
110
61
|
|
|
111
|
-
|
|
62
|
+
## Contributing
|
|
112
63
|
|
|
113
|
-
|
|
114
|
-
* Light system
|
|
115
|
-
* Line Texture
|
|
116
|
-
* Particle system
|
|
64
|
+
Issues and PRs are welcome!
|