Skip to content

Commit 62c9613

Browse files
committed
Update version of the packages to 1.2.3 (core) and 1.2.2 (react)
1 parent 7457dad commit 62c9613

32 files changed

+2482
-358
lines changed

.eslintrc.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"parserOptions": {
3+
"project": "./tsconfig.json"
4+
},
5+
"extends": [
6+
"plugin:@stencil/recommended"
7+
],
8+
"rules": {
9+
"@stencil/strict-mutable": "off"
10+
},
11+
"settings": {
12+
"react": {
13+
"version": "16.7"
14+
}
15+
}
16+
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Looking for [Phaser Framework CE (Community Edition)](https://github.com/photons
3838

3939
### Script tag
4040

41-
- Put a script tag similar to this `<script src='https://unpkg.com/@ion-phaser/[email protected].2/dist/ionphaser.js'></script>` in the head of your index.html
41+
- Put a script tag similar to this `<script src='https://unpkg.com/@ion-phaser/[email protected].3/dist/ionphaser.js'></script>` in the head of your index.html
4242
- Then you can use the element anywhere in your template, JSX, html etc
4343

4444
### Node Modules

demo-react/package.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@
44
"private": true,
55
"dependencies": {
66
"@ion-phaser/react": "file:../react",
7-
"phaser": "^3.19.0",
8-
"react": "^16.9.0",
9-
"react-dom": "^16.9.0",
10-
"react-scripts": "3.1.1"
7+
"@types/jest": "^25.2.1",
8+
"@types/node": "^13.13.4",
9+
"@types/react": "^16.9.34",
10+
"@types/react-dom": "^16.9.7",
11+
"phaser": "^3.23.0",
12+
"react": "^16.13.1",
13+
"react-dom": "^16.13.1",
14+
"react-scripts": "3.4.1",
15+
"typescript": "^3.8.3"
1116
},
1217
"scripts": {
1318
"start": "react-scripts start",

demo-react/src/App.js

Lines changed: 0 additions & 76 deletions
This file was deleted.
File renamed without changes.

demo-react/src/App.tsx

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
/**
2+
* @flow
3+
*/
4+
5+
import React, { useState } from 'react'
6+
import Phaser, { } from 'phaser'
7+
import { IonPhaser } from '@ion-phaser/react'
8+
import logo from './assets/logo.png'
9+
10+
import './App.css'
11+
12+
class MainScene extends Phaser.Scene {
13+
private helloWorld: Phaser.GameObjects.Text
14+
15+
init () {
16+
this.cameras.main.setBackgroundColor('#24252A')
17+
}
18+
19+
create () {
20+
this.helloWorld = this.add.text(
21+
this.cameras.main.centerX,
22+
this.cameras.main.centerY,
23+
"Hello World", {
24+
font: "40px Arial",
25+
fill: "#ffffff"
26+
}
27+
);
28+
this.helloWorld.setOrigin(0.5);
29+
}
30+
update () {
31+
this.helloWorld.angle += 1;
32+
}
33+
}
34+
35+
const game: Phaser.Types.Core.GameConfig = {
36+
width: "100%",
37+
height: "100%",
38+
type: Phaser.AUTO,
39+
scale: {
40+
mode: Phaser.Scale.FIT,
41+
autoCenter: Phaser.Scale.CENTER_BOTH,
42+
width: '100%',
43+
height: '100%'
44+
},
45+
render: {
46+
antialias: false,
47+
pixelArt: true,
48+
roundPixels: true
49+
},
50+
physics: {
51+
default: 'arcade',
52+
arcade: {
53+
gravity: { y: 400 },
54+
debug: true
55+
}
56+
},
57+
scene: MainScene
58+
};
59+
60+
const destroy = () => window.location.reload()
61+
62+
export default function App () {
63+
const [initialize, setInitialize] = useState(false)
64+
65+
return (
66+
<div className="App">
67+
<header className="App-header">
68+
{ initialize ? (
69+
<>
70+
<IonPhaser game={game} initialize={initialize} />
71+
<div onClick={destroy} className="flex destroyButton">
72+
<a href="#1" className="bttn">Destroy</a>
73+
</div>
74+
</>
75+
) : (
76+
<>
77+
<img src={logo} className="App-logo" alt="logo" />
78+
<div onClick={() => setInitialize(true)} className="flex">
79+
<a href="#1" className="bttn">Initialize</a>
80+
</div>
81+
</>
82+
)}
83+
</header>
84+
</div>
85+
);
86+
}

demo-react/src/index.js renamed to demo-react/src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ ReactDOM.render(<App />, document.getElementById('root'));
99
// If you want your app to work offline and load faster, you can change
1010
// unregister() to register() below. Note this comes with some pitfalls.
1111
// Learn more about service workers: https://bit.ly/CRA-PWA
12-
serviceWorker.unregister();
12+
serviceWorker.unregister();

demo-react/src/react-app-env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="react-scripts" />

demo-react/tsconfig.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es5",
4+
"lib": [
5+
"dom",
6+
"dom.iterable",
7+
"esnext"
8+
],
9+
"allowJs": true,
10+
"skipLibCheck": true,
11+
"esModuleInterop": true,
12+
"allowSyntheticDefaultImports": true,
13+
"strict": true,
14+
"forceConsistentCasingInFileNames": true,
15+
"module": "esnext",
16+
"moduleResolution": "node",
17+
"resolveJsonModule": true,
18+
"isolatedModules": true,
19+
"noEmit": true,
20+
"jsx": "react"
21+
},
22+
"include": [
23+
"src"
24+
]
25+
}

0 commit comments

Comments
 (0)