Fullscreen mode now uses window.outerWidth/Height when using EXACT_FIT as the scale mode, which fixes input coordinate errors (fixes #232)

Fullscreen mode now works in Internet Explorer and uses the new fullscreen non-prefix call.
This commit is contained in:
photonstorm
2014-02-25 21:16:56 +00:00
parent 741249043c
commit db2e3733c2
6 changed files with 105 additions and 30 deletions
+3 -1
View File
@@ -394,7 +394,7 @@ Phaser.Game.prototype = {
this.isBooted = true;
this.device = new Phaser.Device();
this.device = new Phaser.Device(this);
this.math = Phaser.Math;
this.rnd = new Phaser.RandomDataGenerator([(Date.now() * Math.random()).toString()]);
@@ -403,6 +403,8 @@ Phaser.Game.prototype = {
this.setUpRenderer();
this.device.checkFullScreenSupport();
this.world = new Phaser.World(this);
this.add = new Phaser.GameObjectFactory(this);
this.make = new Phaser.GameObjectCreator(this);
+7 -27
View File
@@ -262,35 +262,26 @@ Phaser.ScaleManager.prototype = {
*/
startFullScreen: function (antialias) {
if (this.isFullScreen)
if (this.isFullScreen || !this.game.device.fullscreen)
{
return;
}
if (typeof antialias !== 'undefined' && this.game.renderType === Phaser.CANVAS)
{
Phaser.Canvas.setSmoothingEnabled(this.game.context, antialias);
this.game.stage.smoothed = antialias;
}
var element = this.game.canvas;
this._width = this.width;
this._height = this.height;
// This needs updating to match the final spec:
// http://generatedcontent.org/post/70347573294/is-your-fullscreen-api-code-up-to-date-find-out-how-to
if (element['requestFullScreen'])
if (this.game.device.fullscreenKeyboard)
{
element['requestFullScreen']();
this.game.canvas[this.game.device.requestFullscreen](Element.ALLOW_KEYBOARD_INPUT);
}
else if (element['mozRequestFullScreen'])
else
{
element.parentNode['mozRequestFullScreen']();
}
else if (element['webkitRequestFullScreen'])
{
element['webkitRequestFullScreen'](Element.ALLOW_KEYBOARD_INPUT);
this.game.canvas[this.game.device.requestFullscreen]();
}
},
@@ -301,18 +292,7 @@ Phaser.ScaleManager.prototype = {
*/
stopFullScreen: function () {
if (document['cancelFullScreen'])
{
document['cancelFullScreen']();
}
else if (document['mozCancelFullScreen'])
{
document['mozCancelFullScreen']();
}
else if (document['webkitCancelFullScreen'])
{
document['webkitCancelFullScreen']();
}
this.game.canvas[this.game.device.cancelFullscreen]();
},