@nativescript/canvas-phaser 2.0.14 β 2.0.18
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 +1 -60
- package/index.d.ts +1 -0
- package/index.js +2 -0
- package/index.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
# @nativescript/canvas-phaser
|
|
2
2
|
|
|
3
|
-
Tools for using
|
|
4
|
-
|
|
5
|
-
- [Installation](#installation)
|
|
6
|
-
- [Usage](#usage)
|
|
7
|
-
- [Functions](#functions)
|
|
3
|
+
Tools for using Phaser to build native 2D games in NativeScript πΎπΎ
|
|
8
4
|
|
|
9
5
|
### Installation
|
|
10
6
|
|
|
@@ -12,61 +8,6 @@ Tools for using Phaser3 to build native 2D games in NativeScript πΎπΎ
|
|
|
12
8
|
npm i @nativescript/canvas-phaser
|
|
13
9
|
```
|
|
14
10
|
|
|
15
|
-
### Usage
|
|
16
|
-
|
|
17
|
-
Import the library into your JavaScript file:
|
|
18
|
-
|
|
19
|
-
```js
|
|
20
|
-
import TNSPhaser from "@nativescript/canvas-phaser";
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Functions
|
|
24
|
-
|
|
25
|
-
### `TNSPhaser.game({ canvas, renderer: Phaser.WEBGL || Phaser.CANVAS, ...extras })`
|
|
26
|
-
|
|
27
|
-
Given a `canvas` from a
|
|
28
|
-
[`Canvas`](https://github.com/nativescript/canvas), return a
|
|
29
|
-
[`Phaser.Game`](https://photonstorm.github.io/phaser3-docs/Phaser.Game.html)
|
|
30
|
-
that draws into it.
|
|
31
|
-
|
|
32
|
-
#### Props
|
|
33
|
-
|
|
34
|
-
| Property | Type | Description | Default Value |
|
|
35
|
-
| ----------- | :-------------------: | --------------------------------------------------------------------------- | :---------------------------: |
|
|
36
|
-
| canvas | TNSCanvas| Required: canvas that the `Phaser.Game` will render to | `null` |
|
|
37
|
-
| renderer | number?| Optional: choose the renderer type e.g Phaser.CANVAS (1) , Phaser.WEBGL(2) | `1` |
|
|
38
|
-
| width | number? | Optional: height of the `Phaser.Game` | `canvas height` |
|
|
39
|
-
| height | number? | Optional: width of the `Phaser.Game` | `canvas width` |
|
|
40
|
-
| title | string? | Optional: title of the `Phaser.Game` | `"tns-phaser-game"` |
|
|
41
|
-
|
|
42
|
-
#### Returns
|
|
43
|
-
|
|
44
|
-
| Property | Type | Description |
|
|
45
|
-
| -------- | :------------------------------------------------------------: | ------------------------------------------------ |
|
|
46
|
-
| game | [`Phaser.Game`](https://photonstorm.github.io/phaser3-docs/Phaser.Game.html) | The Phaser3 game used for rendering game logic |
|
|
47
|
-
|
|
48
|
-
## Example
|
|
49
|
-
|
|
50
|
-
```js
|
|
51
|
-
const game = TNSPhaser.game({ canvas });
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## What does it do?
|
|
55
|
-
|
|
56
|
-
Under the hood, TNSPhaser is maintaining global instances of a few libraries.
|
|
57
|
-
|
|
58
|
-
- [Phaser3](https://github.com/photonstorm/phaser)
|
|
59
|
-
|
|
60
|
-
```js
|
|
61
|
-
window.Phaser = require("phaser");
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
Finally when a new instance of `TNSPhaser.Game` is created, we set the `document.readyState` to `'complete'`
|
|
65
|
-
|
|
66
|
-
```js
|
|
67
|
-
global.document.readyState = "complete";
|
|
68
|
-
```
|
|
69
|
-
|
|
70
11
|
## License
|
|
71
12
|
|
|
72
13
|
Apache License Version 2.0, January 2004
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@nativescript/canvas-polyfill';
|
package/index.js
ADDED
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/canvas-phaser/index.ts"],"names":[],"mappings":"AAAA,OAAO,+BAA+B,CAAC"}
|