mirror of
https://github.com/photonstorm/phaser
synced 2024-11-17 10:18:42 +00:00
Merge branch 'master' of https://github.com/photonstorm/phaser
This commit is contained in:
commit
06688eedd8
11 changed files with 299 additions and 74 deletions
|
@ -7,6 +7,7 @@
|
|||
* The data object being sent to the Dynamic Bitmap Text callback now has a new property `parent`, which is a reference to the Bitmap Text instance that owns the data object (thanks ornyth)
|
||||
* The WebGL Renderer has a new method `clearPipeline`, which will clear down the current pipeline and reset the blend mode, ready for the context to be passed to a 3rd party library.
|
||||
* The WebGL Renderer has a new method `rebindPipeline`, which will rebind the given pipeline instance, reset the blank texture and reset the blend mode. Which is useful for recovering from 3rd party libs that have modified the gl context.
|
||||
* Game Objects have a new property called `state`. Use this to track the state of a Game Object during its lifetime. For example, it could move from a state of 'moving', to 'attacking', to 'dead'. Phaser itself will never set this property, although plugins are allowed to.
|
||||
|
||||
### Updates
|
||||
|
||||
|
@ -22,6 +23,9 @@
|
|||
* MATH_CONST no longer requires or sets the Random Data Generator, this is now done in the Game Config, allowing you to require the math constants without pulling in a whole copy of the RNG with it.
|
||||
* The Dynamic Bitmap Text Canvas Renderer was creating a new data object every frame for the callback. It now uses the `callbackData` object instead, like the WebGL renderer does.
|
||||
* `WebGLRenderer.setBlendMode` has a new optional argument `force`, which will force the given blend mode to be set, regardless of the current settings.
|
||||
* The method `DisplayList.sortGameObjects` has been removed. It has thrown a runtime error since v3.3.0! which no-one even spotted, a good indication of how little the method is used. The display list is automatically sorted anyway, so if you need to sort a small section of it, just use the standard JavaScript Array sort method (thanks ornyth)
|
||||
* The method `DisplayList.getTopGameObject` has been removed. It has thrown a runtime error since v3.3.0! which no-one even spotted, a good indication of how little the method is used (thanks ornyth)
|
||||
* `WebGLRenderer.setFramebuffer` has a new optional boolean argument `updateScissor`, which will reset the scissor to match the framebuffer size, or clear it.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
|
@ -37,6 +41,9 @@
|
|||
* `Array.Matrix.ReverseColumns` was actually reversing the rows, but now reverses the columns.
|
||||
* UnityAtlas now sets the correct file type key if using a config file object.
|
||||
* Starting with version 3.13 in the Canvas Renderer, it was possible for long-running scripts to start to get bogged-down in `fillRect` calls if the game had a background color set. The context is now saved properly to avoid this. Fix #4056 (thanks @Aveyder)
|
||||
* Render Textures created larger than the size of the default canvas would be automatically clipped when drawn to in WebGL. They now reset the gl scissor and drawing height property in order to draw to their full size, regardless of the canvas size. Fix #4139 (thanks @chaoyang805 @iamchristopher)
|
||||
* The `cameraFilter` property of a Game Object will now allow full bitmasks to be set (a value of -1), instead of just those > 0 (thanks @stuartkeith)
|
||||
* When using a Particle Emitter, the array of dead particles (`this.dead`) wasn't being filled correctly. Dead particles are now moved to it as they should be (thanks @Waclaw-I)
|
||||
|
||||
### Examples and TypeScript
|
||||
|
||||
|
@ -48,7 +55,7 @@ Thanks to the following for helping with the Phaser 3 Examples and TypeScript de
|
|||
|
||||
The [Phaser Doc Jam](http://docjam.phaser.io) is an on-going effort to ensure that the Phaser 3 API has 100% documentation coverage. Thanks to the monumental effort of myself and the following people we're now really close to that goal! My thanks to:
|
||||
|
||||
16patsle - @icbat - @samme - @telinc1 - anandu pavanan - blackhawx - candelibas - Diego Romero - Elliott Wallace - eric - Georges Gabereau - Haobo Zhang - henriacle - madclaws - marc136 - Mihail Ilinov - naum303 - NicolasRoehm - rejacobson - Robert Kowalski - rootasjey - scottwestover - stetso - therealsamf - Tigran - willblackmore - zenwaichi
|
||||
16patsle - @icbat - @gurungrahul2 - @samme - @telinc1 - anandu pavanan - blackhawx - candelibas - Diego Romero - Elliott Wallace - eric - Georges Gabereau - Haobo Zhang - henriacle - madclaws - marc136 - Mihail Ilinov - naum303 - NicolasRoehm - rejacobson - Robert Kowalski - rootasjey - scottwestover - stetso - therealsamf - Tigran - willblackmore - zenwaichi
|
||||
|
||||
If you'd like to help finish off the last parts of documentation then take a look at the [Doc Jam site](http://docjam.phaser.io).
|
||||
|
||||
|
|
|
@ -305,7 +305,7 @@ Read our [comprehensive guide](https://phaser.io/phaser3/devlog/127) on creating
|
|||
|
||||
### Building from Source
|
||||
|
||||
If you wish to build Phaser 3 from source, ensure you have the required packages by cloning the repository and then running `npm install`.
|
||||
If you wish to build Phaser 3 from source, ensure you have the required packages by cloning the repository and then running `npm install` on your source directory.
|
||||
|
||||
You can then run `webpack` to create a development build in the `build` folder which includes source maps for local testing. You can also `npm run dist` to create a minified packaged build in the `dist` folder. For a list of all commands available use `npm run help`.
|
||||
|
||||
|
|
|
@ -138,46 +138,8 @@ var DisplayList = new Class({
|
|||
},
|
||||
|
||||
/**
|
||||
* Given an array of Game Objects, sort the array and return it, so that
|
||||
* the objects are in index order with the lowest at the bottom.
|
||||
*
|
||||
* @method Phaser.GameObjects.DisplayList#sortGameObjects
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {Phaser.GameObjects.GameObject[]} gameObjects - The array of Game Objects to sort.
|
||||
*
|
||||
* @return {array} The sorted array of Game Objects.
|
||||
*/
|
||||
sortGameObjects: function (gameObjects)
|
||||
{
|
||||
if (gameObjects === undefined) { gameObjects = this.list; }
|
||||
|
||||
this.scene.sys.depthSort();
|
||||
|
||||
return gameObjects.sort(this.sortIndexHandler.bind(this));
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the top-most Game Object in the given array of Game Objects, after sorting it.
|
||||
*
|
||||
* Note that the given array is sorted in place, even though it isn't returned directly it will still be updated.
|
||||
*
|
||||
* @method Phaser.GameObjects.DisplayList#getTopGameObject
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {Phaser.GameObjects.GameObject[]} gameObjects - The array of Game Objects.
|
||||
*
|
||||
* @return {Phaser.GameObjects.GameObject} The top-most Game Object in the array of Game Objects.
|
||||
*/
|
||||
getTopGameObject: function (gameObjects)
|
||||
{
|
||||
this.sortGameObjects(gameObjects);
|
||||
|
||||
return gameObjects[gameObjects.length - 1];
|
||||
},
|
||||
|
||||
/**
|
||||
* All members of the group.
|
||||
* Returns an array which contains all objects currently on the Display List.
|
||||
* This is a reference to the main list array, not a copy of it, so be careful not to modify it.
|
||||
*
|
||||
* @method Phaser.GameObjects.DisplayList#getChildren
|
||||
* @since 3.12.0
|
||||
|
|
|
@ -55,6 +55,22 @@ var GameObject = new Class({
|
|||
*/
|
||||
this.type = type;
|
||||
|
||||
/**
|
||||
* The current state of this Game Object.
|
||||
*
|
||||
* Phaser itself will never modify this value, although plugins may do so.
|
||||
*
|
||||
* Use this property to track the state of a Game Object during its lifetime. For example, it could move from
|
||||
* a state of 'moving', to 'attacking', to 'dead'. The state value should typically be an integer (ideally mapped to a constant
|
||||
* in your game code), but could also be a string, or any other data-type. It is recommended to keep it light and simple.
|
||||
* If you need to store complex data about your Game Object, look at using the Data Component instead.
|
||||
*
|
||||
* @name Phaser.GameObjects.GameObject#state
|
||||
* @type {{integer|string}}
|
||||
* @since 3.16.0
|
||||
*/
|
||||
this.state = 0;
|
||||
|
||||
/**
|
||||
* The parent Container of this Game Object, if it has one.
|
||||
*
|
||||
|
@ -454,7 +470,7 @@ var GameObject = new Class({
|
|||
*/
|
||||
willRender: function (camera)
|
||||
{
|
||||
return !(GameObject.RENDER_MASK !== this.renderFlags || (this.cameraFilter > 0 && (this.cameraFilter & camera.id)));
|
||||
return !(GameObject.RENDER_MASK !== this.renderFlags || (this.cameraFilter !== 0 && (this.cameraFilter & camera.id)));
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -515,6 +531,7 @@ var GameObject = new Class({
|
|||
* Game Object Pool instead of destroying it, as destroyed objects cannot be resurrected.
|
||||
*
|
||||
* @method Phaser.GameObjects.GameObject#destroy
|
||||
* @fires Phaser.GameObjects.GameObject#destroyEvent
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {boolean} [fromScene=false] - Is this Game Object being destroyed as the result of a Scene shutdown?
|
||||
|
@ -591,3 +608,8 @@ var GameObject = new Class({
|
|||
GameObject.RENDER_MASK = 15;
|
||||
|
||||
module.exports = GameObject;
|
||||
|
||||
/**
|
||||
* The Game Object will be destroyed.
|
||||
* @event Phaser.GameObjects.GameObject#destroyEvent
|
||||
*/
|
||||
|
|
|
@ -25,7 +25,7 @@ var DOMElementCSSRenderer = function (renderer, src, interpolationPercentage, ca
|
|||
{
|
||||
var node = src.node;
|
||||
|
||||
if (!node || GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera.id)))
|
||||
if (!node || GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter !== 0 && (src.cameraFilter & camera.id)))
|
||||
{
|
||||
if (node)
|
||||
{
|
||||
|
|
|
@ -2111,7 +2111,7 @@ var ParticleEmitter = new Class({
|
|||
}
|
||||
}
|
||||
|
||||
this.dead.concat(rip);
|
||||
this.dead = this.dead.concat(rip);
|
||||
|
||||
StableSort.inplace(particles, this.indexSortCallback);
|
||||
}
|
||||
|
|
|
@ -123,8 +123,7 @@ var RenderTexture = new Class({
|
|||
this.globalAlpha = 1;
|
||||
|
||||
/**
|
||||
* The HTML Canvas Element that the Render Texture is drawing to.
|
||||
* This is only populated if Phaser is running with the Canvas Renderer.
|
||||
* The HTML Canvas Element that the Render Texture is drawing to when using the Canvas Renderer.
|
||||
*
|
||||
* @name Phaser.GameObjects.RenderTexture#canvas
|
||||
* @type {HTMLCanvasElement}
|
||||
|
@ -416,7 +415,7 @@ var RenderTexture = new Class({
|
|||
|
||||
if (this.gl)
|
||||
{
|
||||
this.renderer.setFramebuffer(this.framebuffer);
|
||||
this.renderer.setFramebuffer(this.framebuffer, true);
|
||||
|
||||
var gl = this.gl;
|
||||
|
||||
|
@ -424,7 +423,7 @@ var RenderTexture = new Class({
|
|||
|
||||
gl.clear(gl.COLOR_BUFFER_BIT);
|
||||
|
||||
this.renderer.setFramebuffer(null);
|
||||
this.renderer.setFramebuffer(null, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -449,7 +448,7 @@ var RenderTexture = new Class({
|
|||
{
|
||||
if (this.gl)
|
||||
{
|
||||
this.renderer.setFramebuffer(this.framebuffer);
|
||||
this.renderer.setFramebuffer(this.framebuffer, true);
|
||||
|
||||
var gl = this.gl;
|
||||
|
||||
|
@ -457,7 +456,7 @@ var RenderTexture = new Class({
|
|||
|
||||
gl.clear(gl.COLOR_BUFFER_BIT);
|
||||
|
||||
this.renderer.setFramebuffer(null);
|
||||
this.renderer.setFramebuffer(null, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -615,7 +614,7 @@ var RenderTexture = new Class({
|
|||
|
||||
if (gl)
|
||||
{
|
||||
this.renderer.setFramebuffer(this.framebuffer);
|
||||
this.renderer.setFramebuffer(this.framebuffer, true);
|
||||
|
||||
var pipeline = this.pipeline;
|
||||
|
||||
|
@ -625,7 +624,7 @@ var RenderTexture = new Class({
|
|||
|
||||
pipeline.flush();
|
||||
|
||||
this.renderer.setFramebuffer(null);
|
||||
this.renderer.setFramebuffer(null, true);
|
||||
|
||||
pipeline.projOrtho(0, pipeline.width, pipeline.height, 0, -1000.0, 1000.0);
|
||||
}
|
||||
|
@ -697,7 +696,7 @@ var RenderTexture = new Class({
|
|||
|
||||
if (gl)
|
||||
{
|
||||
this.renderer.setFramebuffer(this.framebuffer);
|
||||
this.renderer.setFramebuffer(this.framebuffer, true);
|
||||
|
||||
var pipeline = this.pipeline;
|
||||
|
||||
|
@ -707,7 +706,7 @@ var RenderTexture = new Class({
|
|||
|
||||
pipeline.flush();
|
||||
|
||||
this.renderer.setFramebuffer(null);
|
||||
this.renderer.setFramebuffer(null, true);
|
||||
|
||||
pipeline.projOrtho(0, pipeline.width, pipeline.height, 0, -1000.0, 1000.0);
|
||||
}
|
||||
|
|
|
@ -748,6 +748,9 @@ var InputPlugin = new Class({
|
|||
*
|
||||
* @method Phaser.Input.InputPlugin#processDownEvents
|
||||
* @private
|
||||
* @fires Phaser.GameObjects.GameObject#pointerdownEvent
|
||||
* @fires Phaser.Input.InputPlugin#gameobjectdownEvent
|
||||
* @fires Phaser.Input.InputPlugin#pointerdownEvent
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {Phaser.Input.Pointer} pointer - The Pointer being tested.
|
||||
|
@ -809,6 +812,20 @@ var InputPlugin = new Class({
|
|||
*
|
||||
* @method Phaser.Input.InputPlugin#processDragEvents
|
||||
* @private
|
||||
* @fires Phaser.GameObjects.GameObject#dragendEvent
|
||||
* @fires Phaser.GameObjects.GameObject#dragenterEvent
|
||||
* @fires Phaser.GameObjects.GameObject#dragEvent
|
||||
* @fires Phaser.GameObjects.GameObject#dragleaveEvent
|
||||
* @fires Phaser.GameObjects.GameObject#dragoverEvent
|
||||
* @fires Phaser.GameObjects.GameObject#dragstartEvent
|
||||
* @fires Phaser.GameObjects.GameObject#dropEvent
|
||||
* @fires Phaser.Input.InputPlugin#dragendEvent
|
||||
* @fires Phaser.Input.InputPlugin#dragenterEvent
|
||||
* @fires Phaser.Input.InputPlugin#dragEvent
|
||||
* @fires Phaser.Input.InputPlugin#dragleaveEvent
|
||||
* @fires Phaser.Input.InputPlugin#dragoverEvent
|
||||
* @fires Phaser.Input.InputPlugin#dragstartEvent
|
||||
* @fires Phaser.Input.InputPlugin#dropEvent
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {Phaser.Input.Pointer} pointer - The Pointer to check against the Game Objects.
|
||||
|
@ -1077,6 +1094,8 @@ var InputPlugin = new Class({
|
|||
*
|
||||
* @method Phaser.Input.InputPlugin#processMoveEvents
|
||||
* @private
|
||||
* @fires Phaser.GameObjects.GameObject#pointermoveEvent
|
||||
* @fires Phaser.Input.InputPlugin#gameobjectmoveEvent
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {Phaser.Input.Pointer} pointer - The pointer to check for events against.
|
||||
|
@ -1142,6 +1161,10 @@ var InputPlugin = new Class({
|
|||
*
|
||||
* @method Phaser.Input.InputPlugin#processOverOutEvents
|
||||
* @private
|
||||
* @fires Phaser.GameObjects.GameObject#pointeroutEvent
|
||||
* @fires Phaser.GameObjects.GameObject#pointeroverEvent
|
||||
* @fires Phaser.Input.InputPlugin#gameobjectoutEvent
|
||||
* @fires Phaser.Input.InputPlugin#gameobjectoverEvent
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {Phaser.Input.Pointer} pointer - The pointer to check for events against.
|
||||
|
@ -1312,6 +1335,8 @@ var InputPlugin = new Class({
|
|||
*
|
||||
* @method Phaser.Input.InputPlugin#processUpEvents
|
||||
* @private
|
||||
* @fires Phaser.GameObjects.GameObject#pointerupEvent
|
||||
* @fires Phaser.Input.InputPlugin#gameobjectupEvent
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {Phaser.Input.Pointer} pointer - The pointer to check for events against.
|
||||
|
@ -2493,3 +2518,161 @@ var InputPlugin = new Class({
|
|||
PluginCache.register('InputPlugin', InputPlugin, 'input');
|
||||
|
||||
module.exports = InputPlugin;
|
||||
|
||||
/**
|
||||
* A Pointer stopped dragging the Game Object.
|
||||
* @event Phaser.GameObjects.GameObject#dragendEvent
|
||||
* @param {Phaser.Input.Pointer} pointer - The Pointer that was dragging this Game Object.
|
||||
* @param {number} dragX - The x coordinate where the Pointer is dragging the object, in world space.
|
||||
* @param {number} dragY - The y coordinate where the Pointer is dragging the object, in world space.
|
||||
* @param {boolean} dropped - True if the object was dropped within its drop target. (In that case, 'drop' was emitted before this.)
|
||||
*
|
||||
* The Game Object entered its drop target, while being dragged.
|
||||
* @event Phaser.GameObjects.GameObject#dragenterEvent
|
||||
* @param {Phaser.Input.Pointer} pointer - The pointer dragging this Game Object.
|
||||
* @param {Phaser.GameObjects.GameObject} target - The Game Object's drop target.
|
||||
*
|
||||
* The Game Object is being dragged by a Pointer.
|
||||
* @event Phaser.GameObjects.GameObject#dragEvent
|
||||
* @param {Phaser.Input.Pointer} pointer - The Pointer dragging this Game Object.
|
||||
* @param {number} dragX - The x coordinate where the Pointer is dragging the object, in world space.
|
||||
* @param {number} dragY - The y coordinate where the Pointer is dragging the object, in world space.
|
||||
*
|
||||
* The Game Object left its drop target, while being dragged.
|
||||
* @event Phaser.GameObjects.GameObject#dragleaveEvent
|
||||
* @param {Phaser.Input.Pointer} pointer - The Pointer dragging this Game Object.
|
||||
* @param {Phaser.GameObjects.GameObject} target - The Game Object's drop target.
|
||||
*
|
||||
* The Game Object is within its drop target, while being dragged.
|
||||
* @event Phaser.GameObjects.GameObject#dragoverEvent
|
||||
* @param {Phaser.Input.Pointer} pointer - The Pointer dragging this Game Object.
|
||||
* @param {Phaser.GameObjects.GameObject} target - The Game Object's drop target.
|
||||
*
|
||||
* A Pointer began dragging the Game Object.
|
||||
* @event Phaser.GameObjects.GameObject#dragstartEvent
|
||||
* @param {Phaser.Input.Pointer} pointer - The Pointer dragging this Game Object.
|
||||
* @param {number} dragX - The x coordinate where the Pointer is dragging the object, in world space.
|
||||
* @param {number} dragY - The y coordinate where the Pointer is dragging the object, in world space.
|
||||
*
|
||||
* The Game Object was released on its drop target, after being dragged.
|
||||
* @event Phaser.GameObjects.GameObject#dropEvent
|
||||
* @param {Phaser.Input.Pointer} pointer - The Pointer dragging this Game Object.
|
||||
* @param {Phaser.GameObjects.GameObject} target - The Game Object's drop target.
|
||||
*
|
||||
* A Pointer was pressed on the Game Object.
|
||||
* @event Phaser.GameObjects.GameObject#pointerdownEvent
|
||||
* @param {Phaser.Input.Pointer}
|
||||
* @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position.
|
||||
* @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position.
|
||||
* @param {object} eventContainer
|
||||
*
|
||||
* A Pointer moved while over the Game Object.
|
||||
* @event Phaser.GameObjects.GameObject#pointermoveEvent
|
||||
* @param {Phaser.Input.Pointer}
|
||||
* @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position.
|
||||
* @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position.
|
||||
* @param {object} eventContainer
|
||||
*
|
||||
* A Pointer left the Game Object, after being over it.
|
||||
* @event Phaser.GameObjects.GameObject#pointeroutEvent
|
||||
* @param {Phaser.Input.Pointer} - The Pointer.
|
||||
* @param {object} eventContainer
|
||||
*
|
||||
* A Pointer entered the Game Object, after being outside it.
|
||||
* @event Phaser.GameObjects.GameObject#pointeroverEvent
|
||||
* @param {Phaser.Input.Pointer} - The Pointer.
|
||||
* @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position.
|
||||
* @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position.
|
||||
* @param {object} eventContainer
|
||||
*
|
||||
* A Pointer was released while over the Game Object, after being pressed on the Game Object.
|
||||
* @event Phaser.GameObjects.GameObject#pointerupEvent
|
||||
* @param {Phaser.Input.Pointer} - The Pointer.
|
||||
* @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position.
|
||||
* @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position.
|
||||
* @param {object} eventContainer
|
||||
*/
|
||||
|
||||
/**
|
||||
* A Game Object was released, after being dragged.
|
||||
* @event Phaser.Input.InputPlugin#dragendEvent
|
||||
* @param {Phaser.Input.Pointer} pointer - The Pointer.
|
||||
* @param {Phaser.GameObjects.GameObject} gameObject - The Game Object.
|
||||
* @param {boolean} dropped - True if the Game Object was dropped onto its drop target.
|
||||
*
|
||||
* A dragged Game Object entered it drop target.
|
||||
* @event Phaser.Input.InputPlugin#dragenterEvent
|
||||
* @param {Phaser.Input.Pointer} pointer - The Pointer.
|
||||
* @param {Phaser.GameObjects.GameObject} gameObject - The Game Object.
|
||||
* @param {Phaser.GameObjects.GameObject} target - The drop target.
|
||||
*
|
||||
* A Game Object is being dragged by a Pointer.
|
||||
* @event Phaser.Input.InputPlugin#dragEvent
|
||||
* @param {Phaser.Input.Pointer} pointer - The Pointer.
|
||||
* @param {Phaser.GameObjects.GameObject} gameObject - The Game Object.
|
||||
* @param {number} dragX - The x coordinate where the Pointer is dragging the object, in world space.
|
||||
* @param {number} dragY - The y coordinate where the Pointer is dragging the object, in world space.
|
||||
*
|
||||
* A dragged Game Object left its drop target.
|
||||
* @event Phaser.Input.InputPlugin#dragleaveEvent
|
||||
* @param {Phaser.Input.Pointer} pointer - The Pointer.
|
||||
* @param {Phaser.GameObjects.GameObject} gameObject - The Game Object.
|
||||
* @param {?Phaser.GameObjects.GameObject} target - The drop target.
|
||||
*
|
||||
* A dragged Game Object is within its drop target.
|
||||
* @event Phaser.Input.InputPlugin#dragoverEvent
|
||||
* @param {Phaser.Input.Pointer} pointer - The Pointer.
|
||||
* @param {Phaser.GameObjects.GameObject} gameObject - The Game Object.
|
||||
* @param {?Phaser.GameObjects.GameObject} target - The drop target.
|
||||
*
|
||||
* A Pointer started dragging a Game Object.
|
||||
* @event Phaser.Input.InputPlugin#dragstartEvent
|
||||
* @param {Phaser.Input.Pointer} pointer - The Pointer.
|
||||
* @param {Phaser.GameObjects.GameObject} gameObject - The Game Object.
|
||||
*
|
||||
* A Game Object was dropped within its drop target.
|
||||
* @event Phaser.Input.InputPlugin#dropEvent
|
||||
* @param {Phaser.Input.Pointer} pointer - The Pointer.
|
||||
* @param {Phaser.GameObjects.GameObject} gameObject - The Game Object.
|
||||
* @param {?Phaser.GameObjects.GameObject} target - The drop target.
|
||||
*
|
||||
* A Pointer was pressed while over a Game Object.
|
||||
* @event Phaser.Input.InputPlugin#gameobjectdownEvent
|
||||
* @param {Phaser.Input.Pointer} pointer - The Pointer.
|
||||
* @param {Phaser.GameObjects.GameObject} gameObject - The Game Object.
|
||||
* @param {object} eventContainer
|
||||
*
|
||||
* A Pointer moved while over a Game Object.
|
||||
* @event Phaser.Input.InputPlugin#gameobjectmoveEvent
|
||||
* @param {Phaser.Input.Pointer} pointer - The Pointer.
|
||||
* @param {Phaser.GameObjects.GameObject} gameObject - The Game Object.
|
||||
* @param {object} eventContainer
|
||||
*
|
||||
* A Pointer moved off of a Game Object, after being over it.
|
||||
* @event Phaser.Input.InputPlugin#gameobjectoutEvent
|
||||
* @param {Phaser.Input.Pointer} pointer - The Pointer.
|
||||
* @param {Phaser.GameObjects.GameObject} gameObject - The Game Object.
|
||||
* @param {object} eventContainer
|
||||
*
|
||||
* A Pointer moved onto a Game Object, after being off it.
|
||||
* @event Phaser.Input.InputPlugin#gameobjectoverEvent
|
||||
* @param {Phaser.Input.Pointer} pointer - The Pointer.
|
||||
* @param {Phaser.GameObjects.GameObject} gameObject - The Game Object.
|
||||
* @param {object} eventContainer
|
||||
*
|
||||
* A Pointer was released while over a Game Object, after being pressed on the Game Object.
|
||||
* @event Phaser.Input.InputPlugin#gameobjectupEvent
|
||||
* @param {Phaser.Input.Pointer} pointer - The Pointer.
|
||||
* @param {Phaser.GameObjects.GameObject} gameObject - The Game Object.
|
||||
* @param {object} eventContainer
|
||||
*
|
||||
* A Pointer was pressed down.
|
||||
* @event Phaser.Input.InputPlugin#pointerdownEvent
|
||||
* @param {Phaser.Input.Pointer} pointer - The Pointer.
|
||||
* @param {Phaser.GameObjects.GameObject[]} currentlyOver - All the Game Objects currently under the Pointer.
|
||||
*
|
||||
* A Pointer was released, after being pressed down.
|
||||
* @event Phaser.Input.InputPlugin#pointerupEvent
|
||||
* @param {Phaser.Input.Pointer} pointer - The Pointer.
|
||||
* @param {Phaser.GameObjects.GameObject[]} currentlyOver - All the Game Objects currently under the Pointer.
|
||||
*/
|
||||
|
|
|
@ -401,7 +401,7 @@ var Body = new Class({
|
|||
* @type {boolean}
|
||||
* @default false
|
||||
* @since 3.0.0
|
||||
* @see Phaser.Physics.Arcade.World#event:worldbounds
|
||||
* @see Phaser.Physics.Arcade.World#worldboundsEvent
|
||||
*/
|
||||
this.onWorldBounds = false;
|
||||
|
||||
|
@ -412,7 +412,7 @@ var Body = new Class({
|
|||
* @type {boolean}
|
||||
* @default false
|
||||
* @since 3.0.0
|
||||
* @see Phaser.Physics.Arcade.World#event:collide
|
||||
* @see Phaser.Physics.Arcade.World#collideEvent
|
||||
*/
|
||||
this.onCollide = false;
|
||||
|
||||
|
@ -423,7 +423,7 @@ var Body = new Class({
|
|||
* @type {boolean}
|
||||
* @default false
|
||||
* @since 3.0.0
|
||||
* @see Phaser.Physics.Arcade.World#event:overlap
|
||||
* @see Phaser.Physics.Arcade.World#overlapEvent
|
||||
*/
|
||||
this.onOverlap = false;
|
||||
|
||||
|
|
|
@ -32,36 +32,47 @@ var Vector2 = require('../../math/Vector2');
|
|||
var Wrap = require('../../math/Wrap');
|
||||
|
||||
/**
|
||||
* @event Phaser.Physics.Arcade.World#pause
|
||||
* The physics simulation paused.
|
||||
* @event Phaser.Physics.Arcade.World#pauseEvent
|
||||
*/
|
||||
|
||||
/**
|
||||
* @event Phaser.Physics.Arcade.World#resume
|
||||
* The physics simulation resumed (from a paused state).
|
||||
* @event Phaser.Physics.Arcade.World#resumeEvent
|
||||
*/
|
||||
|
||||
/**
|
||||
* @event Phaser.Physics.Arcade.World#collide
|
||||
* Two Game Objects collided.
|
||||
* This event is emitted only if at least one body has `onCollide` enabled.
|
||||
* @event Phaser.Physics.Arcade.World#collideEvent
|
||||
* @param {Phaser.GameObjects.GameObject} gameObject1
|
||||
* @param {Phaser.GameObjects.GameObject} gameObject2
|
||||
* @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body1
|
||||
* @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body2
|
||||
* @see Phaser.Physics.Arcade.Body#onCollide
|
||||
*/
|
||||
|
||||
/**
|
||||
* @event Phaser.Physics.Arcade.World#overlap
|
||||
* Two Game Objects overlapped.
|
||||
* This event is emitted only if at least one body has `onOverlap` enabled.
|
||||
* @event Phaser.Physics.Arcade.World#overlapEvent
|
||||
* @param {Phaser.GameObjects.GameObject} gameObject1
|
||||
* @param {Phaser.GameObjects.GameObject} gameObject2
|
||||
* @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body1
|
||||
* @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body2
|
||||
* @see Phaser.Physics.Arcade.Body#onOverlap
|
||||
*/
|
||||
|
||||
/**
|
||||
* @event Phaser.Physics.Arcade.World#worldbounds
|
||||
* A Body contacted the world boundary.
|
||||
* This event is emitted only if the body has `onWorldBounds` enabled.
|
||||
* @event Phaser.Physics.Arcade.World#worldboundsEvent
|
||||
* @param {Phaser.Physics.Arcade.Body} body
|
||||
* @param {boolean} up
|
||||
* @param {boolean} down
|
||||
* @param {boolean} left
|
||||
* @param {boolean} right
|
||||
* @see Phaser.Physics.Arcade.Body#onWorldBounds
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -853,7 +864,7 @@ var World = new Class({
|
|||
* checks.
|
||||
*
|
||||
* @method Phaser.Physics.Arcade.World#pause
|
||||
* @fires Phaser.Physics.Arcade.World#pause
|
||||
* @fires Phaser.Physics.Arcade.World#pauseEvent
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Physics.Arcade.World} This World object.
|
||||
|
@ -871,7 +882,7 @@ var World = new Class({
|
|||
* Resumes the simulation, if paused.
|
||||
*
|
||||
* @method Phaser.Physics.Arcade.World#resume
|
||||
* @fires Phaser.Physics.Arcade.World#resume
|
||||
* @fires Phaser.Physics.Arcade.World#resumeEvent
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Physics.Arcade.World} This World object.
|
||||
|
@ -1361,8 +1372,8 @@ var World = new Class({
|
|||
* Separates two Bodies.
|
||||
*
|
||||
* @method Phaser.Physics.Arcade.World#separate
|
||||
* @fires Phaser.Physics.Arcade.World#collide
|
||||
* @fires Phaser.Physics.Arcade.World#overlap
|
||||
* @fires Phaser.Physics.Arcade.World#collideEvent
|
||||
* @fires Phaser.Physics.Arcade.World#overlapEvent
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {Phaser.Physics.Arcade.Body} body1 - The first Body to be separated.
|
||||
|
@ -1476,8 +1487,8 @@ var World = new Class({
|
|||
* Separates two Bodies, when both are circular.
|
||||
*
|
||||
* @method Phaser.Physics.Arcade.World#separateCircle
|
||||
* @fires Phaser.Physics.Arcade.World#collide
|
||||
* @fires Phaser.Physics.Arcade.World#overlap
|
||||
* @fires Phaser.Physics.Arcade.World#collideEvent
|
||||
* @fires Phaser.Physics.Arcade.World#overlapEvent
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {Phaser.Physics.Arcade.Body} body1 - The first Body to be separated.
|
||||
|
@ -2132,8 +2143,10 @@ var World = new Class({
|
|||
* Please use Phaser.Physics.Arcade.World#collide instead.
|
||||
*
|
||||
* @method Phaser.Physics.Arcade.World#collideSpriteVsTilemapLayer
|
||||
* @fires Phaser.Physics.Arcade.World#collide
|
||||
* @fires Phaser.Physics.Arcade.World#overlap
|
||||
* @fires Phaser.GameObjects.GameObject#collideEvent
|
||||
* @fires Phaser.GameObjects.GameObject#overlapEvent
|
||||
* @fires Phaser.Physics.Arcade.World#collideEvent
|
||||
* @fires Phaser.Physics.Arcade.World#overlapEvent
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision.
|
||||
|
@ -2363,3 +2376,23 @@ var World = new Class({
|
|||
});
|
||||
|
||||
module.exports = World;
|
||||
|
||||
/**
|
||||
* A physics-enabled Game Object collided with a Tile.
|
||||
* This event is emitted only if the Game Object's body has `onCollide` enabled.
|
||||
* @event Phaser.GameObjects.GameObject#collideEvent
|
||||
* @param {Phaser.GameObjects.GameObject} gameObject
|
||||
* @param {Phaser.Tilemaps.Tile} tile
|
||||
* @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body
|
||||
* @see Phaser.Physics.Arcade.Body#onCollide
|
||||
*/
|
||||
|
||||
/**
|
||||
* A physics-enabled Game Object overlapped with a Tile.
|
||||
* This event is emitted only if the Game Object's body has `onOverlap` enabled.
|
||||
* @event Phaser.GameObjects.GameObject#overlapEvent
|
||||
* @param {Phaser.GameObjects.GameObject} gameObject
|
||||
* @param {Phaser.Tilemaps.Tile} tile
|
||||
* @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body
|
||||
* @see Phaser.Physics.Arcade.Body#onOverlap
|
||||
*/
|
||||
|
|
|
@ -1163,11 +1163,14 @@ var WebGLRenderer = new Class({
|
|||
* @since 3.0.0
|
||||
*
|
||||
* @param {WebGLFramebuffer} framebuffer - The framebuffer that needs to be bound.
|
||||
* @param {boolean} [updateScissor=false] - If a framebuffer is given, set the gl scissor to match the frame buffer size? Or, if `null` given, pop the scissor from the stack.
|
||||
*
|
||||
* @return {this} This WebGLRenderer instance.
|
||||
*/
|
||||
setFramebuffer: function (framebuffer)
|
||||
setFramebuffer: function (framebuffer, updateScissor)
|
||||
{
|
||||
if (updateScissor === undefined) { updateScissor = false; }
|
||||
|
||||
var gl = this.gl;
|
||||
|
||||
var width = this.width;
|
||||
|
@ -1189,6 +1192,22 @@ var WebGLRenderer = new Class({
|
|||
|
||||
gl.viewport(0, 0, width, height);
|
||||
|
||||
if (updateScissor)
|
||||
{
|
||||
if (framebuffer)
|
||||
{
|
||||
this.drawingBufferHeight = height;
|
||||
|
||||
this.pushScissor(0, 0, width, height);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.drawingBufferHeight = this.height;
|
||||
|
||||
this.popScissor();
|
||||
}
|
||||
}
|
||||
|
||||
this.currentFramebuffer = framebuffer;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue