This commit is contained in:
Richard Davey 2018-08-20 18:46:13 +01:00
commit f70b4f89b1
7 changed files with 103 additions and 56 deletions

View file

@ -319,23 +319,23 @@ var AnimationManager = new Class({
/** /**
* @typedef {object} GenerateFrameNumbersConfig * @typedef {object} GenerateFrameNumbersConfig
* *
* @property {integer} [start=0] - [description] * @property {integer} [start=0] - The starting frame of the animation.
* @property {integer} [end=-1] - [description] * @property {integer} [end=-1] - The ending frame of the animation.
* @property {boolean} [first=false] - [description] * @property {(boolean|integer)} [first=false] - A frame to put at the beginning of the animation, before `start` or `outputArray` or `frames`.
* @property {AnimationFrameConfig[]} [outputArray=[]] - [description] * @property {AnimationFrameConfig[]} [outputArray=[]] - An array to concatenate the output onto.
* @property {boolean} [frames=false] - [description] * @property {(boolean|integer[])} [frames=false] - A custom sequence of frames.
*/ */
/** /**
* [description] * Generates an array of {@link AnimationFrameConfig} objects from a texture key and configuration object.
* *
* @method Phaser.Animations.AnimationManager#generateFrameNumbers * @method Phaser.Animations.AnimationManager#generateFrameNumbers
* @since 3.0.0 * @since 3.0.0
* *
* @param {string} key - [description] * @param {string} key - The key for the texture containing the animation frames.
* @param {GenerateFrameNumbersConfig} config - [description] * @param {GenerateFrameNumbersConfig} config - The configuration object for the animation frames.
* *
* @return {AnimationFrameConfig[]} [description] * @return {AnimationFrameConfig[]} The array of {@link AnimationFrameConfig} objects.
*/ */
generateFrameNumbers: function (key, config) generateFrameNumbers: function (key, config)
{ {

View file

@ -26,6 +26,50 @@ var ValueToColor = require('../display/color/ValueToColor');
* @param {Phaser.Game} game - [description] * @param {Phaser.Game} game - [description]
*/ */
/**
* @typedef {object} InputConfig
*
* @property {(boolean|KeyboardInputConfig)} [keyboard=true] - [description]
* @property {(boolean|MouseInputConfig)} [mouse=true] - [description]
* @property {(boolean|TouchInputConfig)} [touch=true] - [description]
* @property {(boolean|GamepadInputConfig)} [gamepad=false] - [description]
* @property {integer} [activePointers=1] - [description]
*/
/**
* @typedef {object} MouseInputConfig
*
* @property {*} [target=null] - [description]
* @property {boolean} [capture=true] - [description]
*/
/**
* @typedef {object} KeyboardInputConfig
*
* @property {*} [target=window] - [description]
*/
/**
* @typedef {object} TouchInputConfig
*
* @property {*} [target=null] - [description]
* @property {boolean} [capture=true] - [description]
*/
/**
* @typedef {object} GamepadInputConfig
*
* @property {*} [target=window] - [description]
*/
/**
* @typedef {object} BannerConfig
*
* @property {boolean} [hidePhaser=false] - [description]
* @property {string} [text='#ffffff'] - [description]
* @property {string[]} [background] - [description]
*/
/** /**
* @typedef {object} FPSConfig * @typedef {object} FPSConfig
* *
@ -36,6 +80,22 @@ var ValueToColor = require('../display/color/ValueToColor');
* @property {integer} [panicMax=120] - [description] * @property {integer} [panicMax=120] - [description]
*/ */
/**
* @typedef {object} RenderConfig
*
* @property {boolean} [antialias=true] - [description]
* @property {boolean} [pixelArt=false] - [description]
* @property {boolean} [autoResize=false] - [description]
* @property {boolean} [roundPixels=false] - [description]
* @property {boolean} [transparent=false] - [description]
* @property {boolean} [clearBeforeRender=true] - [description]
* @property {boolean} [premultipliedAlpha=true] - [description]
* @property {boolean} [preserveDrawingBuffer=false] - [description]
* @property {boolean} [failIfMajorPerformanceCaveat=false] - [description]
* @property {string} [powerPreference='default'] - "high-performance", "low-power" or "default"
* @property {integer} [batchSize=2000] - The default WebGL batch size.
*/
/** /**
* @typedef {object} ScaleConfig * @typedef {object} ScaleConfig
* *
@ -51,6 +111,13 @@ var ValueToColor = require('../display/color/ValueToColor');
* @property {integer} [maxHeight] - The maximum height the canvas can be scaled up to. * @property {integer} [maxHeight] - The maximum height the canvas can be scaled up to.
*/ */
/**
* @typedef {object} CallbacksConfig
*
* @property {BootCallback} [preBoot=NOOP] - [description]
* @property {BootCallback} [postBoot=NOOP] - [description]
*/
/** /**
* @typedef {object} LoaderConfig * @typedef {object} LoaderConfig
* *
@ -72,9 +139,16 @@ var ValueToColor = require('../display/color/ValueToColor');
* @property {boolean} [behindCanvas=false] - Place the DOM Container behind the Phaser Canvas. The default is to place it over the Canvas. * @property {boolean} [behindCanvas=false] - Place the DOM Container behind the Phaser Canvas. The default is to place it over the Canvas.
*/ */
/** /**
* @typedef {object} ImagesConfig
*
* @property {string} [default] - [description]
* @property {string} [missing] - [description]
*/
/**
* @typedef {object} PluginObjectItem * @typedef {object} PluginObjectItem
* *
* @property {string} [key] - [description] * @property {string} [key] - [description]
* @property {*} [plugin] - [description] * @property {*} [plugin] - [description]
* @property {boolean} [start] - [description] * @property {boolean} [start] - [description]
@ -83,9 +157,9 @@ var ValueToColor = require('../display/color/ValueToColor');
* @property {*} [data] - [description] * @property {*} [data] - [description]
*/ */
/** /**
* @typedef {object} PluginObject * @typedef {object} PluginObject
* *
* @property {PluginObjectItem[]} [global=null] - [description] * @property {PluginObjectItem[]} [global=null] - [description]
* @property {PluginObjectItem[]} [scene=null] - [description] * @property {PluginObjectItem[]} [scene=null] - [description]
* @property {Array} [default=[]] - [description] * @property {Array} [default=[]] - [description]
@ -110,42 +184,16 @@ var ValueToColor = require('../display/color/ValueToColor');
* @property {string} [url='http://phaser.io'] - [description] * @property {string} [url='http://phaser.io'] - [description]
* @property {string} [version=''] - [description] * @property {string} [version=''] - [description]
* @property {boolean} [autoFocus=true] - Automatically call window.focus() when the game boots. * @property {boolean} [autoFocus=true] - Automatically call window.focus() when the game boots.
* @property {(boolean|object)} [input] - [description] * @property {(boolean|InputConfig)} [input] - [description]
* @property {boolean} [input.keyboard=true] - [description]
* @property {*} [input.keyboard.target=window] - [description]
* @property {(boolean|object)} [input.mouse=true] - [description]
* @property {*} [input.mouse.target=null] - [description]
* @property {boolean} [input.touch=true] - [description]
* @property {integer} [input.activePointers=1] - [description]
* @property {*} [input.touch.target=null] - [description]
* @property {boolean} [input.touch.capture=true] - [description]
* @property {(boolean|object)} [input.gamepad=false] - [description]
* @property {boolean} [disableContextMenu=false] - [description] * @property {boolean} [disableContextMenu=false] - [description]
* @property {(boolean|object)} [banner=false] - [description] * @property {(boolean|BannerConfig)} [banner=false] - [description]
* @property {boolean} [banner.hidePhaser=false] - [description]
* @property {string} [banner.text='#ffffff'] - [description]
* @property {string[]} [banner.background] - [description]
* @property {DOMContainerConfig} [dom] - The DOM Container configuration object. * @property {DOMContainerConfig} [dom] - The DOM Container configuration object.
* @property {FPSConfig} [fps] - [description] * @property {FPSConfig} [fps] - [description]
* @property {boolean} [render.antialias=true] - [description] * @property {RenderConfig} [render] - [description]
* @property {boolean} [render.pixelArt=false] - [description]
* @property {boolean} [render.autoResize=false] - [description]
* @property {boolean} [render.roundPixels=false] - [description]
* @property {boolean} [render.transparent=false] - [description]
* @property {boolean} [render.clearBeforeRender=true] - [description]
* @property {boolean} [render.premultipliedAlpha=true] - [description]
* @property {boolean} [render.preserveDrawingBuffer=false] - [description]
* @property {boolean} [render.failIfMajorPerformanceCaveat=false] - [description]
* @property {string} [render.powerPreference='default'] - "high-performance", "low-power" or "default"
* @property {integer} [render.batchSize=2000] - The default WebGL batch size.
* @property {(string|number)} [backgroundColor=0x000000] - [description] * @property {(string|number)} [backgroundColor=0x000000] - [description]
* @property {object} [callbacks] - [description] * @property {CallbacksConfig} [callbacks] - [description]
* @property {BootCallback} [callbacks.preBoot=NOOP] - [description]
* @property {BootCallback} [callbacks.postBoot=NOOP] - [description]
* @property {LoaderConfig} [loader] - [description] * @property {LoaderConfig} [loader] - [description]
* @property {object} [images] - [description] * @property {ImagesConfig} [images] - [description]
* @property {string} [images.default] - [description]
* @property {string} [images.missing] - [description]
* @property {object} [physics] - [description] * @property {object} [physics] - [description]
* @property {PluginObject|PluginObjectItem[]} [plugins] - [description] * @property {PluginObject|PluginObjectItem[]} [plugins] - [description]
*/ */
@ -619,7 +667,7 @@ var Config = new Class({
* @const {string} Phaser.Boot.Config#defaultImage - [description] * @const {string} Phaser.Boot.Config#defaultImage - [description]
*/ */
this.defaultImage = GetValue(config, 'images.default', pngPrefix + 'AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg=='); this.defaultImage = GetValue(config, 'images.default', pngPrefix + 'AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg==');
/** /**
* @const {string} Phaser.Boot.Config#missingImage - [description] * @const {string} Phaser.Boot.Config#missingImage - [description]
*/ */

View file

@ -340,9 +340,9 @@ var BitmapText = new Class({
{ {
this._text = value.toString(); this._text = value.toString();
this.updateDisplayOrigin();
this._dirty = true; this._dirty = true;
this.updateDisplayOrigin();
} }
return this; return this;

View file

@ -450,11 +450,11 @@ var KeyboardPlugin = new Class({
* An array of either integers (key codes) or strings, or a mixture of both * An array of either integers (key codes) or strings, or a mixture of both
* An array of objects (such as Key objects) with a public 'keyCode' property * An array of objects (such as Key objects) with a public 'keyCode' property
* *
* For example, to listen for the Konami code (up, up, up, down, down, down, left, left, left, right, right, right) * For example, to listen for the Konami code (up, up, down, down, left, right, left, right, b, a, enter)
* you could pass the following array of key codes: * you could pass the following array of key codes:
* *
* ```javascript * ```javascript
* this.input.keyboard.createCombo([ 38, 38, 38, 40, 40, 40, 37, 37, 37, 39, 39, 39 ], { resetOnMatch: true }); * this.input.keyboard.createCombo([ 38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13 ], { resetOnMatch: true });
* *
* this.input.keyboard.on('keycombomatch', function (event) { * this.input.keyboard.on('keycombomatch', function (event) {
* console.log('Konami Code entered!'); * console.log('Konami Code entered!');

View file

@ -35,11 +35,11 @@ var ResetKeyCombo = require('./ResetKeyCombo');
* An array of either integers (key codes) or strings, or a mixture of both * An array of either integers (key codes) or strings, or a mixture of both
* An array of objects (such as Key objects) with a public 'keyCode' property * An array of objects (such as Key objects) with a public 'keyCode' property
* *
* For example, to listen for the Konami code (up, up, up, down, down, down, left, left, left, right, right, right) * For example, to listen for the Konami code (up, up, down, down, left, right, left, right, b, a, enter)
* you could pass the following array of key codes: * you could pass the following array of key codes:
* *
* ```javascript * ```javascript
* this.input.keyboard.createCombo([ 38, 38, 38, 40, 40, 40, 37, 37, 37, 39, 39, 39 ], { resetOnMatch: true }); * this.input.keyboard.createCombo([ 38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13 ], { resetOnMatch: true });
* *
* this.input.keyboard.on('keycombomatch', function (event) { * this.input.keyboard.on('keycombomatch', function (event) {
* console.log('Konami Code entered!'); * console.log('Konami Code entered!');

View file

@ -7,6 +7,7 @@
var Class = require('../../utils/Class'); var Class = require('../../utils/Class');
var DegToRad = require('../../math/DegToRad'); var DegToRad = require('../../math/DegToRad');
var DistanceBetween = require('../../math/distance/DistanceBetween'); var DistanceBetween = require('../../math/distance/DistanceBetween');
var DistanceSquared = require('../../math/distance/DistanceSquared');
var Factory = require('./Factory'); var Factory = require('./Factory');
var GetFastValue = require('../../utils/object/GetFastValue'); var GetFastValue = require('../../utils/object/GetFastValue');
var Merge = require('../../utils/object/Merge'); var Merge = require('../../utils/object/Merge');
@ -310,7 +311,7 @@ var ArcadePhysics = new Class({
for (var i = bodies.length - 1; i >= 0; i--) for (var i = bodies.length - 1; i >= 0; i--)
{ {
var target = bodies[i]; var target = bodies[i];
var distance = DistanceBetween(x, y, target.x, target.y); var distance = DistanceSquared(x, y, target.x, target.y);
if (distance < min) if (distance < min)
{ {
@ -344,7 +345,7 @@ var ArcadePhysics = new Class({
for (var i = bodies.length - 1; i >= 0; i--) for (var i = bodies.length - 1; i >= 0; i--)
{ {
var target = bodies[i]; var target = bodies[i];
var distance = DistanceBetween(x, y, target.x, target.y); var distance = DistanceSquared(x, y, target.x, target.y);
if (distance > max) if (distance > max)
{ {

View file

@ -1636,11 +1636,9 @@ var WebGLRenderer = new Class({
var color = this.config.backgroundColor; var color = this.config.backgroundColor;
var pipelines = this.pipelines; var pipelines = this.pipelines;
// Bind custom framebuffer here
gl.clearColor(color.redGL, color.greenGL, color.blueGL, color.alphaGL);
if (this.config.clearBeforeRender) if (this.config.clearBeforeRender)
{ {
gl.clearColor(color.redGL, color.greenGL, color.blueGL, color.alphaGL);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT); gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);
} }