@litecanvas/utils 0.8.0 → 0.8.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.
- package/README.md +40 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,46 @@
|
|
|
2
2
|
|
|
3
3
|
Small collection of tools for developing games with [Litecanvas](https://github.com/litecanvas/game-engine).
|
|
4
4
|
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
### NPM package
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
npm i @litecanvas/utils
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
// import everything
|
|
15
|
+
import * as utils from "@litecanvas/utils"
|
|
16
|
+
|
|
17
|
+
const pos = utils.vec(0, 0)
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
// or import just what you want
|
|
22
|
+
import { vec } from "@litecanvas/utils"
|
|
23
|
+
|
|
24
|
+
const pos = vec(0, 0)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### CDN
|
|
28
|
+
|
|
29
|
+
Download from https://unpkg.com/browse/@litecanvas/utils/dist/ and load in a `<script>` tag in your HTML.
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
// now the "utils" namespace is created
|
|
33
|
+
const pos = utils.vec(0, 0)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
// also, you can call this once to
|
|
38
|
+
// expose the components globally
|
|
39
|
+
utils.global()
|
|
40
|
+
|
|
41
|
+
// now the namescape is not required
|
|
42
|
+
const pos = vec(0, 0)
|
|
43
|
+
```
|
|
44
|
+
|
|
5
45
|
## Components
|
|
6
46
|
|
|
7
47
|
- **Camera**: Move-, zoom- and rotatable camera with shake. [Usage & Docs](https://github.com/litecanvas/utils/tree/main/src/camera)
|
|
@@ -10,9 +50,3 @@ Small collection of tools for developing games with [Litecanvas](https://github.
|
|
|
10
50
|
- **Grid**: class to handle retangular grid areas. [Usage & Docs](https://github.com/litecanvas/utils/tree/main/src/grid)
|
|
11
51
|
- **Collision** utilities. [Usage & Docs](https://github.com/litecanvas/utils/tree/main/src/collision)
|
|
12
52
|
- And [some math utilities](https://github.com/litecanvas/utils/tree/main/src/math)
|
|
13
|
-
|
|
14
|
-
## Install
|
|
15
|
-
|
|
16
|
-
```
|
|
17
|
-
npm i @litecanvas/utils
|
|
18
|
-
```
|