mirror of
https://github.com/wassname/phaser.git
synced 2026-08-11 11:23:06 +08:00
Updated docs for 1.1.2 release.
This commit is contained in:
+82
-23
@@ -58,10 +58,6 @@
|
||||
<a href="Phaser.BitmapText.html">BitmapText</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Bullet.html">Bullet</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Button.html">Button</a>
|
||||
</li>
|
||||
@@ -468,15 +464,27 @@ Phaser.StageScaleMode = function (game, width, height) {
|
||||
|
||||
/**
|
||||
* @property {number} width - Width of the stage after calculation.
|
||||
* @default
|
||||
*/
|
||||
this.width = 0;
|
||||
this.width = width;
|
||||
|
||||
/**
|
||||
* @property {number} height - Height of the stage after calculation.
|
||||
* @default
|
||||
*/
|
||||
this.height = 0;
|
||||
this.height = height;
|
||||
|
||||
/**
|
||||
* @property {number} _width - Cached stage width for full screen mode.
|
||||
* @default
|
||||
* @private
|
||||
*/
|
||||
this._width = 0;
|
||||
|
||||
/**
|
||||
* @property {number} _height - Cached stage height for full screen mode.
|
||||
* @default
|
||||
* @private
|
||||
*/
|
||||
this._height = 0;
|
||||
|
||||
/**
|
||||
* @property {number} maxIterations - The maximum number of times it will try to resize the canvas to fill the browser.
|
||||
@@ -535,6 +543,18 @@ Phaser.StageScaleMode = function (game, width, height) {
|
||||
window.addEventListener('resize', function (event) {
|
||||
return _this.checkResize(event);
|
||||
}, false);
|
||||
|
||||
document.addEventListener('webkitfullscreenchange', function (event) {
|
||||
return _this.fullScreenChange(event);
|
||||
}, false);
|
||||
|
||||
document.addEventListener('mozfullscreenchange', function (event) {
|
||||
return _this.fullScreenChange(event);
|
||||
}, false);
|
||||
|
||||
document.addEventListener('fullscreenchange', function (event) {
|
||||
return _this.fullScreenChange(event);
|
||||
}, false);
|
||||
|
||||
};
|
||||
|
||||
@@ -562,16 +582,27 @@ Phaser.StageScaleMode.prototype = {
|
||||
* Tries to enter the browser into full screen mode.
|
||||
* Please note that this needs to be supported by the web browser and isn't the same thing as setting your game to fill the browser.
|
||||
* @method Phaser.StageScaleMode#startFullScreen
|
||||
* @param {boolean} antialias - You can toggle the anti-alias feature of the canvas before jumping in to full screen (false = retain pixel art, true = smooth art)
|
||||
*/
|
||||
startFullScreen: function () {
|
||||
startFullScreen: function (antialias) {
|
||||
|
||||
if (this.isFullScreen)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof antialias !== 'undefined')
|
||||
{
|
||||
Phaser.Canvas.setSmoothingEnabled(this.game.context, antialias);
|
||||
}
|
||||
|
||||
var element = this.game.canvas;
|
||||
|
||||
this._width = this.width;
|
||||
this._height = this.height;
|
||||
|
||||
console.log('startFullScreen', this._width, this._height);
|
||||
|
||||
if (element['requestFullScreen'])
|
||||
{
|
||||
element['requestFullScreen']();
|
||||
@@ -585,9 +616,6 @@ Phaser.StageScaleMode.prototype = {
|
||||
element['webkitRequestFullScreen'](Element.ALLOW_KEYBOARD_INPUT);
|
||||
}
|
||||
|
||||
this.game.stage.canvas.style['width'] = '100%';
|
||||
this.game.stage.canvas.style['height'] = '100%';
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -611,6 +639,44 @@ Phaser.StageScaleMode.prototype = {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Called automatically when the browser enters of leaves full screen mode.
|
||||
* @method Phaser.StageScaleMode#fullScreenChange
|
||||
* @param {Event} event - The fullscreenchange event
|
||||
* @protected
|
||||
*/
|
||||
fullScreenChange: function (event) {
|
||||
|
||||
if (this.isFullScreen)
|
||||
{
|
||||
this.game.stage.canvas.style['width'] = '100%';
|
||||
this.game.stage.canvas.style['height'] = '100%';
|
||||
|
||||
this.setMaximum();
|
||||
|
||||
this.game.input.scale.setTo(this.game.width / this.width, this.game.height / this.height);
|
||||
|
||||
this.aspectRatio = this.width / this.height;
|
||||
this.scaleFactor.x = this.game.width / this.width;
|
||||
this.scaleFactor.y = this.game.height / this.height;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.game.stage.canvas.style['width'] = this.game.width + 'px';
|
||||
this.game.stage.canvas.style['height'] = this.game.height + 'px';
|
||||
|
||||
this.width = this._width;
|
||||
this.height = this._height;
|
||||
|
||||
this.game.input.scale.setTo(this.game.width / this.width, this.game.height / this.height);
|
||||
|
||||
this.aspectRatio = this.width / this.height;
|
||||
this.scaleFactor.x = this.game.width / this.width;
|
||||
this.scaleFactor.y = this.game.height / this.height;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks if the browser is in the correct orientation for your game (if forceLandscape or forcePortrait have been set)
|
||||
* @method Phaser.StageScaleMode#checkOrientationState
|
||||
@@ -878,8 +944,8 @@ Phaser.StageScaleMode.prototype = {
|
||||
*/
|
||||
setExactFit: function () {
|
||||
|
||||
var availableWidth = window.innerWidth - 0;
|
||||
var availableHeight = window.innerHeight - 5;
|
||||
var availableWidth = window.innerWidth;
|
||||
var availableHeight = window.innerHeight;
|
||||
|
||||
// console.log('available', availableWidth, availableHeight);
|
||||
|
||||
@@ -901,8 +967,6 @@ Phaser.StageScaleMode.prototype = {
|
||||
this.height = availableHeight;
|
||||
}
|
||||
|
||||
console.log('setExactFit', this.width, this.height, this.game.stage.offset);
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
@@ -916,12 +980,7 @@ Object.defineProperty(Phaser.StageScaleMode.prototype, "isFullScreen", {
|
||||
|
||||
get: function () {
|
||||
|
||||
if (document['fullscreenElement'] === null || document['mozFullScreenElement'] === null || document['webkitFullscreenElement'] === null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return (document['fullscreenElement'] || document['mozFullScreenElement'] || document['webkitFullscreenElement'])
|
||||
|
||||
}
|
||||
|
||||
@@ -973,7 +1032,7 @@ Object.defineProperty(Phaser.StageScaleMode.prototype, "isLandscape", {
|
||||
|
||||
<span class="jsdoc-message">
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
|
||||
on Fri Oct 25 2013 17:05:24 GMT+0100 (BST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
on Fri Nov 01 2013 18:16:08 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
</span>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user