2013-10-22 02:58:20 +00:00
|
|
|
|
|
|
|
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
|
|
|
|
|
|
|
function preload() {
|
|
|
|
|
2014-02-25 16:26:11 +00:00
|
|
|
game.load.image('dragon', 'assets/pics/cougar_dragonsun.png');
|
2013-10-22 02:58:20 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function create() {
|
|
|
|
|
2014-02-25 16:26:11 +00:00
|
|
|
var sprite = game.add.sprite(game.world.centerX, game.world.centerY, 'dragon');
|
|
|
|
sprite.anchor.set(0.5);
|
2013-10-22 02:58:20 +00:00
|
|
|
|
2014-02-25 16:26:11 +00:00
|
|
|
game.stage.backgroundColor = '#000';
|
2013-10-22 02:58:20 +00:00
|
|
|
|
2013-12-05 01:00:36 +00:00
|
|
|
// Stretch to fill
|
2014-02-25 16:26:11 +00:00
|
|
|
game.scale.fullScreenScaleMode = Phaser.ScaleManager.EXACT_FIT;
|
|
|
|
|
2013-12-05 01:00:36 +00:00
|
|
|
// Keep original size
|
2014-02-25 16:26:11 +00:00
|
|
|
// game.scale.fullScreenScaleMode = Phaser.ScaleManager.NO_SCALE;
|
|
|
|
|
2013-12-05 01:00:36 +00:00
|
|
|
// Maintain aspect ratio
|
2014-02-25 16:26:11 +00:00
|
|
|
// game.scale.fullScreenScaleMode = Phaser.ScaleManager.SHOW_ALL;
|
2013-12-05 01:00:36 +00:00
|
|
|
|
2013-10-22 02:58:20 +00:00
|
|
|
game.input.onDown.add(gofull, this);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function gofull() {
|
|
|
|
|
2014-02-21 15:53:07 +00:00
|
|
|
game.scale.startFullScreen();
|
2013-10-22 02:58:20 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function update() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function render () {
|
|
|
|
|
2014-02-25 16:26:11 +00:00
|
|
|
game.debug.renderText('Click / Tap to go fullscreen', 270, 16);
|
2013-10-22 02:58:20 +00:00
|
|
|
|
|
|
|
}
|