-
Notifications
You must be signed in to change notification settings - Fork 490
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #266 from georgesboris/patch-1
Add simpler phaser/webpack setup sample Closes #95
- Loading branch information
Showing
11 changed files
with
93 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
yarn.lock | ||
public/assets/scripts/bundle*.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "phaser-webpack", | ||
"version": "1.0.0", | ||
"description": "Simple boilerplate project that combines [Phaser](http://phaser.io) with [Webpack](http://webpack.github.io).", | ||
"dependencies": { | ||
"phaser-ce": "^2.8.0" | ||
}, | ||
"devDependencies": { | ||
"expose-loader": "^0.7.3", | ||
"webpack": "^3.0.0", | ||
"webpack-dev-server": "^2.5.0" | ||
}, | ||
"scripts": { | ||
"start": "webpack-dev-server", | ||
"build": "webpack" | ||
}, | ||
"license": "ISC" | ||
} |
File renamed without changes
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* Import Phaser dependencies using `expose-loader`. | ||
* This makes then available globally and it's something required by Phaser. | ||
* The order matters since Phaser needs them available before it is imported. | ||
*/ | ||
|
||
import PIXI from 'expose-loader?PIXI!phaser-ce/build/custom/pixi.js'; | ||
import p2 from 'expose-loader?p2!phaser-ce/build/custom/p2.js'; | ||
import Phaser from 'expose-loader?Phaser!phaser-ce/build/custom/phaser-split.js'; | ||
|
||
/** | ||
* Create a new Phaser game instance. | ||
* And render a single sprite so we make sure it works. | ||
*/ | ||
|
||
var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update }); | ||
|
||
function preload() { | ||
game.load.image('logo', './assets/images/phaser.png'); | ||
} | ||
|
||
function create() { | ||
var logo = game.add.sprite(game.world.centerX, game.world.centerY, 'logo'); | ||
logo.anchor.setTo(0.5, 0.5); | ||
}; | ||
|
||
function update() { | ||
// ¯ \_(ツ)_/¯ | ||
// "surprise me" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const path = require('path'); | ||
|
||
module.exports = { | ||
|
||
/** | ||
* Minimal build setup. | ||
* Create your app bundle. | ||
*/ | ||
|
||
entry: './src/index.js', | ||
output: { | ||
filename: 'bundle.js', | ||
path: path.join(__dirname, 'public', 'assets', 'scripts') | ||
}, | ||
|
||
/** | ||
* Minimal development setup. | ||
* Serves files in ./public folder. | ||
* Refresh browser automatically when your bundle changes. | ||
*/ | ||
|
||
devServer: { | ||
publicPath: '/assets/scripts/', | ||
contentBase: path.join(__dirname, 'public'), | ||
port: 3000 | ||
} | ||
|
||
}; |