Skip to content

Commit

Permalink
Fix README using ion-phaser-ce tag instead
Browse files Browse the repository at this point in the history
  • Loading branch information
jdnichollsc committed Oct 13, 2019
1 parent 4249d1d commit 5351f71
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 33 deletions.
1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
node_modules
react
demo-*
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@ion-phaser-ce/core",
"version": "1.0.0",
"private": false,
"description": "A web component to integrate Phaser Framework CE (Community Edition) with Angular, React, Vue, etc",
"keywords": [
"ionic",
Expand Down Expand Up @@ -46,6 +47,5 @@
"repository": {
"type": "git",
"url": "https://github.com/proyecto26/ion-phaser-ce.git"
},
"private": false
}
}
32 changes: 21 additions & 11 deletions react/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
# IonPhaser for React

## Introduction
React specific wrapper for [ion-phaser](https://github.com/proyecto26/ion-phaser) component.
React specific wrapper for [ion-phaser-ce](https://github.com/proyecto26/ion-phaser-ce) component.

## Why?
*Most people who use React don’t use [Web Components](https://reactjs.org/docs/web-components.html)* and there're some limitations handling data with [Custom Components](https://custom-elements-everywhere.com/) from React.
Thus, this **React component** was created not to need to reference their **Custom Elements** using a **ref** and manually attach the **game**, this makes working with [IonPhaser](https://github.com/proyecto26/ion-phaser) not cumbersome 👍🏻
Thus, this **React component** was created not to need to reference their **Custom Elements** using a **ref** and manually attach the **game**, this makes working with [IonPhaser](https://github.com/proyecto26/ion-phaser-ce) not cumbersome 👍🏻

## Usage

- Import Phaser CE dependencies before, check the example [here](https://github.com/proyecto26/ion-phaser-ce/blob/master/demo-react/src/global.js):

```js
window.PIXI = require('phaser-ce/build/custom/pixi');
window.p2 = require('phaser-ce/build/custom/p2');
window.Phaser = require('phaser-ce/build/custom/phaser-split');
```

- Using the **IonPhaser** component:

```tsx
import React, { Component } from 'react'
import Phaser from 'phaser'
import { IonPhaser } from '@ion-phaser/react'
import Phaser from 'phaser-ce'
import { IonPhaser } from '@ion-phaser-ce/react'

class App extends Component {

Expand All @@ -21,21 +31,21 @@ class App extends Component {
game: {
width: "100%",
height: "100%",
type: Phaser.AUTO,
scene: {
renderer: Phaser.AUTO,
state: {
init: function() {
this.cameras.main.setBackgroundColor('#24252A')
this.stage.backgroundColor = '#24252A';
},
create: function() {
this.helloWorld = this.add.text(
this.cameras.main.centerX,
this.cameras.main.centerY,
this.game.world.centerX,
this.game.world.centerY,
"Hello World", {
font: "40px Arial",
fill: "#ffffff"
}
);
this.helloWorld.setOrigin(0.5);
this.helloWorld.anchor.set(0.5);
},
update: function() {
this.helloWorld.angle += 1;
Expand All @@ -59,7 +69,7 @@ export default App;
## Supporting 🍻
I believe in Unicorns 🦄
Support [me](http://www.paypal.me/jdnichollsc/2), if you do too.
[Professionally supported @ion-phaser/react is coming soon](https://tidelift.com/subscription/pkg/npm--ion-phaser-react?utm_source=npm--ion-phaser-react&utm_medium=referral&utm_campaign=readme)
[Professionally supported @ion-phaser-ce/react is coming soon](https://tidelift.com/subscription/pkg/npm--ion-phaser-react?utm_source=npm--ion-phaser-react&utm_medium=referral&utm_campaign=readme)

## Happy coding 💯
Made with ❤️
Expand Down
4 changes: 2 additions & 2 deletions react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ion-phaser-ce/react",
"version": "1.0.0",
"version": "1.0.1",
"description": "React specific wrapper for @ion-phaser-ce/core",
"keywords": [
"ionic",
Expand Down Expand Up @@ -35,7 +35,7 @@
"dist/"
],
"dependencies": {
"@ion-phaser-ce/core": "file:.."
"@ion-phaser-ce/core": "^1.0.0"
},
"devDependencies": {
"@types/jest": "^23.3.9",
Expand Down
19 changes: 2 additions & 17 deletions react/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,26 @@ import resolve from 'rollup-plugin-node-resolve';
import sourcemaps from 'rollup-plugin-sourcemaps';
import commonjs from 'rollup-plugin-commonjs';

// import path from 'path';
// const phaserModule = path.join(__dirname, './node_modules/phaser-ce/');
// const pixi = path.resolve(phaserModule, 'phaser-ce/build/custom/pixi');
// const p2 = path.resolve(phaserModule, 'phaser-ce/build/custom/p2');

export default {
input: 'dist-transpiled/index.js',
output: [
{
file: 'dist/index.esm.js',
format: 'es',
sourcemap: true,
globals: {
'phaser-ce/build/custom/pixi': 'PIXI',
'phaser-ce/build/custom/p2': 'p2'
}
sourcemap: true
},
{
file: 'dist/index.js',
format: 'commonjs',
preferConst: true,
sourcemap: true,
globals: {
'phaser-ce/build/custom/pixi': 'PIXI',
'phaser-ce/build/custom/p2': 'p2'
}
sourcemap: true
}
],
external: [
'@ion-phaser-ce/core',
'@ion-phaser-ce/core/loader',
'react',
'tslib',
'phaser-ce/build/custom/pixi',
'phaser-ce/build/custom/p2',
'phaser-ce'
],
plugins: [
Expand Down

0 comments on commit 5351f71

Please sign in to comment.