mirror of
https://github.com/photonstorm/phaser
synced 2024-11-27 07:01:20 +00:00
e3d53ad6a3
If the game was set to NO_SCALE and you swapped orientation, it would pause and resize, then fail to resize when you swapped back (thanks starnut, fixes #258)
59 lines
No EOL
1.2 KiB
JavaScript
59 lines
No EOL
1.2 KiB
JavaScript
|
|
var game = new Phaser.Game(1024, 672, Phaser.CANVAS, 'phaser-example', { init: init, preload: preload, create: create, update: update, render: render });
|
|
|
|
function init() {
|
|
|
|
game.scale.scaleMode = Phaser.ScaleManager.NO_SCALE;
|
|
// game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
|
|
game.scale.forceOrientation(true, false);
|
|
game.scale.enterIncorrectOrientation.add(enterIncorrectOrientation, game);
|
|
game.scale.leaveIncorrectOrientation.add(leaveIncorrectOrientation, game);
|
|
game.scale.setScreenSize(true);
|
|
|
|
game.stage.backgroundColor = 0x004400;
|
|
|
|
}
|
|
|
|
function preload() {
|
|
|
|
game.load.image('pic', 'assets/pics/remember-me.jpg');
|
|
game.load.spritesheet('mummy', 'assets/sprites/metalslug_mummy37x45.png', 37, 45, 18);
|
|
|
|
}
|
|
|
|
var mummy;
|
|
var anim;
|
|
|
|
function create() {
|
|
|
|
game.add.image(0, 0, 'pic');
|
|
|
|
mummy = game.add.sprite(300, 200, 'mummy', 5);
|
|
|
|
anim = mummy.animations.add('walk');
|
|
|
|
anim.play(20, true);
|
|
|
|
}
|
|
|
|
function enterIncorrectOrientation () {
|
|
|
|
// game.stage.backgroundColor = 0xff0000;
|
|
|
|
}
|
|
|
|
function leaveIncorrectOrientation () {
|
|
|
|
// game.stage.backgroundColor = 0x000033;
|
|
|
|
}
|
|
|
|
function update() {
|
|
|
|
}
|
|
|
|
function render() {
|
|
|
|
// game.debug.renderPointer(game.input.activePointer);
|
|
|
|
} |