mirror of
https://github.com/photonstorm/phaser
synced 2024-12-24 12:03:36 +00:00
Merge branch 'master' of https://github.com/photonstorm/phaser
This commit is contained in:
commit
858c858106
117 changed files with 1264 additions and 941 deletions
72
CHANGELOG.md
72
CHANGELOG.md
|
@ -2,15 +2,57 @@
|
||||||
|
|
||||||
## Version 3.11.0 - Leafa - in development
|
## Version 3.11.0 - Leafa - in development
|
||||||
|
|
||||||
|
### Camera - New Features, Updates and Fixes
|
||||||
|
|
||||||
|
* All of the 2D Camera classes are now 100% covered by JSDocs!
|
||||||
|
* `Camera.alpha` (and its related method `Camera.setAlpha`) allows you to set an alpha level for the entire camera. This impacts everything it is rendering, even if those objects also have their own alpha values too. You can tween the property to make the camera contents fade in / out, or otherwise set it as needed in your game.
|
||||||
|
* `Camera.deadzone` (and its related method `Camera.setDeadzone`) allows you to specify the deadzone for a camera. The deadzone is a rectangular region used when a camera is following a target. If the target is within the deadzone then the camera will not scroll. As soon as the target leaves the deadzone, the camera will begin tracking it (applying lerp if needed.) It allows you to set a region of the camera in which a player can move freely before tracking begins. The deadzone is re-centered on the camera mid point every frame, meaning you can also use the rectangle for other in-game checks as needed.
|
||||||
|
* `Camera.pan` is a new Camera Effect that allows you to control automatic camera pans between points in your game world. You can specify a duration and ease type for the pan, and it'll emit events just like all other camera effects, so you can hook into the start, update and completion of the pan. See the examples and docs for more details.
|
||||||
|
* `Camera.zoom` is a new Camera Effect that allows you to control automatic camera zooming. You can specify a duration and ease type for the zoom, as well as the zoom factor of course, and it'll emit events just like all other camera effects, so you can hook into the start, update and completion of the zoom. Used in combination with the new Pan effect you can zoom and pan around with ease. See the examples and docs for more details.
|
||||||
|
* `Camera.midPoint` is a new Vec2 property that is updated every frame. Use it to obtain exactly where in the world the center of the camera is currently looking.
|
||||||
|
* `Camera.displayWidth` is a new property that returns the display width of the camera, factoring in the current zoom level.
|
||||||
|
* `Camera.displayHeight` is a new property that returns the display height of the camera, factoring in the current zoom level.
|
||||||
|
* `Camera.centerOn` is a new method that will move the camera so its viewport is centered on the given coordinates. A handy way of jumping to different points around a map without needing to calculate the scroll offsets.
|
||||||
|
* The Camera bounds didn't factor in the camera zoom properly, meaning you would often not be able to reach the corners of a camera bound world at a zoom level other than 1. The bounds are now calculated each frame to ensure they match the zoom level and it will no longer allow you to scroll off the edge of the bounds. Fix #3547 (thanks @nkholski)
|
||||||
|
* `Camera.centerToBounds` didn't take the bounds offset into account, so bounds at non-zero positions wouldn't center properly. All bounds now center correctly. Fix #3706 (thanks @cyantree)
|
||||||
|
* `Camera.setBounds` has a new optional argument `centerOn`. If specified it will automatically center the camera on the new bounds given.
|
||||||
|
* The Camera will no longer stutter when following Game Objects at high zoom levels.
|
||||||
|
* `Camera._id` has been renamed to `Camera.id`, a read-only bitmask used for camera exclusion from Game Objects.
|
||||||
|
* The Camera Manager `cameraPool` has been removed entirely. It was mostly pointless in practice as Cameras are not regenerated frequently enough to need pooling. It also didn't maintain the bitmask list correctly before.
|
||||||
|
* `CameraManager.resetAll` now destroys all current Cameras, resets the camera ID marker to 1 and adds a single new Camera.
|
||||||
|
* `CameraManager.currentCameraId` has been removed. IDs are assigned more intelligently now, via the `getNextID` internal method.
|
||||||
|
* `CameraManager.addExisting` no longer needs to be passed a Camera that already exists in the pool (as the pool has been removed), meaning you can now create your own Cameras and pass them to `addExisting` and have them treated as normal cameras and not be ignored by the manager. They are also assigned a proper ID when added.
|
||||||
|
* `CameraManager.addExisting` has a new boolean argument `makeMain` which will make the new camera the main one.
|
||||||
|
* `CameraManager.getTotal` is a new method that will return the total number of Cameras being managed, with an optional `isVisible` argument, that only counts visible cameras if set.
|
||||||
|
* `CameraManager.remove` can now take an array of cameras to be removed from the manager, as well as a single camera.
|
||||||
|
* `CameraManager.remove` would previously not allow you to remove a camera if it meant there would be no cameras left in the Camera Manager. This restriction has been removed. A Camera Manager can now run even with zero cameras. Your game obviously won't display anything, but it's still now possible.
|
||||||
|
* `CameraManager.remove` will now return the total number of Cameras removed.
|
||||||
|
|
||||||
|
### Round Pixels Changes
|
||||||
|
|
||||||
|
Before explaining the changes it's worth covering what the three different game config properties do:
|
||||||
|
|
||||||
|
`roundPixels` - this will cause the renderer to draw most Game Objects at whole integer positions. Their actual positions can be anything, but the renderer will floor the values to ensure they are integers immediately before drawing. It only works on texture based Game Objects. Graphics objects, for instance, ignore this property.
|
||||||
|
|
||||||
|
`antialias` - when set to `true` WebGL textures are created using `gl.LINEAR`, which allows WebGL to try its best to interpolate the texture when rendered at non-texture frame sizes. This can happen if you scale a Game Object, or zoom a Camera. In both cases it will need to interpolate the pixel values to accommodate the new size. If this property is set to `false` then it will use `gl.NEAREST` instead. This uses a nearest neighbor method of interpolation, and is nearly always the better option if you need to keep the textures crisp, such as when using scaled pixel art. Disabling `antialias` invokes nearest-neighbor interpolation on the game canvas itself as well. If you need a mixture of aliased and anti-aliased textures in your game, then you can change them on a per-texture basis by using `Texture.setFilter`.
|
||||||
|
|
||||||
|
There is a third game config property called `pixelArt`. If set to `true` it's the same thing as enabling `roundPixels` and disabling `antialias`. This is the optimum setting for pixel art games.
|
||||||
|
|
||||||
|
* Both renderers will now check for `pixelArt` OR `antialias` before setting the canvas scale mode. Both values are checked during texture creation as well.
|
||||||
|
* If in your game config you have enabled either pixel art mode or roundPixels, then all Cameras will have their `roundPixels` values set to `true` by default. You can toggle this by changing the `CameraManager.roundPixels` property, or change it on a camera-by-camera basis, as needed.
|
||||||
|
* `Camera.roundPixels` is now used across all rendering code for both Canvas and WebGL. Previously, it would check the renderer config value, but now all renderer code uses the camera value to decide if it should floor the drawing position or not.
|
||||||
|
|
||||||
### New Features
|
### New Features
|
||||||
|
|
||||||
* `Graphics.fillRoundedRect` will draw a stroked rounded rectangle to a Graphics object. The radius of the corners can be either a number, or an object, allowing you to specify different radius per corner (thanks @TadejZupancic)
|
* `Graphics.fillRoundedRect` will draw a stroked rounded rectangle to a Graphics object. The radius of the corners can be either a number, or an object, allowing you to specify different radius per corner (thanks @TadejZupancic)
|
||||||
* `Graphics.strokeRoundedRect` will draw a filled rounded rectangle to a Graphics object. The radius of the corners can be either a number, or an object, allowing you to specify different radius per corner (thanks @TadejZupancic)
|
* `Graphics.strokeRoundedRect` will draw a filled rounded rectangle to a Graphics object. The radius of the corners can be either a number, or an object, allowing you to specify different radius per corner (thanks @TadejZupancic)
|
||||||
* `Camera.deadzone` (and its related method `Camera.setDeadzone`) allows you to specify the deadzone for a camera. The deadzone is a rectangular region used when a camera is following a target. If the target is within the deadzone then the camera will not scroll. As soon as the target leaves the deadzone, the camera will begin tracking it (applying lerp if needed.) It allows you to set a region of the camera in which a player can move freely before tracking begins. The deadzone is re-centered on the camera mid point every frame, meaning you can also use the rectangle for other in-game chcecks as needed.
|
* `ParticleEmitter.stop` is a new chainable method to stop a particle emitter. It's the same as setting `on` to `false` but means you don't have to break the method flow to do so (thanks @samme)
|
||||||
* `Camera.midPoint` is a new Vec2 property that is updated every frame. Use it to obtain exactly where in the world the center of the camera is currently looking.
|
* `ScenePlugin.pause` (and the corresponding methods in Scene Systems and the Scene Manager) now has a new optional `data` argument, which is passed to the target Scene and emitted in its 'pause' event.
|
||||||
* `Camera.displayWidth` is a new property that returns the display width of the camera, factoring in the current zoom level.
|
* `ScenePlugin.resume` (and the corresponding methods in Scene Systems and the Scene Manager) now has a new optional `data` argument, which is passed to the target Scene and emitted in its 'resume' event.
|
||||||
* `Camera.displayHeight` is a new property that returns the display height of the camera, factoring in the current zoom level.
|
* `ScenePlugin.sleep` (and the corresponding methods in Scene Systems and the Scene Manager) now has a new optional `data` argument, which is passed to the target Scene and emitted in its 'sleep' event.
|
||||||
* `Camera.centerOn` is a new method that will move the camera so its viewport is centered on the given coordinates. A handy way of jumping to different points around a map without needing to calculate the scroll offsets.
|
* `ScenePlugin.wake` (and the corresponding methods in Scene Systems and the Scene Manager) now has a new optional `data` argument, which is passed to the target Scene and emitted in its 'wake' event.
|
||||||
|
* `ScenePlugin.setActive` now has a new optional `data` argument, which is passed to the target Scene and emitted in its 'pause' or 'resume' events.
|
||||||
|
* `TileSprite.tileScaleX` and `tileScaleY` are two new properties that allow you to control the scale of the texture within the Tile Sprite. This impacts the way the repeating texture is scaled, and is independent to scaling the Tile Sprite itself. It works in both Canvas and WebGL mode.
|
||||||
|
|
||||||
### Updates
|
### Updates
|
||||||
|
|
||||||
|
@ -18,6 +60,10 @@
|
||||||
* The docs for the Loader `filecomplete` event said that you could listen for a specific file using its type and key, i.e.: `filecomplete-image-monster`, however, the code used an underscore instead of a hyphen. We feel the hyphen looks cleaner, so the Loader code has been updated, meaning you can now use the hyphen version of the event properly (thanks @NokFrt)
|
* The docs for the Loader `filecomplete` event said that you could listen for a specific file using its type and key, i.e.: `filecomplete-image-monster`, however, the code used an underscore instead of a hyphen. We feel the hyphen looks cleaner, so the Loader code has been updated, meaning you can now use the hyphen version of the event properly (thanks @NokFrt)
|
||||||
* If a Game Object is already being dragged, it cannot be dragged by another pointer (in multi-touch mode) until the original pointer has released it (thanks @rexrainbow)
|
* If a Game Object is already being dragged, it cannot be dragged by another pointer (in multi-touch mode) until the original pointer has released it (thanks @rexrainbow)
|
||||||
* Calling `Tween.play` on a tween created via `TweenManager.create` wouldn't actually start playback until the tween was first added to the Tween Manager. Now, calling `play` will have it automatically add itself to the Tween Manager if it's not already in there. Fix #3763 (thanks @pantoninho)
|
* Calling `Tween.play` on a tween created via `TweenManager.create` wouldn't actually start playback until the tween was first added to the Tween Manager. Now, calling `play` will have it automatically add itself to the Tween Manager if it's not already in there. Fix #3763 (thanks @pantoninho)
|
||||||
|
* If the Blitter object has no Bob's to render it will now abort immediately, avoiding several context calls in Canvas mode.
|
||||||
|
* `Scene.run` will now pass the optional `data` object in all cases, no matter if it's waking, resuming or starting a Scene (thanks @rook2pawn)
|
||||||
|
* `ScenePlugin.start` and `ScenePlugin.restart` will now always queue the op with the Scene Manager, regardless of the state of the Scene, in order to avoid issues where plugins carry on running for a frame before closing down. Fix #3776 (thanks @jjalonso)
|
||||||
|
* The `batchTileSprite` method has been removed from the `TextureTintPipeline` class, because it is now handled internally by the Tile Sprite object itself.
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
|
@ -25,17 +71,25 @@
|
||||||
* The LoaderPlugin didn't emit the `filecomplete` event if any of files failed to load, causing it to fail to run the Scene `create` function as well. Fix #3750 (thanks @NokFrt)
|
* The LoaderPlugin didn't emit the `filecomplete` event if any of files failed to load, causing it to fail to run the Scene `create` function as well. Fix #3750 (thanks @NokFrt)
|
||||||
* Fix setter calls in BuildGameObjectAnimation so it will now properly set the delay, repeat, repeat delay and yoyo of a config based animation (thanks @DannyT)
|
* Fix setter calls in BuildGameObjectAnimation so it will now properly set the delay, repeat, repeat delay and yoyo of a config based animation (thanks @DannyT)
|
||||||
* The Arcade Body `blocked.none` property is now set to `false` after separation with static bodies or tiles. Previously, the blocked direction was set correctly, but the `none` remained `true` (thanks @samme)
|
* The Arcade Body `blocked.none` property is now set to `false` after separation with static bodies or tiles. Previously, the blocked direction was set correctly, but the `none` remained `true` (thanks @samme)
|
||||||
* The Camera bounds didn't factor in the camera zoom properly, meaning you would often not be able to reach the corners of a camera bound world at a zoom level other than 1. The bounds are now calculated each frame to ensure they match the zoom level and it will no longer allow you to scroll off the edge of the bounds. Fix #3547 (thanks @nkholski)
|
|
||||||
* `Bob.setFrame` didn't actually set the frame on the Bob, now it does. Fix #3774 (thanks @NokFrt)
|
* `Bob.setFrame` didn't actually set the frame on the Bob, now it does. Fix #3774 (thanks @NokFrt)
|
||||||
* `Camera.centerToBounds` didn't take the bounds offset into account, so bounds at non-zero positions wouldn't center properly. All bounds now center correctly. Fix #3706 (thanks @cyantree)
|
* `Bob.alpha` was ignored by the canvas renderer, only working in WebGL. This has now been fixed.
|
||||||
|
* Although the Blitter object had the Alpha component, setting it made no difference. Setting Blitter alpha now impacts the rendering of all children, in both Canvas and WebGL, and you can also specify an alpha per Bob as well.
|
||||||
|
* `SceneManager.run` would ignore scenes that are currently in the queue of scenes pending to be added. This has now been fixed so that the scene is queued to be started once it's ready (thanks @rook2pawn)
|
||||||
|
* `GameObject.disableInteractive` was toggling input. Every second call would turn the input back on (thanks @TadejZupancic)
|
||||||
|
* The position of the TilemapLayer wasn't taken into account when culling tiles for the Camera. It's now calculated as part of the cull flow (thanks @Upperfoot)
|
||||||
|
* Fix extra argument passing in Array.Each (thanks @samme)
|
||||||
|
* TileSprite was using the Size component instead of ComputedSize, meaning its `getBounds` and `displayWidth` and `displayHeight` results were incorrect. Fix #3789 (thanks @jjalonso)
|
||||||
|
* `ArrayUtils.AddAt` didn't calculate the array offset correctly if you passed an array in to be merged with an existing array. This also caused Container.addAt to fail if an array was passed to it. Fix #3788 (thanks @jjalonso)
|
||||||
|
* The `Pointer.camera` property would only be set if there was a viable Game Object in the camera view. Now it is set regardless, to always be the Camera the Pointer interacted with.
|
||||||
|
* Added the Mask component to Container. It worked without it, but this brings it in-line with the documentation and other Game Objects. Fix #3797 (thanks @zilbuz)
|
||||||
|
|
||||||
### Examples, Documentation and TypeScript
|
### Examples, Documentation and TypeScript
|
||||||
|
|
||||||
My thanks to the following for helping with the Phaser 3 Examples, Docs and TypeScript definitions, either by reporting errors, fixing them or helping author the docs:
|
My thanks to the following for helping with the Phaser 3 Examples, Docs and TypeScript definitions, either by reporting errors, fixing them or helping author the docs:
|
||||||
|
|
||||||
@DannyT @squilibob @dvdbrink @t1gu1 @cyantree @DrevanTonder
|
@DannyT @squilibob @dvdbrink @t1gu1 @cyantree @DrevanTonder @mikewesthad
|
||||||
|
|
||||||
Also, a special mention to @andygroff for his excellent work enhancing the search box on the examples site.
|
Also, a special mention to @andygroff for his excellent work enhancing the search box on the examples site, and @hexus for his assistance completing the documentation for the Game Objects.
|
||||||
|
|
||||||
|
|
||||||
## Version 3.10.1 - Hayashi - 13th June 2018
|
## Version 3.10.1 - Hayashi - 13th June 2018
|
||||||
|
|
|
@ -32,7 +32,7 @@ var GetValue = require('../utils/object/GetValue');
|
||||||
*
|
*
|
||||||
* @property {string} key - The key that the animation will be associated with. i.e. sprite.animations.play(key)
|
* @property {string} key - The key that the animation will be associated with. i.e. sprite.animations.play(key)
|
||||||
* @property {(string|number)} frame - [description]
|
* @property {(string|number)} frame - [description]
|
||||||
* @property {float} [duration=0] - [description]
|
* @property {number} [duration=0] - [description]
|
||||||
* @property {boolean} [visible] - [description]
|
* @property {boolean} [visible] - [description]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -545,7 +545,7 @@ var Animation = new Class({
|
||||||
* @method Phaser.Animations.Animation#getFrameByProgress
|
* @method Phaser.Animations.Animation#getFrameByProgress
|
||||||
* @since 3.4.0
|
* @since 3.4.0
|
||||||
*
|
*
|
||||||
* @param {float} value - A value between 0 and 1.
|
* @param {number} value - A value between 0 and 1.
|
||||||
*
|
*
|
||||||
* @return {Phaser.Animations.AnimationFrame} The frame closest to the given progress value.
|
* @return {Phaser.Animations.AnimationFrame} The frame closest to the given progress value.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -323,25 +323,31 @@ var Config = new Class({
|
||||||
|
|
||||||
var renderConfig = GetValue(config, 'render', config);
|
var renderConfig = GetValue(config, 'render', config);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @const {boolean} Phaser.Boot.Config#autoResize - [description]
|
||||||
|
*/
|
||||||
|
this.autoResize = GetValue(renderConfig, 'autoResize', false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @const {boolean} Phaser.Boot.Config#antialias - [description]
|
* @const {boolean} Phaser.Boot.Config#antialias - [description]
|
||||||
*/
|
*/
|
||||||
this.antialias = GetValue(renderConfig, 'antialias', true);
|
this.antialias = GetValue(renderConfig, 'antialias', true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @const {boolean} Phaser.Boot.Config#roundPixels - [description]
|
||||||
|
*/
|
||||||
|
this.roundPixels = GetValue(renderConfig, 'roundPixels', false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @const {boolean} Phaser.Boot.Config#pixelArt - [description]
|
* @const {boolean} Phaser.Boot.Config#pixelArt - [description]
|
||||||
*/
|
*/
|
||||||
this.pixelArt = GetValue(renderConfig, 'pixelArt', false);
|
this.pixelArt = GetValue(renderConfig, 'pixelArt', false);
|
||||||
|
|
||||||
/**
|
if (this.pixelArt)
|
||||||
* @const {boolean} Phaser.Boot.Config#autoResize - [description]
|
{
|
||||||
*/
|
this.antialias = false;
|
||||||
this.autoResize = GetValue(renderConfig, 'autoResize', false);
|
this.roundPixels = true;
|
||||||
|
}
|
||||||
/**
|
|
||||||
* @const {boolean} Phaser.Boot.Config#roundPixels - [description]
|
|
||||||
*/
|
|
||||||
this.roundPixels = GetValue(renderConfig, 'roundPixels', false);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @const {boolean} Phaser.Boot.Config#transparent - [description]
|
* @const {boolean} Phaser.Boot.Config#transparent - [description]
|
||||||
|
|
|
@ -48,7 +48,7 @@ var CreateRenderer = function (game)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pixel Art mode?
|
// Pixel Art mode?
|
||||||
if (config.pixelArt)
|
if (!config.antialias)
|
||||||
{
|
{
|
||||||
CanvasPool.disableSmoothing();
|
CanvasPool.disableSmoothing();
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ var CreateRenderer = function (game)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pixel Art mode?
|
// Pixel Art mode?
|
||||||
if (config.pixelArt)
|
if (!config.antialias)
|
||||||
{
|
{
|
||||||
CanvasInterpolation.setCrisp(game.canvas);
|
CanvasInterpolation.setCrisp(game.canvas);
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,6 +94,17 @@ var Camera = new Class({
|
||||||
*/
|
*/
|
||||||
this.scene;
|
this.scene;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Camera ID. Assigned by the Camera Manager and used to handle camera exclusion.
|
||||||
|
* This value is a bitmask.
|
||||||
|
*
|
||||||
|
* @name Phaser.Cameras.Scene2D.Camera#id
|
||||||
|
* @type {integer}
|
||||||
|
* @readOnly
|
||||||
|
* @since 3.11.0
|
||||||
|
*/
|
||||||
|
this.id = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the Camera. This is left empty for your own use.
|
* The name of the Camera. This is left empty for your own use.
|
||||||
*
|
*
|
||||||
|
@ -251,7 +262,7 @@ var Camera = new Class({
|
||||||
* Be careful to never set this value to zero.
|
* Be careful to never set this value to zero.
|
||||||
*
|
*
|
||||||
* @name Phaser.Cameras.Scene2D.Camera#zoom
|
* @name Phaser.Cameras.Scene2D.Camera#zoom
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @default 1
|
* @default 1
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
|
@ -302,6 +313,18 @@ var Camera = new Class({
|
||||||
*/
|
*/
|
||||||
this.backgroundColor = ValueToColor('rgba(0,0,0,0)');
|
this.backgroundColor = ValueToColor('rgba(0,0,0,0)');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Camera alpha value. Setting this property impacts every single object that this Camera
|
||||||
|
* renders. You can either set the property directly, i.e. via a Tween, to fade a Camera in or out,
|
||||||
|
* or via the chainable `setAlpha` method instead.
|
||||||
|
*
|
||||||
|
* @name Phaser.Cameras.Scene2D.Camera#alpha
|
||||||
|
* @type {number}
|
||||||
|
* @default 1
|
||||||
|
* @since 3.11.0
|
||||||
|
*/
|
||||||
|
this.alpha = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Camera Fade effect handler.
|
* The Camera Fade effect handler.
|
||||||
* To fade this camera see the `Camera.fade` methods.
|
* To fade this camera see the `Camera.fade` methods.
|
||||||
|
@ -429,7 +452,7 @@ var Camera = new Class({
|
||||||
* See `setOrigin` to set both origins in a single, chainable call.
|
* See `setOrigin` to set both origins in a single, chainable call.
|
||||||
*
|
*
|
||||||
* @name Phaser.Cameras.Scene2D.Camera#originX
|
* @name Phaser.Cameras.Scene2D.Camera#originX
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @default 0.5
|
* @default 0.5
|
||||||
* @since 3.11.0
|
* @since 3.11.0
|
||||||
*/
|
*/
|
||||||
|
@ -446,7 +469,7 @@ var Camera = new Class({
|
||||||
* See `setOrigin` to set both origins in a single, chainable call.
|
* See `setOrigin` to set both origins in a single, chainable call.
|
||||||
*
|
*
|
||||||
* @name Phaser.Cameras.Scene2D.Camera#originY
|
* @name Phaser.Cameras.Scene2D.Camera#originY
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @default 0.5
|
* @default 0.5
|
||||||
* @since 3.11.0
|
* @since 3.11.0
|
||||||
*/
|
*/
|
||||||
|
@ -487,17 +510,26 @@ var Camera = new Class({
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
this._follow = null;
|
this._follow = null;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal camera ID. Assigned by the Camera Manager and used in the camera pool.
|
* Set the Alpha level of this Camera. The alpha controls the opacity of the Camera as it renders.
|
||||||
|
* Alpha values are provided as a float between 0, fully transparent, and 1, fully opaque.
|
||||||
*
|
*
|
||||||
* @name Phaser.Cameras.Scene2D.Camera#_id
|
* @method Phaser.GameObjects.Components.Origin#setAlpha
|
||||||
* @type {integer}
|
* @since 3.11.0
|
||||||
* @private
|
*
|
||||||
* @default 0
|
* @param {number} [value=1] - The Camera alpha value.
|
||||||
* @since 3.0.0
|
*
|
||||||
|
* @return {this} This Camera instance.
|
||||||
*/
|
*/
|
||||||
this._id = 0;
|
setAlpha: function (value)
|
||||||
|
{
|
||||||
|
if (value === undefined) { value = 1; }
|
||||||
|
|
||||||
|
this.alpha = value;
|
||||||
|
|
||||||
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1029,7 +1061,7 @@ var Camera = new Class({
|
||||||
*/
|
*/
|
||||||
ignore: function (gameObject)
|
ignore: function (gameObject)
|
||||||
{
|
{
|
||||||
var id = this._id;
|
var id = this.id;
|
||||||
|
|
||||||
if (Array.isArray(gameObject))
|
if (Array.isArray(gameObject))
|
||||||
{
|
{
|
||||||
|
@ -1317,10 +1349,23 @@ var Camera = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the world bounds for this Camera.
|
* Set the bounds of the Camera. The bounds are an axis-aligned rectangle.
|
||||||
*
|
*
|
||||||
* A Camera bounds controls where the camera can scroll to within the world. It does not limit
|
* The Camera bounds controls where the Camera can scroll to, stopping it from scrolling off the
|
||||||
* rendering of the camera, or placement of the viewport within your game.
|
* edges and into blank space. It does not limit the placement of Game Objects, or where
|
||||||
|
* the Camera viewport can be positioned.
|
||||||
|
*
|
||||||
|
* Temporarily disable the bounds by changing the boolean `Camera.useBounds`.
|
||||||
|
*
|
||||||
|
* Clear the bounds entirely by calling `Camera.removeBounds`.
|
||||||
|
*
|
||||||
|
* If you set bounds that are smaller than the viewport it will stop the Camera from being
|
||||||
|
* able to scroll. The bounds can be positioned where-ever you wish. By default they are from
|
||||||
|
* 0x0 to the canvas width x height. This means that the coordinate 0x0 is the top left of
|
||||||
|
* the Camera bounds. However, you can position them anywhere. So if you wanted a game world
|
||||||
|
* that was 2048x2048 in size, with 0x0 being the center of it, you can set the bounds x/y
|
||||||
|
* to be -1024, -1024, with a width and height of 2048. Depending on your game you may find
|
||||||
|
* it easier for 0x0 to be the top-left of the bounds, or you may wish 0x0 to be the middle.
|
||||||
*
|
*
|
||||||
* @method Phaser.Cameras.Scene2D.Camera#setBounds
|
* @method Phaser.Cameras.Scene2D.Camera#setBounds
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
|
@ -1329,15 +1374,26 @@ var Camera = new Class({
|
||||||
* @param {integer} y - The top-left y coordinate of the bounds.
|
* @param {integer} y - The top-left y coordinate of the bounds.
|
||||||
* @param {integer} width - The width of the bounds, in pixels.
|
* @param {integer} width - The width of the bounds, in pixels.
|
||||||
* @param {integer} height - The height of the bounds, in pixels.
|
* @param {integer} height - The height of the bounds, in pixels.
|
||||||
|
* @param {boolean} [centerOn] - If `true` the Camera will automatically be centered on the new bounds.
|
||||||
*
|
*
|
||||||
* @return {Phaser.Cameras.Scene2D.Camera} This Camera instance.
|
* @return {Phaser.Cameras.Scene2D.Camera} This Camera instance.
|
||||||
*/
|
*/
|
||||||
setBounds: function (x, y, width, height)
|
setBounds: function (x, y, width, height, centerOn)
|
||||||
{
|
{
|
||||||
this._bounds.setTo(x, y, width, height);
|
this._bounds.setTo(x, y, width, height);
|
||||||
|
|
||||||
this.useBounds = true;
|
this.useBounds = true;
|
||||||
|
|
||||||
|
if (centerOn)
|
||||||
|
{
|
||||||
|
this.centerToBounds();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.scrollX = this.clampX(this.scrollX);
|
||||||
|
this.scrollY = this.clampY(this.scrollY);
|
||||||
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1406,8 +1462,9 @@ var Camera = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should the Camera round pixel values to whole integers when scrolling?
|
* Should the Camera round pixel values to whole integers when rendering Game Objects?
|
||||||
* In some types of game this is required to prevent sub-pixel aliasing.
|
*
|
||||||
|
* In some types of game, especially with pixel art, this is required to prevent sub-pixel aliasing.
|
||||||
*
|
*
|
||||||
* @method Phaser.Cameras.Scene2D.Camera#setRoundPixels
|
* @method Phaser.Cameras.Scene2D.Camera#setRoundPixels
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
|
@ -1534,7 +1591,7 @@ var Camera = new Class({
|
||||||
* @method Phaser.Cameras.Scene2D.Camera#setZoom
|
* @method Phaser.Cameras.Scene2D.Camera#setZoom
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} [value=1] - The zoom value of the Camera. The minimum it can be is 0.001.
|
* @param {number} [value=1] - The zoom value of the Camera. The minimum it can be is 0.001.
|
||||||
*
|
*
|
||||||
* @return {Phaser.Cameras.Scene2D.Camera} This Camera instance.
|
* @return {Phaser.Cameras.Scene2D.Camera} This Camera instance.
|
||||||
*/
|
*/
|
||||||
|
@ -1590,8 +1647,8 @@ var Camera = new Class({
|
||||||
*
|
*
|
||||||
* @param {(Phaser.GameObjects.GameObject|object)} target - The target for the Camera to follow.
|
* @param {(Phaser.GameObjects.GameObject|object)} target - The target for the Camera to follow.
|
||||||
* @param {boolean} [roundPixels=false] - Round the camera position to whole integers to avoid sub-pixel rendering?
|
* @param {boolean} [roundPixels=false] - Round the camera position to whole integers to avoid sub-pixel rendering?
|
||||||
* @param {float} [lerpX=1] - A value between 0 and 1. This value specifies the amount of linear interpolation to use when horizontally tracking the target. The closer the value to 1, the faster the camera will track.
|
* @param {number} [lerpX=1] - A value between 0 and 1. This value specifies the amount of linear interpolation to use when horizontally tracking the target. The closer the value to 1, the faster the camera will track.
|
||||||
* @param {float} [lerpY=1] - A value between 0 and 1. This value specifies the amount of linear interpolation to use when vertically tracking the target. The closer the value to 1, the faster the camera will track.
|
* @param {number} [lerpY=1] - A value between 0 and 1. This value specifies the amount of linear interpolation to use when vertically tracking the target. The closer the value to 1, the faster the camera will track.
|
||||||
* @param {number} [offsetX=0] - The horizontal offset from the camera follow target.x position.
|
* @param {number} [offsetX=0] - The horizontal offset from the camera follow target.x position.
|
||||||
* @param {number} [offsetY=0] - The vertical offset from the camera follow target.y position.
|
* @param {number} [offsetY=0] - The vertical offset from the camera follow target.y position.
|
||||||
*
|
*
|
||||||
|
|
|
@ -13,27 +13,54 @@ var RectangleContains = require('../../geom/rectangle/Contains');
|
||||||
/**
|
/**
|
||||||
* @typedef {object} InputJSONCameraObject
|
* @typedef {object} InputJSONCameraObject
|
||||||
*
|
*
|
||||||
* @property {string} [name=''] - [description]
|
* @property {string} [name=''] - The name of the Camera.
|
||||||
* @property {integer} [x=0] - [description]
|
* @property {integer} [x=0] - The horizontal position of the Camera viewport.
|
||||||
* @property {integer} [y=0] - [description]
|
* @property {integer} [y=0] - The vertical position of the Camera viewport.
|
||||||
* @property {integer} [width] - [description]
|
* @property {integer} [width] - The width of the Camera viewport.
|
||||||
* @property {integer} [height] - [description]
|
* @property {integer} [height] - The height of the Camera viewport.
|
||||||
* @property {float} [zoom=1] - [description]
|
* @property {number} [zoom=1] - The default zoom level of the Camera.
|
||||||
* @property {float} [rotation=0] - [description]
|
* @property {number} [rotation=0] - The rotation of the Camera, in radians.
|
||||||
* @property {boolean} [roundPixels=false] - [description]
|
* @property {boolean} [roundPixels=false] - Should the Camera round pixels before rendering?
|
||||||
* @property {float} [scrollX=0] - [description]
|
* @property {number} [scrollX=0] - The horizontal scroll position of the Camera.
|
||||||
* @property {float} [scrollY=0] - [description]
|
* @property {number} [scrollY=0] - The vertical scroll position of the Camera.
|
||||||
* @property {(false|string)} [backgroundColor=false] - [description]
|
* @property {(false|string)} [backgroundColor=false] - A CSS color string controlling the Camera background color.
|
||||||
* @property {?object} [bounds] - [description]
|
* @property {?object} [bounds] - Defines the Camera bounds.
|
||||||
* @property {number} [bounds.x=0] - [description]
|
* @property {number} [bounds.x=0] - The top-left extent of the Camera bounds.
|
||||||
* @property {number} [bounds.y=0] - [description]
|
* @property {number} [bounds.y=0] - The top-left extent of the Camera bounds.
|
||||||
* @property {number} [bounds.width] - [description]
|
* @property {number} [bounds.width] - The width of the Camera bounds.
|
||||||
* @property {number} [bounds.height] - [description]
|
* @property {number} [bounds.height] - The height of the Camera bounds.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @classdesc
|
* @classdesc
|
||||||
* [description]
|
* The Camera Manager is a plugin that belongs to a Scene and is responsible for managing all of the Scene Cameras.
|
||||||
|
*
|
||||||
|
* By default you can access the Camera Manager from within a Scene using `this.cameras`, although this can be changed
|
||||||
|
* in your game config.
|
||||||
|
*
|
||||||
|
* Create new Cameras using the `add` method. Or extend the Camera class with your own addition code and then add
|
||||||
|
* the new Camera in using the `addExisting` method.
|
||||||
|
*
|
||||||
|
* Cameras provide a view into your game world, and can be positioned, rotated, zoomed and scrolled accordingly.
|
||||||
|
*
|
||||||
|
* A Camera consists of two elements: The viewport and the scroll values.
|
||||||
|
*
|
||||||
|
* The viewport is the physical position and size of the Camera within your game. Cameras, by default, are
|
||||||
|
* created the same size as your game, but their position and size can be set to anything. This means if you
|
||||||
|
* wanted to create a camera that was 320x200 in size, positioned in the bottom-right corner of your game,
|
||||||
|
* you'd adjust the viewport to do that (using methods like `setViewport` and `setSize`).
|
||||||
|
*
|
||||||
|
* If you wish to change where the Camera is looking in your game, then you scroll it. You can do this
|
||||||
|
* via the properties `scrollX` and `scrollY` or the method `setScroll`. Scrolling has no impact on the
|
||||||
|
* viewport, and changing the viewport has no impact on the scrolling.
|
||||||
|
*
|
||||||
|
* By default a Camera will render all Game Objects it can see. You can change this using the `ignore` method,
|
||||||
|
* allowing you to filter Game Objects out on a per-Camera basis. The Camera Manager can manage up to 31 unique
|
||||||
|
* 'Game Object ignore capable' Cameras. Any Cameras beyond 31 that you create will all be given a Camera ID of
|
||||||
|
* zero, meaning that they cannot be used for Game Object exclusion. This means if you need your Camera to ignore
|
||||||
|
* Game Objects, make sure it's one of the first 31 created.
|
||||||
|
*
|
||||||
|
* A Camera also has built-in special effects including Fade, Flash, Camera Shake, Pan and Zoom.
|
||||||
*
|
*
|
||||||
* @class CameraManager
|
* @class CameraManager
|
||||||
* @memberOf Phaser.Cameras.Scene2D
|
* @memberOf Phaser.Cameras.Scene2D
|
||||||
|
@ -67,18 +94,22 @@ var CameraManager = new Class({
|
||||||
this.systems = scene.sys;
|
this.systems = scene.sys;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current Camera ID.
|
* All Cameras created by, or added to, this Camera Manager, will have their `roundPixels`
|
||||||
|
* property set to match this value. By default it is set to match the value set in the
|
||||||
|
* game configuration, but can be changed at any point. Equally, individual cameras can
|
||||||
|
* also be changed as needed.
|
||||||
*
|
*
|
||||||
* @name Phaser.Cameras.Scene2D.CameraManager#currentCameraId
|
* @name Phaser.Cameras.Scene2D.CameraManager#roundPixels
|
||||||
* @type {number}
|
* @type {boolean}
|
||||||
* @default 1
|
* @since 3.11.0
|
||||||
* @readOnly
|
|
||||||
* @since 3.0.0
|
|
||||||
*/
|
*/
|
||||||
this.currentCameraId = 1;
|
this.roundPixels = scene.sys.game.config.roundPixels;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An Array of the Camera objects being managed by this Camera Manager.
|
* An Array of the Camera objects being managed by this Camera Manager.
|
||||||
|
* The Cameras are updated and rendered in the same order in which they appear in this array.
|
||||||
|
* Do not directly add or remove entries to this array. However, you can move the contents
|
||||||
|
* around the array should you wish to adjust the display order.
|
||||||
*
|
*
|
||||||
* @name Phaser.Cameras.Scene2D.CameraManager#cameras
|
* @name Phaser.Cameras.Scene2D.CameraManager#cameras
|
||||||
* @type {Phaser.Cameras.Scene2D.Camera[]}
|
* @type {Phaser.Cameras.Scene2D.Camera[]}
|
||||||
|
@ -87,16 +118,15 @@ var CameraManager = new Class({
|
||||||
this.cameras = [];
|
this.cameras = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A pool of Camera objects available to be used by the Camera Manager.
|
* A handy reference to the 'main' camera. By default this is the first Camera the
|
||||||
|
* Camera Manager creates. You can also set it directly, or use the `makeMain` argument
|
||||||
|
* in the `add` and `addExisting` methods. It allows you to access it from your game:
|
||||||
*
|
*
|
||||||
* @name Phaser.Cameras.Scene2D.CameraManager#cameraPool
|
* ```javascript
|
||||||
* @type {Phaser.Cameras.Scene2D.Camera[]}
|
* var cam = this.cameras.main;
|
||||||
* @since 3.0.0
|
* ```
|
||||||
*/
|
*
|
||||||
this.cameraPool = [];
|
* Also see the properties `camera1`, `camera2` and so on.
|
||||||
|
|
||||||
/**
|
|
||||||
* The default Camera in the Camera Manager.
|
|
||||||
*
|
*
|
||||||
* @name Phaser.Cameras.Scene2D.CameraManager#main
|
* @name Phaser.Cameras.Scene2D.CameraManager#main
|
||||||
* @type {Phaser.Cameras.Scene2D.Camera}
|
* @type {Phaser.Cameras.Scene2D.Camera}
|
||||||
|
@ -105,7 +135,7 @@ var CameraManager = new Class({
|
||||||
this.main;
|
this.main;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This scale affects all cameras. It's used by Scale Manager.
|
* This scale affects all cameras. It's used by the Scale Manager.
|
||||||
*
|
*
|
||||||
* @name Phaser.Cameras.Scene2D.CameraManager#baseScale
|
* @name Phaser.Cameras.Scene2D.CameraManager#baseScale
|
||||||
* @type {number}
|
* @type {number}
|
||||||
|
@ -168,19 +198,33 @@ var CameraManager = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Adds a new Camera into the Camera Manager. The Camera Manager can support up to 31 different Cameras.
|
||||||
|
*
|
||||||
|
* Each Camera has its own viewport, which controls the size of the Camera and its position within the canvas.
|
||||||
|
*
|
||||||
|
* Use the `Camera.scrollX` and `Camera.scrollY` properties to change where the Camera is looking, or the
|
||||||
|
* Camera methods such as `centerOn`. Cameras also have built in special effects, such as fade, flash, shake,
|
||||||
|
* pan and zoom.
|
||||||
|
*
|
||||||
|
* By default Cameras are transparent and will render anything that they can see based on their `scrollX`
|
||||||
|
* and `scrollY` values. Game Objects can be set to be ignored by a Camera by using the `Camera.ignore` method.
|
||||||
|
*
|
||||||
|
* The Camera will have its `roundPixels` propery set to whatever `CameraManager.roundPixels` is. You can change
|
||||||
|
* it after creation if required.
|
||||||
|
*
|
||||||
|
* See the Camera class documentation for more details.
|
||||||
*
|
*
|
||||||
* @method Phaser.Cameras.Scene2D.CameraManager#add
|
* @method Phaser.Cameras.Scene2D.CameraManager#add
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {number} [x=0] - [description]
|
* @param {integer} [x=0] - The horizontal position of the Camera viewport.
|
||||||
* @param {number} [y=0] - [description]
|
* @param {integer} [y=0] - The vertical position of the Camera viewport.
|
||||||
* @param {number} [width] - [description]
|
* @param {integer} [width] - The width of the Camera viewport. If not given it'll be the game config size.
|
||||||
* @param {number} [height] - [description]
|
* @param {integer} [height] - The height of the Camera viewport. If not given it'll be the game config size.
|
||||||
* @param {boolean} [makeMain=false] - [description]
|
* @param {boolean} [makeMain=false] - Set this Camera as being the 'main' camera. This just makes the property `main` a reference to it.
|
||||||
* @param {string} [name=''] - [description]
|
* @param {string} [name=''] - The name of the Camera.
|
||||||
*
|
*
|
||||||
* @return {Phaser.Cameras.Scene2D.Camera} [description]
|
* @return {Phaser.Cameras.Scene2D.Camera} The newly created Camera.
|
||||||
*/
|
*/
|
||||||
add: function (x, y, width, height, makeMain, name)
|
add: function (x, y, width, height, makeMain, name)
|
||||||
{
|
{
|
||||||
|
@ -191,21 +235,13 @@ var CameraManager = new Class({
|
||||||
if (makeMain === undefined) { makeMain = false; }
|
if (makeMain === undefined) { makeMain = false; }
|
||||||
if (name === undefined) { name = ''; }
|
if (name === undefined) { name = ''; }
|
||||||
|
|
||||||
var camera = null;
|
var camera = new Camera(x, y, width, height);
|
||||||
|
|
||||||
if (this.cameraPool.length > 0)
|
|
||||||
{
|
|
||||||
camera = this.cameraPool.pop();
|
|
||||||
|
|
||||||
camera.setViewport(x, y, width, height);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
camera = new Camera(x, y, width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
camera.setName(name);
|
camera.setName(name);
|
||||||
camera.setScene(this.scene);
|
camera.setScene(this.scene);
|
||||||
|
camera.setRoundPixels(this.roundPixels);
|
||||||
|
|
||||||
|
camera.id = this.getNextID();
|
||||||
|
|
||||||
this.cameras.push(camera);
|
this.cameras.push(camera);
|
||||||
|
|
||||||
|
@ -214,32 +250,48 @@ var CameraManager = new Class({
|
||||||
this.main = camera;
|
this.main = camera;
|
||||||
}
|
}
|
||||||
|
|
||||||
camera._id = this.currentCameraId;
|
|
||||||
|
|
||||||
this.currentCameraId = this.currentCameraId << 1;
|
|
||||||
|
|
||||||
return camera;
|
return camera;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Adds an existing Camera into the Camera Manager.
|
||||||
|
*
|
||||||
|
* The Camera should either be a `Phaser.Cameras.Scene2D.Camera` instance, or a class that extends from it.
|
||||||
|
*
|
||||||
|
* The Camera will have its `roundPixels` propery set to whatever `CameraManager.roundPixels` is. You can change
|
||||||
|
* it after addition if required.
|
||||||
|
*
|
||||||
|
* The Camera will be assigned an ID, which is used for Game Object exclusion and then added to the
|
||||||
|
* manager. As long as it doesn't already exist in the manager it will be added then returned.
|
||||||
|
*
|
||||||
|
* If this method returns `null` then the Camera already exists in this Camera Manager.
|
||||||
*
|
*
|
||||||
* @method Phaser.Cameras.Scene2D.CameraManager#addExisting
|
* @method Phaser.Cameras.Scene2D.CameraManager#addExisting
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
|
* @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to be added to the Camera Manager.
|
||||||
|
* @param {boolean} [makeMain=false] - Set this Camera as being the 'main' camera. This just makes the property `main` a reference to it.
|
||||||
*
|
*
|
||||||
* @return {Phaser.Cameras.Scene2D.Camera} [description]
|
* @return {?Phaser.Cameras.Scene2D.Camera} The Camera that was added to the Camera Manager, or `null` if it couldn't be added.
|
||||||
*/
|
*/
|
||||||
addExisting: function (camera)
|
addExisting: function (camera, makeMain)
|
||||||
{
|
{
|
||||||
var index = this.cameras.indexOf(camera);
|
if (makeMain === undefined) { makeMain = false; }
|
||||||
var poolIndex = this.cameraPool.indexOf(camera);
|
|
||||||
|
|
||||||
if (index < 0 && poolIndex >= 0)
|
var index = this.cameras.indexOf(camera);
|
||||||
|
|
||||||
|
if (index === -1)
|
||||||
{
|
{
|
||||||
|
camera.id = this.getNextID();
|
||||||
|
|
||||||
|
camera.setRoundPixels(this.roundPixels);
|
||||||
|
|
||||||
this.cameras.push(camera);
|
this.cameras.push(camera);
|
||||||
this.cameraPool.slice(poolIndex, 1);
|
|
||||||
|
if (makeMain)
|
||||||
|
{
|
||||||
|
this.main = camera;
|
||||||
|
}
|
||||||
|
|
||||||
return camera;
|
return camera;
|
||||||
}
|
}
|
||||||
|
@ -248,14 +300,97 @@ var CameraManager = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Gets the next available Camera ID number.
|
||||||
|
*
|
||||||
|
* The Camera Manager supports up to 31 unique cameras, after which the ID returned will always be zero.
|
||||||
|
* You can create additional cameras beyond 31, but they cannot be used for Game Object exclusion.
|
||||||
|
*
|
||||||
|
* @method Phaser.Cameras.Scene2D.CameraManager#getNextID
|
||||||
|
* @private
|
||||||
|
* @since 3.11.0
|
||||||
|
*
|
||||||
|
* @return {number} The next available Camera ID, or 0 if they're all already in use.
|
||||||
|
*/
|
||||||
|
getNextID: function ()
|
||||||
|
{
|
||||||
|
var cameras = this.cameras;
|
||||||
|
|
||||||
|
var testID = 1;
|
||||||
|
|
||||||
|
// Find the first free camera ID we can use
|
||||||
|
|
||||||
|
for (var t = 0; t < 32; t++)
|
||||||
|
{
|
||||||
|
var found = false;
|
||||||
|
|
||||||
|
for (var i = 0; i < cameras.length; i++)
|
||||||
|
{
|
||||||
|
var camera = cameras[i];
|
||||||
|
|
||||||
|
if (camera && camera.id === testID)
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (found)
|
||||||
|
{
|
||||||
|
testID = testID << 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return testID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the total number of Cameras in this Camera Manager.
|
||||||
|
*
|
||||||
|
* If the optional `isVisible` argument is set it will only count Cameras that are currently visible.
|
||||||
|
*
|
||||||
|
* @method Phaser.Cameras.Scene2D.CameraManager#getTotal
|
||||||
|
* @since 3.11.0
|
||||||
|
*
|
||||||
|
* @param {boolean} [isVisible=false] - Set the `true` to only include visible Cameras in the total.
|
||||||
|
*
|
||||||
|
* @return {integer} The total number of Cameras in this Camera Manager.
|
||||||
|
*/
|
||||||
|
getTotal: function (isVisible)
|
||||||
|
{
|
||||||
|
if (isVisible === undefined) { isVisible = false; }
|
||||||
|
|
||||||
|
var total = 0;
|
||||||
|
|
||||||
|
var cameras = this.cameras;
|
||||||
|
|
||||||
|
for (var i = 0; i < cameras.length; i++)
|
||||||
|
{
|
||||||
|
var camera = cameras[i];
|
||||||
|
|
||||||
|
if (!isVisible || (isVisible && camera.visible))
|
||||||
|
{
|
||||||
|
total++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return total;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Populates this Camera Manager based on the given configuration object, or an array of config objects.
|
||||||
|
*
|
||||||
|
* See the `InputJSONCameraObject` documentation for details of the object structure.
|
||||||
*
|
*
|
||||||
* @method Phaser.Cameras.Scene2D.CameraManager#fromJSON
|
* @method Phaser.Cameras.Scene2D.CameraManager#fromJSON
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {(InputJSONCameraObject|InputJSONCameraObject[])} config - [description]
|
* @param {(InputJSONCameraObject|InputJSONCameraObject[])} config - A Camera configuration object, or an array of them, to be added to this Camera Manager.
|
||||||
*
|
*
|
||||||
* @return {Phaser.Cameras.Scene2D.CameraManager} [description]
|
* @return {Phaser.Cameras.Scene2D.CameraManager} This Camera Manager instance.
|
||||||
*/
|
*/
|
||||||
fromJSON: function (config)
|
fromJSON: function (config)
|
||||||
{
|
{
|
||||||
|
@ -315,22 +450,27 @@ var CameraManager = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Gets a Camera based on its name.
|
||||||
|
*
|
||||||
|
* Camera names are optional and don't have to be set, so this method is only of any use if you
|
||||||
|
* have given your Cameras unique names.
|
||||||
*
|
*
|
||||||
* @method Phaser.Cameras.Scene2D.CameraManager#getCamera
|
* @method Phaser.Cameras.Scene2D.CameraManager#getCamera
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {string} name - [description]
|
* @param {string} name - The name of the Camera.
|
||||||
*
|
*
|
||||||
* @return {Phaser.Cameras.Scene2D.Camera} [description]
|
* @return {?Phaser.Cameras.Scene2D.Camera} The first Camera with a name matching the given string, otherwise `null`.
|
||||||
*/
|
*/
|
||||||
getCamera: function (name)
|
getCamera: function (name)
|
||||||
{
|
{
|
||||||
for (var i = 0; i < this.cameras.length; i++)
|
var cameras = this.cameras;
|
||||||
|
|
||||||
|
for (var i = 0; i < cameras.length; i++)
|
||||||
{
|
{
|
||||||
if (this.cameras[i].name === name)
|
if (cameras[i].name === name)
|
||||||
{
|
{
|
||||||
return this.cameras[i];
|
return cameras[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,33 +513,58 @@ var CameraManager = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Removes the given Camera, or an array of Cameras, from this Camera Manager.
|
||||||
|
*
|
||||||
|
* If found in the Camera Manager it will be immediately removed from the local cameras array.
|
||||||
|
* If also currently the 'main' camera, 'main' will be reset to be camera 0.
|
||||||
|
*
|
||||||
|
* The removed Camera is not destroyed. If you also wish to destroy the Camera, you should call
|
||||||
|
* `Camera.destroy` on it, so that it clears all references to the Camera Manager.
|
||||||
*
|
*
|
||||||
* @method Phaser.Cameras.Scene2D.CameraManager#remove
|
* @method Phaser.Cameras.Scene2D.CameraManager#remove
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
|
* @param {(Phaser.Cameras.Scene2D.Camera|Phaser.Cameras.Scene2D.Camera[])} camera - The Camera, or an array of Cameras, to be removed from this Camera Manager.
|
||||||
|
*
|
||||||
|
* @return {integer} The total number of Cameras removed.
|
||||||
*/
|
*/
|
||||||
remove: function (camera)
|
remove: function (camera)
|
||||||
{
|
{
|
||||||
var cameraIndex = this.cameras.indexOf(camera);
|
if (!Array.isArray(camera))
|
||||||
|
|
||||||
if (cameraIndex >= 0 && this.cameras.length > 1)
|
|
||||||
{
|
{
|
||||||
this.cameraPool.push(this.cameras[cameraIndex]);
|
camera = [ camera ];
|
||||||
this.cameras.splice(cameraIndex, 1);
|
}
|
||||||
|
|
||||||
if (this.main === camera)
|
var total = 0;
|
||||||
|
var cameras = this.cameras;
|
||||||
|
|
||||||
|
for (var i = 0; i < camera.length; i++)
|
||||||
{
|
{
|
||||||
this.main = this.cameras[0];
|
var index = cameras.indexOf(camera[i]);
|
||||||
|
|
||||||
|
if (index !== -1)
|
||||||
|
{
|
||||||
|
cameras.splice(index, 1);
|
||||||
|
total++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.main)
|
||||||
|
{
|
||||||
|
this.main = cameras[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return total;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The internal render method. This is called automatically by the Scene and should not be invoked directly.
|
||||||
|
*
|
||||||
|
* It will iterate through all local cameras and render them in turn, as long as they're visible and have
|
||||||
|
* an alpha level > 0.
|
||||||
*
|
*
|
||||||
* @method Phaser.Cameras.Scene2D.CameraManager#render
|
* @method Phaser.Cameras.Scene2D.CameraManager#render
|
||||||
|
* @protected
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The Renderer that will render the children to this camera.
|
* @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The Renderer that will render the children to this camera.
|
||||||
|
@ -408,54 +573,62 @@ var CameraManager = new Class({
|
||||||
*/
|
*/
|
||||||
render: function (renderer, children, interpolation)
|
render: function (renderer, children, interpolation)
|
||||||
{
|
{
|
||||||
|
var scene = this.scene;
|
||||||
var cameras = this.cameras;
|
var cameras = this.cameras;
|
||||||
var baseScale = this.baseScale;
|
var baseScale = this.baseScale;
|
||||||
|
var resolution = renderer.config.resolution;
|
||||||
|
|
||||||
for (var i = 0, l = cameras.length; i < l; ++i)
|
for (var i = 0; i < this.cameras.length; i++)
|
||||||
{
|
{
|
||||||
var camera = cameras[i];
|
var camera = cameras[i];
|
||||||
|
|
||||||
if (camera.visible)
|
if (camera.visible && camera.alpha > 0)
|
||||||
{
|
{
|
||||||
camera.preRender(baseScale, renderer.config.resolution);
|
camera.preRender(baseScale, resolution);
|
||||||
|
|
||||||
renderer.render(this.scene, children, interpolation, camera);
|
renderer.render(scene, children, interpolation, camera);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Resets this Camera Manager.
|
||||||
|
*
|
||||||
|
* This will iterate through all current Cameras, destroying them all, then it will reset the
|
||||||
|
* cameras array, reset the ID counter and create 1 new single camera using the default values.
|
||||||
*
|
*
|
||||||
* @method Phaser.Cameras.Scene2D.CameraManager#resetAll
|
* @method Phaser.Cameras.Scene2D.CameraManager#resetAll
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @return {Phaser.Cameras.Scene2D.Camera} [description]
|
* @return {Phaser.Cameras.Scene2D.Camera} The freshly created main Camera.
|
||||||
*/
|
*/
|
||||||
resetAll: function ()
|
resetAll: function ()
|
||||||
{
|
{
|
||||||
while (this.cameras.length > 0)
|
for (var i = 0; i < this.cameras.length; i++)
|
||||||
{
|
{
|
||||||
this.cameraPool.push(this.cameras.pop());
|
this.cameras[i].destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.cameras = [];
|
||||||
|
|
||||||
this.main = this.add();
|
this.main = this.add();
|
||||||
|
|
||||||
return this.main;
|
return this.main;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The main update loop. Called automatically when the Scene steps.
|
||||||
*
|
*
|
||||||
* @method Phaser.Cameras.Scene2D.CameraManager#update
|
* @method Phaser.Cameras.Scene2D.CameraManager#update
|
||||||
|
* @protected
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {number} timestep - [description]
|
* @param {number} timestep - The timestep value.
|
||||||
* @param {number} delta - [description]
|
* @param {number} delta - The delta value since the last frame.
|
||||||
*/
|
*/
|
||||||
update: function (timestep, delta)
|
update: function (timestep, delta)
|
||||||
{
|
{
|
||||||
for (var i = 0, l = this.cameras.length; i < l; ++i)
|
for (var i = 0; i < this.cameras.length; i++)
|
||||||
{
|
{
|
||||||
this.cameras[i].update(timestep, delta);
|
this.cameras[i].update(timestep, delta);
|
||||||
}
|
}
|
||||||
|
@ -472,7 +645,7 @@ var CameraManager = new Class({
|
||||||
*/
|
*/
|
||||||
resize: function (width, height)
|
resize: function (width, height)
|
||||||
{
|
{
|
||||||
for (var i = 0, l = this.cameras.length; i < l; ++i)
|
for (var i = 0; i < this.cameras.length; i++)
|
||||||
{
|
{
|
||||||
this.cameras[i].setSize(width, height);
|
this.cameras[i].setSize(width, height);
|
||||||
}
|
}
|
||||||
|
@ -495,13 +668,7 @@ var CameraManager = new Class({
|
||||||
this.cameras[i].destroy();
|
this.cameras[i].destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < this.cameraPool.length; i++)
|
|
||||||
{
|
|
||||||
this.cameraPool[i].destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.cameras = [];
|
this.cameras = [];
|
||||||
this.cameraPool = [];
|
|
||||||
|
|
||||||
var eventEmitter = this.systems.events;
|
var eventEmitter = this.systems.events;
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ var Fade = new Class({
|
||||||
* A value between 0 and 1.
|
* A value between 0 and 1.
|
||||||
*
|
*
|
||||||
* @name Phaser.Cameras.Scene2D.Effects.Fade#alpha
|
* @name Phaser.Cameras.Scene2D.Effects.Fade#alpha
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @private
|
* @private
|
||||||
* @since 3.5.0
|
* @since 3.5.0
|
||||||
*/
|
*/
|
||||||
|
@ -137,7 +137,7 @@ var Fade = new Class({
|
||||||
* If this effect is running this holds the current percentage of the progress, a value between 0 and 1.
|
* If this effect is running this holds the current percentage of the progress, a value between 0 and 1.
|
||||||
*
|
*
|
||||||
* @name Phaser.Cameras.Scene2D.Effects.Fade#progress
|
* @name Phaser.Cameras.Scene2D.Effects.Fade#progress
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @since 3.5.0
|
* @since 3.5.0
|
||||||
*/
|
*/
|
||||||
this.progress = 0;
|
this.progress = 0;
|
||||||
|
@ -156,7 +156,7 @@ var Fade = new Class({
|
||||||
* @callback CameraFadeCallback
|
* @callback CameraFadeCallback
|
||||||
*
|
*
|
||||||
* @param {Phaser.Cameras.Scene2D.Camera} camera - The camera on which the effect is running.
|
* @param {Phaser.Cameras.Scene2D.Camera} camera - The camera on which the effect is running.
|
||||||
* @param {float} progress - The progress of the effect. A value between 0 and 1.
|
* @param {number} progress - The progress of the effect. A value between 0 and 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -102,7 +102,7 @@ var Flash = new Class({
|
||||||
* A value between 0 and 1.
|
* A value between 0 and 1.
|
||||||
*
|
*
|
||||||
* @name Phaser.Cameras.Scene2D.Effects.Flash#alpha
|
* @name Phaser.Cameras.Scene2D.Effects.Flash#alpha
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @private
|
* @private
|
||||||
* @since 3.5.0
|
* @since 3.5.0
|
||||||
*/
|
*/
|
||||||
|
@ -112,7 +112,7 @@ var Flash = new Class({
|
||||||
* If this effect is running this holds the current percentage of the progress, a value between 0 and 1.
|
* If this effect is running this holds the current percentage of the progress, a value between 0 and 1.
|
||||||
*
|
*
|
||||||
* @name Phaser.Cameras.Scene2D.Effects.Flash#progress
|
* @name Phaser.Cameras.Scene2D.Effects.Flash#progress
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @since 3.5.0
|
* @since 3.5.0
|
||||||
*/
|
*/
|
||||||
this.progress = 0;
|
this.progress = 0;
|
||||||
|
@ -131,7 +131,7 @@ var Flash = new Class({
|
||||||
* @callback CameraFlashCallback
|
* @callback CameraFlashCallback
|
||||||
*
|
*
|
||||||
* @param {Phaser.Cameras.Scene2D.Camera} camera - The camera on which the effect is running.
|
* @param {Phaser.Cameras.Scene2D.Camera} camera - The camera on which the effect is running.
|
||||||
* @param {float} progress - The progress of the effect. A value between 0 and 1.
|
* @param {number} progress - The progress of the effect. A value between 0 and 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -107,7 +107,7 @@ var Pan = new Class({
|
||||||
* If this effect is running this holds the current percentage of the progress, a value between 0 and 1.
|
* If this effect is running this holds the current percentage of the progress, a value between 0 and 1.
|
||||||
*
|
*
|
||||||
* @name Phaser.Cameras.Scene2D.Effects.Pan#progress
|
* @name Phaser.Cameras.Scene2D.Effects.Pan#progress
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @since 3.11.0
|
* @since 3.11.0
|
||||||
*/
|
*/
|
||||||
this.progress = 0;
|
this.progress = 0;
|
||||||
|
@ -126,7 +126,7 @@ var Pan = new Class({
|
||||||
* @callback CameraPanCallback
|
* @callback CameraPanCallback
|
||||||
*
|
*
|
||||||
* @param {Phaser.Cameras.Scene2D.Camera} camera - The camera on which the effect is running.
|
* @param {Phaser.Cameras.Scene2D.Camera} camera - The camera on which the effect is running.
|
||||||
* @param {float} progress - The progress of the effect. A value between 0 and 1.
|
* @param {number} progress - The progress of the effect. A value between 0 and 1.
|
||||||
* @param {number} x - The Camera's new scrollX coordinate.
|
* @param {number} x - The Camera's new scrollX coordinate.
|
||||||
* @param {number} y - The Camera's new scrollY coordinate.
|
* @param {number} y - The Camera's new scrollY coordinate.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -80,7 +80,7 @@ var Shake = new Class({
|
||||||
* If this effect is running this holds the current percentage of the progress, a value between 0 and 1.
|
* If this effect is running this holds the current percentage of the progress, a value between 0 and 1.
|
||||||
*
|
*
|
||||||
* @name Phaser.Cameras.Scene2D.Effects.Shake#progress
|
* @name Phaser.Cameras.Scene2D.Effects.Shake#progress
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @since 3.5.0
|
* @since 3.5.0
|
||||||
*/
|
*/
|
||||||
this.progress = 0;
|
this.progress = 0;
|
||||||
|
@ -121,7 +121,7 @@ var Shake = new Class({
|
||||||
* @callback CameraShakeCallback
|
* @callback CameraShakeCallback
|
||||||
*
|
*
|
||||||
* @param {Phaser.Cameras.Scene2D.Camera} camera - The camera on which the effect is running.
|
* @param {Phaser.Cameras.Scene2D.Camera} camera - The camera on which the effect is running.
|
||||||
* @param {float} progress - The progress of the effect. A value between 0 and 1.
|
* @param {number} progress - The progress of the effect. A value between 0 and 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -153,7 +153,7 @@ var Shake = new Class({
|
||||||
* @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on.
|
* @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on.
|
||||||
* @param {Phaser.Cameras.Scene2D.Effects.Shake} effect - A reference to the effect instance.
|
* @param {Phaser.Cameras.Scene2D.Effects.Shake} effect - A reference to the effect instance.
|
||||||
* @param {integer} duration - The duration of the effect.
|
* @param {integer} duration - The duration of the effect.
|
||||||
* @param {float} intensity - The intensity of the effect.
|
* @param {number} intensity - The intensity of the effect.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -23,8 +23,8 @@ var GetValue = require('../../utils/object/GetValue');
|
||||||
* @property {Phaser.Input.Keyboard.Key} [up] - The Key to be pressed that will move the Camera up.
|
* @property {Phaser.Input.Keyboard.Key} [up] - The Key to be pressed that will move the Camera up.
|
||||||
* @property {Phaser.Input.Keyboard.Key} [zoomIn] - The Key to be pressed that will zoom the Camera in.
|
* @property {Phaser.Input.Keyboard.Key} [zoomIn] - The Key to be pressed that will zoom the Camera in.
|
||||||
* @property {Phaser.Input.Keyboard.Key} [zoomOut] - The Key to be pressed that will zoom the Camera out.
|
* @property {Phaser.Input.Keyboard.Key} [zoomOut] - The Key to be pressed that will zoom the Camera out.
|
||||||
* @property {float} [zoomSpeed=0.01] - The speed at which the camera will zoom if the `zoomIn` or `zoomOut` keys are pressed.
|
* @property {number} [zoomSpeed=0.01] - The speed at which the camera will zoom if the `zoomIn` or `zoomOut` keys are pressed.
|
||||||
* @property {(float|{x:float,y:float})} [speed=0] - The horizontal and vertical speed the camera will move.
|
* @property {(number|{x:number,y:number})} [speed=0] - The horizontal and vertical speed the camera will move.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -118,7 +118,7 @@ var FixedKeyControl = new Class({
|
||||||
* The speed at which the camera will zoom if the `zoomIn` or `zoomOut` keys are pressed.
|
* The speed at which the camera will zoom if the `zoomIn` or `zoomOut` keys are pressed.
|
||||||
*
|
*
|
||||||
* @name Phaser.Cameras.Controls.FixedKeyControl#zoomSpeed
|
* @name Phaser.Cameras.Controls.FixedKeyControl#zoomSpeed
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @default 0.01
|
* @default 0.01
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
|
@ -128,7 +128,7 @@ var FixedKeyControl = new Class({
|
||||||
* The horizontal speed the camera will move.
|
* The horizontal speed the camera will move.
|
||||||
*
|
*
|
||||||
* @name Phaser.Cameras.Controls.FixedKeyControl#speedX
|
* @name Phaser.Cameras.Controls.FixedKeyControl#speedX
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @default 0
|
* @default 0
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
|
@ -138,7 +138,7 @@ var FixedKeyControl = new Class({
|
||||||
* The vertical speed the camera will move.
|
* The vertical speed the camera will move.
|
||||||
*
|
*
|
||||||
* @name Phaser.Cameras.Controls.FixedKeyControl#speedY
|
* @name Phaser.Cameras.Controls.FixedKeyControl#speedY
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @default 0
|
* @default 0
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -30,10 +30,10 @@ var GetValue = require('../../utils/object/GetValue');
|
||||||
* @property {Phaser.Input.Keyboard.Key} [up] - The Key to be pressed that will move the Camera up.
|
* @property {Phaser.Input.Keyboard.Key} [up] - The Key to be pressed that will move the Camera up.
|
||||||
* @property {Phaser.Input.Keyboard.Key} [zoomIn] - The Key to be pressed that will zoom the Camera in.
|
* @property {Phaser.Input.Keyboard.Key} [zoomIn] - The Key to be pressed that will zoom the Camera in.
|
||||||
* @property {Phaser.Input.Keyboard.Key} [zoomOut] - The Key to be pressed that will zoom the Camera out.
|
* @property {Phaser.Input.Keyboard.Key} [zoomOut] - The Key to be pressed that will zoom the Camera out.
|
||||||
* @property {float} [zoomSpeed=0.01] - The speed at which the camera will zoom if the `zoomIn` or `zoomOut` keys are pressed.
|
* @property {number} [zoomSpeed=0.01] - The speed at which the camera will zoom if the `zoomIn` or `zoomOut` keys are pressed.
|
||||||
* @property {(float|{x:float,y:float})} [acceleration=0] - The horizontal and vertical acceleration the camera will move.
|
* @property {(number|{x:number,y:number})} [acceleration=0] - The horizontal and vertical acceleration the camera will move.
|
||||||
* @property {(float|{x:float,y:float})} [drag=0] - The horizontal and vertical drag applied to the camera when it is moving.
|
* @property {(number|{x:number,y:number})} [drag=0] - The horizontal and vertical drag applied to the camera when it is moving.
|
||||||
* @property {(float|{x:float,y:float})} [maxSpeed=0] - The maximum horizontal and vertical speed the camera will move.
|
* @property {(number|{x:number,y:number})} [maxSpeed=0] - The maximum horizontal and vertical speed the camera will move.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -127,7 +127,7 @@ var SmoothedKeyControl = new Class({
|
||||||
* The speed at which the camera will zoom if the `zoomIn` or `zoomOut` keys are pressed.
|
* The speed at which the camera will zoom if the `zoomIn` or `zoomOut` keys are pressed.
|
||||||
*
|
*
|
||||||
* @name Phaser.Cameras.Controls.SmoothedKeyControl#zoomSpeed
|
* @name Phaser.Cameras.Controls.SmoothedKeyControl#zoomSpeed
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @default 0.01
|
* @default 0.01
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
|
@ -137,7 +137,7 @@ var SmoothedKeyControl = new Class({
|
||||||
* The horizontal acceleration the camera will move.
|
* The horizontal acceleration the camera will move.
|
||||||
*
|
*
|
||||||
* @name Phaser.Cameras.Controls.SmoothedKeyControl#accelX
|
* @name Phaser.Cameras.Controls.SmoothedKeyControl#accelX
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @default 0
|
* @default 0
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
|
@ -147,7 +147,7 @@ var SmoothedKeyControl = new Class({
|
||||||
* The vertical acceleration the camera will move.
|
* The vertical acceleration the camera will move.
|
||||||
*
|
*
|
||||||
* @name Phaser.Cameras.Controls.SmoothedKeyControl#accelY
|
* @name Phaser.Cameras.Controls.SmoothedKeyControl#accelY
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @default 0
|
* @default 0
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
|
@ -170,7 +170,7 @@ var SmoothedKeyControl = new Class({
|
||||||
* The horizontal drag applied to the camera when it is moving.
|
* The horizontal drag applied to the camera when it is moving.
|
||||||
*
|
*
|
||||||
* @name Phaser.Cameras.Controls.SmoothedKeyControl#dragX
|
* @name Phaser.Cameras.Controls.SmoothedKeyControl#dragX
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @default 0
|
* @default 0
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
|
@ -180,7 +180,7 @@ var SmoothedKeyControl = new Class({
|
||||||
* The vertical drag applied to the camera when it is moving.
|
* The vertical drag applied to the camera when it is moving.
|
||||||
*
|
*
|
||||||
* @name Phaser.Cameras.Controls.SmoothedKeyControl#dragY
|
* @name Phaser.Cameras.Controls.SmoothedKeyControl#dragY
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @default 0
|
* @default 0
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
|
@ -203,7 +203,7 @@ var SmoothedKeyControl = new Class({
|
||||||
* The maximum horizontal speed the camera will move.
|
* The maximum horizontal speed the camera will move.
|
||||||
*
|
*
|
||||||
* @name Phaser.Cameras.Controls.SmoothedKeyControl#maxSpeedX
|
* @name Phaser.Cameras.Controls.SmoothedKeyControl#maxSpeedX
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @default 0
|
* @default 0
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
|
@ -213,7 +213,7 @@ var SmoothedKeyControl = new Class({
|
||||||
* The maximum vertical speed the camera will move.
|
* The maximum vertical speed the camera will move.
|
||||||
*
|
*
|
||||||
* @name Phaser.Cameras.Controls.SmoothedKeyControl#maxSpeedY
|
* @name Phaser.Cameras.Controls.SmoothedKeyControl#maxSpeedY
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @default 0
|
* @default 0
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -504,7 +504,7 @@ var Camera = new Class({
|
||||||
* @method Phaser.Cameras.Sprite3D.Camera#randomCube
|
* @method Phaser.Cameras.Sprite3D.Camera#randomCube
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} [scale=1] - [description]
|
* @param {number} [scale=1] - [description]
|
||||||
* @param {Phaser.GameObjects.Sprite3D[]} [sprites] - [description]
|
* @param {Phaser.GameObjects.Sprite3D[]} [sprites] - [description]
|
||||||
*
|
*
|
||||||
* @return {Phaser.Cameras.Sprite3D.Camera} This Camera object.
|
* @return {Phaser.Cameras.Sprite3D.Camera} This Camera object.
|
||||||
|
@ -662,7 +662,7 @@ var Camera = new Class({
|
||||||
* @method Phaser.Cameras.Sprite3D.Camera#rotate
|
* @method Phaser.Cameras.Sprite3D.Camera#rotate
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} radians - [description]
|
* @param {number} radians - [description]
|
||||||
* @param {Phaser.Math.Vector3} axis - [description]
|
* @param {Phaser.Math.Vector3} axis - [description]
|
||||||
*
|
*
|
||||||
* @return {Phaser.Cameras.Sprite3D.Camera} This Camera object.
|
* @return {Phaser.Cameras.Sprite3D.Camera} This Camera object.
|
||||||
|
@ -682,7 +682,7 @@ var Camera = new Class({
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {Phaser.Math.Vector3} point - [description]
|
* @param {Phaser.Math.Vector3} point - [description]
|
||||||
* @param {float} radians - [description]
|
* @param {number} radians - [description]
|
||||||
* @param {Phaser.Math.Vector3} axis - [description]
|
* @param {Phaser.Math.Vector3} axis - [description]
|
||||||
*
|
*
|
||||||
* @return {Phaser.Cameras.Sprite3D.Camera} This Camera object.
|
* @return {Phaser.Cameras.Sprite3D.Camera} This Camera object.
|
||||||
|
|
|
@ -60,7 +60,7 @@ var OrthographicCamera = new Class({
|
||||||
* [description]
|
* [description]
|
||||||
*
|
*
|
||||||
* @name Phaser.Cameras.Sprite3D.OrthographicCamera#_zoom
|
* @name Phaser.Cameras.Sprite3D.OrthographicCamera#_zoom
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @private
|
* @private
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -123,7 +123,7 @@ var CubicBezierCurve = new Class({
|
||||||
*
|
*
|
||||||
* @generic {Phaser.Math.Vector2} O - [out,$return]
|
* @generic {Phaser.Math.Vector2} O - [out,$return]
|
||||||
*
|
*
|
||||||
* @param {float} t - The position along the curve to return. Where 0 is the start and 1 is the end.
|
* @param {number} t - The position along the curve to return. Where 0 is the start and 1 is the end.
|
||||||
* @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created.
|
* @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created.
|
||||||
*
|
*
|
||||||
* @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned.
|
* @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned.
|
||||||
|
|
|
@ -278,7 +278,7 @@ var Curve = new Class({
|
||||||
*
|
*
|
||||||
* @generic {Phaser.Math.Vector2} O - [out,$return]
|
* @generic {Phaser.Math.Vector2} O - [out,$return]
|
||||||
*
|
*
|
||||||
* @param {float} u - [description]
|
* @param {number} u - [description]
|
||||||
* @param {Phaser.Math.Vector2} [out] - [description]
|
* @param {Phaser.Math.Vector2} [out] - [description]
|
||||||
*
|
*
|
||||||
* @return {Phaser.Math.Vector2} [description]
|
* @return {Phaser.Math.Vector2} [description]
|
||||||
|
@ -434,7 +434,7 @@ var Curve = new Class({
|
||||||
*
|
*
|
||||||
* @generic {Phaser.Math.Vector2} O - [out,$return]
|
* @generic {Phaser.Math.Vector2} O - [out,$return]
|
||||||
*
|
*
|
||||||
* @param {float} u - [description]
|
* @param {number} u - [description]
|
||||||
* @param {Phaser.Math.Vector2} [out] - [description]
|
* @param {Phaser.Math.Vector2} [out] - [description]
|
||||||
*
|
*
|
||||||
* @return {Phaser.Math.Vector2} [description]
|
* @return {Phaser.Math.Vector2} [description]
|
||||||
|
@ -456,7 +456,7 @@ var Curve = new Class({
|
||||||
* @param {integer} distance - [description]
|
* @param {integer} distance - [description]
|
||||||
* @param {integer} [divisions] - [description]
|
* @param {integer} [divisions] - [description]
|
||||||
*
|
*
|
||||||
* @return {float} [description]
|
* @return {number} [description]
|
||||||
*/
|
*/
|
||||||
getTFromDistance: function (distance, divisions)
|
getTFromDistance: function (distance, divisions)
|
||||||
{
|
{
|
||||||
|
@ -476,7 +476,7 @@ var Curve = new Class({
|
||||||
* @method Phaser.Curves.Curve#getUtoTmapping
|
* @method Phaser.Curves.Curve#getUtoTmapping
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} u - [description]
|
* @param {number} u - [description]
|
||||||
* @param {integer} distance - [description]
|
* @param {integer} distance - [description]
|
||||||
* @param {integer} [divisions] - [description]
|
* @param {integer} [divisions] - [description]
|
||||||
*
|
*
|
||||||
|
|
|
@ -207,7 +207,7 @@ var EllipseCurve = new Class({
|
||||||
*
|
*
|
||||||
* @generic {Phaser.Math.Vector2} O - [out,$return]
|
* @generic {Phaser.Math.Vector2} O - [out,$return]
|
||||||
*
|
*
|
||||||
* @param {float} t - The position along the curve to return. Where 0 is the start and 1 is the end.
|
* @param {number} t - The position along the curve to return. Where 0 is the start and 1 is the end.
|
||||||
* @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created.
|
* @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created.
|
||||||
*
|
*
|
||||||
* @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned.
|
* @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned.
|
||||||
|
|
|
@ -126,7 +126,7 @@ var LineCurve = new Class({
|
||||||
*
|
*
|
||||||
* @generic {Phaser.Math.Vector2} O - [out,$return]
|
* @generic {Phaser.Math.Vector2} O - [out,$return]
|
||||||
*
|
*
|
||||||
* @param {float} t - The position along the curve to return. Where 0 is the start and 1 is the end.
|
* @param {number} t - The position along the curve to return. Where 0 is the start and 1 is the end.
|
||||||
* @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created.
|
* @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created.
|
||||||
*
|
*
|
||||||
* @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned.
|
* @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned.
|
||||||
|
@ -155,7 +155,7 @@ var LineCurve = new Class({
|
||||||
*
|
*
|
||||||
* @generic {Phaser.Math.Vector2} O - [out,$return]
|
* @generic {Phaser.Math.Vector2} O - [out,$return]
|
||||||
*
|
*
|
||||||
* @param {float} u - The position along the curve to return. Where 0 is the start and 1 is the end.
|
* @param {number} u - The position along the curve to return. Where 0 is the start and 1 is the end.
|
||||||
* @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created.
|
* @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created.
|
||||||
*
|
*
|
||||||
* @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned.
|
* @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned.
|
||||||
|
|
|
@ -110,7 +110,7 @@ var QuadraticBezier = new Class({
|
||||||
*
|
*
|
||||||
* @generic {Phaser.Math.Vector2} O - [out,$return]
|
* @generic {Phaser.Math.Vector2} O - [out,$return]
|
||||||
*
|
*
|
||||||
* @param {float} t - The position along the curve to return. Where 0 is the start and 1 is the end.
|
* @param {number} t - The position along the curve to return. Where 0 is the start and 1 is the end.
|
||||||
* @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created.
|
* @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created.
|
||||||
*
|
*
|
||||||
* @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned.
|
* @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned.
|
||||||
|
|
|
@ -150,7 +150,7 @@ var SplineCurve = new Class({
|
||||||
*
|
*
|
||||||
* @generic {Phaser.Math.Vector2} O - [out,$return]
|
* @generic {Phaser.Math.Vector2} O - [out,$return]
|
||||||
*
|
*
|
||||||
* @param {float} t - The position along the curve to return. Where 0 is the start and 1 is the end.
|
* @param {number} t - The position along the curve to return. Where 0 is the start and 1 is the end.
|
||||||
* @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created.
|
* @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created.
|
||||||
*
|
*
|
||||||
* @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned.
|
* @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned.
|
||||||
|
|
|
@ -55,7 +55,7 @@ var MoveTo = new Class({
|
||||||
*
|
*
|
||||||
* @generic {Phaser.Math.Vector2} O - [out,$return]
|
* @generic {Phaser.Math.Vector2} O - [out,$return]
|
||||||
*
|
*
|
||||||
* @param {float} t - The position along the curve to return. Where 0 is the start and 1 is the end.
|
* @param {number} t - The position along the curve to return. Where 0 is the start and 1 is the end.
|
||||||
* @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created.
|
* @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created.
|
||||||
*
|
*
|
||||||
* @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned.
|
* @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned.
|
||||||
|
@ -75,7 +75,7 @@ var MoveTo = new Class({
|
||||||
*
|
*
|
||||||
* @generic {Phaser.Math.Vector2} O - [out,$return]
|
* @generic {Phaser.Math.Vector2} O - [out,$return]
|
||||||
*
|
*
|
||||||
* @param {float} u - [description]
|
* @param {number} u - [description]
|
||||||
* @param {Phaser.Math.Vector2} [out] - [description]
|
* @param {Phaser.Math.Vector2} [out] - [description]
|
||||||
*
|
*
|
||||||
* @return {Phaser.Math.Vector2} [description]
|
* @return {Phaser.Math.Vector2} [description]
|
||||||
|
|
|
@ -171,10 +171,10 @@ var Color = new Class({
|
||||||
* @method Phaser.Display.Color#setGLTo
|
* @method Phaser.Display.Color#setGLTo
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} red - The red color value. A number between 0 and 1.
|
* @param {number} red - The red color value. A number between 0 and 1.
|
||||||
* @param {float} green - The green color value. A number between 0 and 1.
|
* @param {number} green - The green color value. A number between 0 and 1.
|
||||||
* @param {float} blue - The blue color value. A number between 0 and 1.
|
* @param {number} blue - The blue color value. A number between 0 and 1.
|
||||||
* @param {float} [alpha=1] - The alpha value. A number between 0 and 1.
|
* @param {number} [alpha=1] - The alpha value. A number between 0 and 1.
|
||||||
*
|
*
|
||||||
* @return {Phaser.Display.Color} This Color object.
|
* @return {Phaser.Display.Color} This Color object.
|
||||||
*/
|
*/
|
||||||
|
@ -299,7 +299,7 @@ var Color = new Class({
|
||||||
* The red color value, normalized to the range 0 to 1.
|
* The red color value, normalized to the range 0 to 1.
|
||||||
*
|
*
|
||||||
* @name Phaser.Display.Color#redGL
|
* @name Phaser.Display.Color#redGL
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
redGL: {
|
redGL: {
|
||||||
|
@ -324,7 +324,7 @@ var Color = new Class({
|
||||||
* The green color value, normalized to the range 0 to 1.
|
* The green color value, normalized to the range 0 to 1.
|
||||||
*
|
*
|
||||||
* @name Phaser.Display.Color#greenGL
|
* @name Phaser.Display.Color#greenGL
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
greenGL: {
|
greenGL: {
|
||||||
|
@ -349,7 +349,7 @@ var Color = new Class({
|
||||||
* The blue color value, normalized to the range 0 to 1.
|
* The blue color value, normalized to the range 0 to 1.
|
||||||
*
|
*
|
||||||
* @name Phaser.Display.Color#blueGL
|
* @name Phaser.Display.Color#blueGL
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
blueGL: {
|
blueGL: {
|
||||||
|
@ -374,7 +374,7 @@ var Color = new Class({
|
||||||
* The alpha color value, normalized to the range 0 to 1.
|
* The alpha color value, normalized to the range 0 to 1.
|
||||||
*
|
*
|
||||||
* @name Phaser.Display.Color#alphaGL
|
* @name Phaser.Display.Color#alphaGL
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
alphaGL: {
|
alphaGL: {
|
||||||
|
|
|
@ -124,7 +124,11 @@ var GameObject = new Class({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A bitmask that controls if this Game Object is drawn by a Camera or not.
|
* A bitmask that controls if this Game Object is drawn by a Camera or not.
|
||||||
* Not usually set directly. Instead call `Camera.ignore`.
|
* Not usually set directly, instead call `Camera.ignore`, however you can
|
||||||
|
* set this property directly using the Camera.id property:
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* this.cameraFilter |= camera.id
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.GameObject#cameraFilter
|
* @name Phaser.GameObjects.GameObject#cameraFilter
|
||||||
* @type {number}
|
* @type {number}
|
||||||
|
@ -374,7 +378,7 @@ var GameObject = new Class({
|
||||||
{
|
{
|
||||||
if (this.input)
|
if (this.input)
|
||||||
{
|
{
|
||||||
this.input.enabled = (this.input.enabled) ? false : true;
|
this.input.enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -26,7 +26,7 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc
|
||||||
var text = src.text;
|
var text = src.text;
|
||||||
var textLength = text.length;
|
var textLength = text.length;
|
||||||
|
|
||||||
if (GameObject.RENDER_MASK !== src.renderFlags || textLength === 0 || (src.cameraFilter > 0 && (src.cameraFilter & camera._id)))
|
if (GameObject.RENDER_MASK !== src.renderFlags || textLength === 0 || (src.cameraFilter > 0 && (src.cameraFilter & camera.id)))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,21 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc
|
||||||
var rotation = 0;
|
var rotation = 0;
|
||||||
var scale = (src.fontSize / src.fontData.size);
|
var scale = (src.fontSize / src.fontData.size);
|
||||||
|
|
||||||
|
// Alpha
|
||||||
|
|
||||||
|
var alpha = camera.alpha * src.alpha;
|
||||||
|
|
||||||
|
if (alpha === 0)
|
||||||
|
{
|
||||||
|
// Nothing to see, so abort early
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (renderer.currentAlpha !== alpha)
|
||||||
|
{
|
||||||
|
renderer.currentAlpha = alpha;
|
||||||
|
ctx.globalAlpha = alpha;
|
||||||
|
}
|
||||||
|
|
||||||
// Blend Mode
|
// Blend Mode
|
||||||
if (renderer.currentBlendMode !== src.blendMode)
|
if (renderer.currentBlendMode !== src.blendMode)
|
||||||
{
|
{
|
||||||
|
@ -112,8 +127,6 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc
|
||||||
ctx.clip();
|
ctx.clip();
|
||||||
}
|
}
|
||||||
|
|
||||||
var roundPixels = renderer.config.roundPixels;
|
|
||||||
|
|
||||||
for (var index = 0; index < textLength; ++index)
|
for (var index = 0; index < textLength; ++index)
|
||||||
{
|
{
|
||||||
// Reset the scale (in case the callback changed it)
|
// Reset the scale (in case the callback changed it)
|
||||||
|
@ -171,7 +184,7 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc
|
||||||
x -= cameraScrollX;
|
x -= cameraScrollX;
|
||||||
y -= cameraScrollY;
|
y -= cameraScrollY;
|
||||||
|
|
||||||
if (roundPixels)
|
if (camera.roundPixels)
|
||||||
{
|
{
|
||||||
x |= 0;
|
x |= 0;
|
||||||
y |= 0;
|
y |= 0;
|
||||||
|
|
|
@ -26,7 +26,7 @@ var BitmapTextCanvasRenderer = function (renderer, src, interpolationPercentage,
|
||||||
var text = src.text;
|
var text = src.text;
|
||||||
var textLength = text.length;
|
var textLength = text.length;
|
||||||
|
|
||||||
if (GameObject.RENDER_MASK !== src.renderFlags || textLength === 0 || (src.cameraFilter > 0 && (src.cameraFilter & camera._id)))
|
if (GameObject.RENDER_MASK !== src.renderFlags || textLength === 0 || (src.cameraFilter > 0 && (src.cameraFilter & camera.id)))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -63,6 +63,21 @@ var BitmapTextCanvasRenderer = function (renderer, src, interpolationPercentage,
|
||||||
|
|
||||||
var scale = (src.fontSize / src.fontData.size);
|
var scale = (src.fontSize / src.fontData.size);
|
||||||
|
|
||||||
|
// Alpha
|
||||||
|
|
||||||
|
var alpha = camera.alpha * src.alpha;
|
||||||
|
|
||||||
|
if (alpha === 0)
|
||||||
|
{
|
||||||
|
// Nothing to see, so abort early
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (renderer.currentAlpha !== alpha)
|
||||||
|
{
|
||||||
|
renderer.currentAlpha = alpha;
|
||||||
|
ctx.globalAlpha = alpha;
|
||||||
|
}
|
||||||
|
|
||||||
// Blend Mode
|
// Blend Mode
|
||||||
if (renderer.currentBlendMode !== src.blendMode)
|
if (renderer.currentBlendMode !== src.blendMode)
|
||||||
{
|
{
|
||||||
|
@ -70,25 +85,16 @@ var BitmapTextCanvasRenderer = function (renderer, src, interpolationPercentage,
|
||||||
ctx.globalCompositeOperation = renderer.blendModes[src.blendMode];
|
ctx.globalCompositeOperation = renderer.blendModes[src.blendMode];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Alpha
|
|
||||||
if (renderer.currentAlpha !== src.alpha)
|
|
||||||
{
|
|
||||||
renderer.currentAlpha = src.alpha;
|
|
||||||
ctx.globalAlpha = src.alpha;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Smoothing
|
// Smoothing
|
||||||
if (renderer.currentScaleMode !== src.scaleMode)
|
if (renderer.currentScaleMode !== src.scaleMode)
|
||||||
{
|
{
|
||||||
renderer.currentScaleMode = src.scaleMode;
|
renderer.currentScaleMode = src.scaleMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
var roundPixels = renderer.config.roundPixels;
|
|
||||||
|
|
||||||
var tx = (src.x - camera.scrollX * src.scrollFactorX) + src.frame.x;
|
var tx = (src.x - camera.scrollX * src.scrollFactorX) + src.frame.x;
|
||||||
var ty = (src.y - camera.scrollY * src.scrollFactorY) + src.frame.y;
|
var ty = (src.y - camera.scrollY * src.scrollFactorY) + src.frame.y;
|
||||||
|
|
||||||
if (roundPixels)
|
if (camera.roundPixels)
|
||||||
{
|
{
|
||||||
tx |= 0;
|
tx |= 0;
|
||||||
ty |= 0;
|
ty |= 0;
|
||||||
|
@ -159,7 +165,7 @@ var BitmapTextCanvasRenderer = function (renderer, src, interpolationPercentage,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (roundPixels)
|
if (camera.roundPixels)
|
||||||
{
|
{
|
||||||
x |= 0;
|
x |= 0;
|
||||||
y |= 0;
|
y |= 0;
|
||||||
|
|
|
@ -23,16 +23,34 @@ var GameObject = require('../GameObject');
|
||||||
*/
|
*/
|
||||||
var BlitterCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
var BlitterCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||||
{
|
{
|
||||||
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera._id)))
|
var list = src.getRenderList();
|
||||||
|
|
||||||
|
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera.id)) || list.length === 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var list = src.getRenderList();
|
var ctx = renderer.gameContext;
|
||||||
|
|
||||||
|
// Alpha
|
||||||
|
|
||||||
|
var alpha = camera.alpha * src.alpha;
|
||||||
|
|
||||||
|
if (alpha === 0)
|
||||||
|
{
|
||||||
|
// Nothing to see, so abort early
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (renderer.currentAlpha !== alpha)
|
||||||
|
{
|
||||||
|
renderer.currentAlpha = alpha;
|
||||||
|
ctx.globalAlpha = alpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Blend Mode
|
||||||
|
|
||||||
renderer.setBlendMode(src.blendMode);
|
renderer.setBlendMode(src.blendMode);
|
||||||
|
|
||||||
var ctx = renderer.gameContext;
|
|
||||||
var cameraScrollX = src.x - camera.scrollX * src.scrollFactorX;
|
var cameraScrollX = src.x - camera.scrollX * src.scrollFactorX;
|
||||||
var cameraScrollY = src.y - camera.scrollY * src.scrollFactorY;
|
var cameraScrollY = src.y - camera.scrollY * src.scrollFactorY;
|
||||||
|
|
||||||
|
@ -56,6 +74,18 @@ var BlitterCanvasRenderer = function (renderer, src, interpolationPercentage, ca
|
||||||
var fx = 1;
|
var fx = 1;
|
||||||
var fy = 1;
|
var fy = 1;
|
||||||
|
|
||||||
|
var bobAlpha = bob.alpha * alpha;
|
||||||
|
|
||||||
|
if (bobAlpha === 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (renderer.currentAlpha !== bobAlpha)
|
||||||
|
{
|
||||||
|
renderer.currentAlpha = bobAlpha;
|
||||||
|
ctx.globalAlpha = bobAlpha;
|
||||||
|
}
|
||||||
|
|
||||||
if (!flip)
|
if (!flip)
|
||||||
{
|
{
|
||||||
renderer.blitImage(dx + bob.x + cameraScrollX, dy + bob.y + cameraScrollY, bob.frame);
|
renderer.blitImage(dx + bob.x + cameraScrollX, dy + bob.y + cameraScrollY, bob.frame);
|
||||||
|
|
|
@ -291,7 +291,7 @@ var Bob = new Class({
|
||||||
* @method Phaser.GameObjects.Blitter.Bob#setAlpha
|
* @method Phaser.GameObjects.Blitter.Bob#setAlpha
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} value - The alpha value used for this Bob. Between 0 and 1.
|
* @param {number} value - The alpha value used for this Bob. Between 0 and 1.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object.
|
* @return {Phaser.GameObjects.Blitter.Bob} This Bob Game Object.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -23,7 +23,7 @@ var Alpha = {
|
||||||
* Private internal value. Holds the global alpha value.
|
* Private internal value. Holds the global alpha value.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Components.Alpha#_alpha
|
* @name Phaser.GameObjects.Components.Alpha#_alpha
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @private
|
* @private
|
||||||
* @default 1
|
* @default 1
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
|
@ -34,7 +34,7 @@ var Alpha = {
|
||||||
* Private internal value. Holds the top-left alpha value.
|
* Private internal value. Holds the top-left alpha value.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Components.Alpha#_alphaTL
|
* @name Phaser.GameObjects.Components.Alpha#_alphaTL
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @private
|
* @private
|
||||||
* @default 1
|
* @default 1
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
|
@ -45,7 +45,7 @@ var Alpha = {
|
||||||
* Private internal value. Holds the top-right alpha value.
|
* Private internal value. Holds the top-right alpha value.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Components.Alpha#_alphaTR
|
* @name Phaser.GameObjects.Components.Alpha#_alphaTR
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @private
|
* @private
|
||||||
* @default 1
|
* @default 1
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
|
@ -56,7 +56,7 @@ var Alpha = {
|
||||||
* Private internal value. Holds the bottom-left alpha value.
|
* Private internal value. Holds the bottom-left alpha value.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Components.Alpha#_alphaBL
|
* @name Phaser.GameObjects.Components.Alpha#_alphaBL
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @private
|
* @private
|
||||||
* @default 1
|
* @default 1
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
|
@ -67,7 +67,7 @@ var Alpha = {
|
||||||
* Private internal value. Holds the bottom-right alpha value.
|
* Private internal value. Holds the bottom-right alpha value.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Components.Alpha#_alphaBR
|
* @name Phaser.GameObjects.Components.Alpha#_alphaBR
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @private
|
* @private
|
||||||
* @default 1
|
* @default 1
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
|
@ -99,10 +99,10 @@ var Alpha = {
|
||||||
* @method Phaser.GameObjects.Components.Alpha#setAlpha
|
* @method Phaser.GameObjects.Components.Alpha#setAlpha
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} [topLeft=1] - The alpha value used for the top-left of the Game Object. If this is the only value given it's applied across the whole Game Object.
|
* @param {number} [topLeft=1] - The alpha value used for the top-left of the Game Object. If this is the only value given it's applied across the whole Game Object.
|
||||||
* @param {float} [topRight] - The alpha value used for the top-right of the Game Object. WebGL only.
|
* @param {number} [topRight] - The alpha value used for the top-right of the Game Object. WebGL only.
|
||||||
* @param {float} [bottomLeft] - The alpha value used for the bottom-left of the Game Object. WebGL only.
|
* @param {number} [bottomLeft] - The alpha value used for the bottom-left of the Game Object. WebGL only.
|
||||||
* @param {float} [bottomRight] - The alpha value used for the bottom-right of the Game Object. WebGL only.
|
* @param {number} [bottomRight] - The alpha value used for the bottom-right of the Game Object. WebGL only.
|
||||||
*
|
*
|
||||||
* @return {this} This Game Object instance.
|
* @return {this} This Game Object instance.
|
||||||
*/
|
*/
|
||||||
|
@ -132,7 +132,7 @@ var Alpha = {
|
||||||
* This is a global value, impacting the entire Game Object, not just a region of it.
|
* This is a global value, impacting the entire Game Object, not just a region of it.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Components.Alpha#alpha
|
* @name Phaser.GameObjects.Components.Alpha#alpha
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
alpha: {
|
alpha: {
|
||||||
|
@ -169,7 +169,7 @@ var Alpha = {
|
||||||
* This value is interpolated from the corner to the center of the Game Object.
|
* This value is interpolated from the corner to the center of the Game Object.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Components.Alpha#alphaTopLeft
|
* @name Phaser.GameObjects.Components.Alpha#alphaTopLeft
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @webglOnly
|
* @webglOnly
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
|
@ -199,7 +199,7 @@ var Alpha = {
|
||||||
* This value is interpolated from the corner to the center of the Game Object.
|
* This value is interpolated from the corner to the center of the Game Object.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Components.Alpha#alphaTopRight
|
* @name Phaser.GameObjects.Components.Alpha#alphaTopRight
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @webglOnly
|
* @webglOnly
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
|
@ -229,7 +229,7 @@ var Alpha = {
|
||||||
* This value is interpolated from the corner to the center of the Game Object.
|
* This value is interpolated from the corner to the center of the Game Object.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Components.Alpha#alphaBottomLeft
|
* @name Phaser.GameObjects.Components.Alpha#alphaBottomLeft
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @webglOnly
|
* @webglOnly
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
|
@ -259,7 +259,7 @@ var Alpha = {
|
||||||
* This value is interpolated from the corner to the center of the Game Object.
|
* This value is interpolated from the corner to the center of the Game Object.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Components.Alpha#alphaBottomRight
|
* @name Phaser.GameObjects.Components.Alpha#alphaBottomRight
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @webglOnly
|
* @webglOnly
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -528,7 +528,7 @@ var Animation = new Class({
|
||||||
* @method Phaser.GameObjects.Components.Animation#getProgress
|
* @method Phaser.GameObjects.Components.Animation#getProgress
|
||||||
* @since 3.4.0
|
* @since 3.4.0
|
||||||
*
|
*
|
||||||
* @return {float} The progress of the current animation, between 0 and 1.
|
* @return {number} The progress of the current animation, between 0 and 1.
|
||||||
*/
|
*/
|
||||||
getProgress: function ()
|
getProgress: function ()
|
||||||
{
|
{
|
||||||
|
@ -549,7 +549,7 @@ var Animation = new Class({
|
||||||
* @method Phaser.GameObjects.Components.Animation#setProgress
|
* @method Phaser.GameObjects.Components.Animation#setProgress
|
||||||
* @since 3.4.0
|
* @since 3.4.0
|
||||||
*
|
*
|
||||||
* @param {float} [value=0] - The progress value, between 0 and 1.
|
* @param {number} [value=0] - The progress value, between 0 and 1.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component.
|
* @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -34,7 +34,7 @@ var Origin = {
|
||||||
* Setting the value to 0 means the position now relates to the left of the Game Object.
|
* Setting the value to 0 means the position now relates to the left of the Game Object.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Components.Origin#originX
|
* @name Phaser.GameObjects.Components.Origin#originX
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @default 0.5
|
* @default 0.5
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
|
@ -47,7 +47,7 @@ var Origin = {
|
||||||
* Setting the value to 0 means the position now relates to the top of the Game Object.
|
* Setting the value to 0 means the position now relates to the top of the Game Object.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Components.Origin#originY
|
* @name Phaser.GameObjects.Components.Origin#originY
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @default 0.5
|
* @default 0.5
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
|
@ -63,7 +63,7 @@ var Origin = {
|
||||||
* The displayOrigin is a pixel value, based on the size of the Game Object combined with the origin.
|
* The displayOrigin is a pixel value, based on the size of the Game Object combined with the origin.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Components.Origin#displayOriginX
|
* @name Phaser.GameObjects.Components.Origin#displayOriginX
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
displayOriginX: {
|
displayOriginX: {
|
||||||
|
@ -87,7 +87,7 @@ var Origin = {
|
||||||
* The displayOrigin is a pixel value, based on the size of the Game Object combined with the origin.
|
* The displayOrigin is a pixel value, based on the size of the Game Object combined with the origin.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Components.Origin#displayOriginY
|
* @name Phaser.GameObjects.Components.Origin#displayOriginY
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
displayOriginY: {
|
displayOriginY: {
|
||||||
|
|
|
@ -15,12 +15,12 @@
|
||||||
* @property {number} scale.x - The horizontal scale of this Game Object.
|
* @property {number} scale.x - The horizontal scale of this Game Object.
|
||||||
* @property {number} scale.y - The vertical scale of this Game Object.
|
* @property {number} scale.y - The vertical scale of this Game Object.
|
||||||
* @property {object} origin - The origin of this Game Object.
|
* @property {object} origin - The origin of this Game Object.
|
||||||
* @property {float} origin.x - The horizontal origin of this Game Object.
|
* @property {number} origin.x - The horizontal origin of this Game Object.
|
||||||
* @property {float} origin.y - The vertical origin of this Game Object.
|
* @property {number} origin.y - The vertical origin of this Game Object.
|
||||||
* @property {boolean} flipX - The horizontally flipped state of the Game Object.
|
* @property {boolean} flipX - The horizontally flipped state of the Game Object.
|
||||||
* @property {boolean} flipY - The vertically flipped state of the Game Object.
|
* @property {boolean} flipY - The vertically flipped state of the Game Object.
|
||||||
* @property {number} rotation - The angle of this Game Object in radians.
|
* @property {number} rotation - The angle of this Game Object in radians.
|
||||||
* @property {float} alpha - The alpha value of the Game Object.
|
* @property {number} alpha - The alpha value of the Game Object.
|
||||||
* @property {boolean} visible - The visible state of the Game Object.
|
* @property {boolean} visible - The visible state of the Game Object.
|
||||||
* @property {integer} scaleMode - The Scale Mode being used by this Game Object.
|
* @property {integer} scaleMode - The Scale Mode being used by this Game Object.
|
||||||
* @property {(integer|string)} blendMode - Sets the Blend Mode being used by this Game Object.
|
* @property {(integer|string)} blendMode - Sets the Blend Mode being used by this Game Object.
|
||||||
|
|
|
@ -25,7 +25,7 @@ var Transform = {
|
||||||
* Private internal value. Holds the horizontal scale value.
|
* Private internal value. Holds the horizontal scale value.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Components.Transform#_scaleX
|
* @name Phaser.GameObjects.Components.Transform#_scaleX
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @private
|
* @private
|
||||||
* @default 1
|
* @default 1
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
|
@ -36,7 +36,7 @@ var Transform = {
|
||||||
* Private internal value. Holds the vertical scale value.
|
* Private internal value. Holds the vertical scale value.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Components.Transform#_scaleY
|
* @name Phaser.GameObjects.Components.Transform#_scaleY
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @private
|
* @private
|
||||||
* @default 1
|
* @default 1
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
|
@ -47,7 +47,7 @@ var Transform = {
|
||||||
* Private internal value. Holds the rotation value in radians.
|
* Private internal value. Holds the rotation value in radians.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Components.Transform#_rotation
|
* @name Phaser.GameObjects.Components.Transform#_rotation
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @private
|
* @private
|
||||||
* @default 0
|
* @default 0
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
|
|
|
@ -79,6 +79,7 @@ var Container = new Class({
|
||||||
Components.BlendMode,
|
Components.BlendMode,
|
||||||
Components.ComputedSize,
|
Components.ComputedSize,
|
||||||
Components.Depth,
|
Components.Depth,
|
||||||
|
Components.Mask,
|
||||||
Components.ScrollFactor,
|
Components.ScrollFactor,
|
||||||
Components.Transform,
|
Components.Transform,
|
||||||
Components.Visible,
|
Components.Visible,
|
||||||
|
|
|
@ -26,7 +26,7 @@ var GameObject = require('../GameObject');
|
||||||
*/
|
*/
|
||||||
var GraphicsCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix, renderTargetCtx, allowClip)
|
var GraphicsCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix, renderTargetCtx, allowClip)
|
||||||
{
|
{
|
||||||
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera._id)))
|
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera.id)))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,21 @@ var GraphicsCanvasRenderer = function (renderer, src, interpolationPercentage, c
|
||||||
var green = 0;
|
var green = 0;
|
||||||
var blue = 0;
|
var blue = 0;
|
||||||
|
|
||||||
|
// Alpha
|
||||||
|
|
||||||
|
var alpha = camera.alpha * src.alpha;
|
||||||
|
|
||||||
|
if (alpha === 0)
|
||||||
|
{
|
||||||
|
// Nothing to see, so abort early
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (renderer.currentAlpha !== alpha)
|
||||||
|
{
|
||||||
|
renderer.currentAlpha = alpha;
|
||||||
|
ctx.globalAlpha = alpha;
|
||||||
|
}
|
||||||
|
|
||||||
// Blend Mode
|
// Blend Mode
|
||||||
if (renderer.currentBlendMode !== src.blendMode)
|
if (renderer.currentBlendMode !== src.blendMode)
|
||||||
{
|
{
|
||||||
|
@ -56,13 +71,6 @@ var GraphicsCanvasRenderer = function (renderer, src, interpolationPercentage, c
|
||||||
ctx.globalCompositeOperation = renderer.blendModes[src.blendMode];
|
ctx.globalCompositeOperation = renderer.blendModes[src.blendMode];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Alpha
|
|
||||||
if (renderer.currentAlpha !== src.alpha)
|
|
||||||
{
|
|
||||||
renderer.currentAlpha = src.alpha;
|
|
||||||
ctx.globalAlpha = src.alpha;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Smoothing
|
// Smoothing
|
||||||
if (renderer.currentScaleMode !== src.scaleMode)
|
if (renderer.currentScaleMode !== src.scaleMode)
|
||||||
{
|
{
|
||||||
|
@ -70,11 +78,14 @@ var GraphicsCanvasRenderer = function (renderer, src, interpolationPercentage, c
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.save();
|
ctx.save();
|
||||||
|
|
||||||
if (parentMatrix)
|
if (parentMatrix)
|
||||||
{
|
{
|
||||||
var matrix = parentMatrix.matrix;
|
var matrix = parentMatrix.matrix;
|
||||||
|
|
||||||
ctx.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
|
ctx.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.translate(srcX - cameraScrollX, srcY - cameraScrollY);
|
ctx.translate(srcX - cameraScrollX, srcY - cameraScrollY);
|
||||||
ctx.rotate(srcRotation);
|
ctx.rotate(srcRotation);
|
||||||
ctx.scale(srcScaleX, srcScaleY);
|
ctx.scale(srcScaleX, srcScaleY);
|
||||||
|
@ -253,10 +264,6 @@ var GraphicsCanvasRenderer = function (renderer, src, interpolationPercentage, c
|
||||||
);
|
);
|
||||||
index += 1;
|
index += 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
|
||||||
// console.error('Phaser: Invalid Graphics Command ID ' + commandID);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ var GameObject = require('../GameObject');
|
||||||
*/
|
*/
|
||||||
var ImageCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
var ImageCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||||
{
|
{
|
||||||
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera._id)))
|
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera.id)))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ var GameObject = require('../GameObject');
|
||||||
*/
|
*/
|
||||||
var ImageWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
var ImageWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||||
{
|
{
|
||||||
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera._id)))
|
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera.id)))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ var LightsManager = new Class({
|
||||||
* The ambient color.
|
* The ambient color.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.LightsManager#ambientColor
|
* @name Phaser.GameObjects.LightsManager#ambientColor
|
||||||
* @type {{ r: float, g: float, b: float }}
|
* @type {{ r: number, g: number, b: number }}
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
this.ambientColor = { r: 0.1, g: 0.1, b: 0.1 };
|
this.ambientColor = { r: 0.1, g: 0.1, b: 0.1 };
|
||||||
|
|
|
@ -18,10 +18,10 @@ var GameObjectFactory = require('../GameObjectFactory');
|
||||||
*
|
*
|
||||||
* @param {number} x - The horizontal position of this Game Object in the world.
|
* @param {number} x - The horizontal position of this Game Object in the world.
|
||||||
* @param {number} y - The vertical position of this Game Object in the world.
|
* @param {number} y - The vertical position of this Game Object in the world.
|
||||||
* @param {float[]} vertices - An array containing the vertices data for this Mesh.
|
* @param {number[]} vertices - An array containing the vertices data for this Mesh.
|
||||||
* @param {float[]} uv - An array containing the uv data for this Mesh.
|
* @param {number[]} uv - An array containing the uv data for this Mesh.
|
||||||
* @param {float[]} colors - An array containing the color data for this Mesh.
|
* @param {number[]} colors - An array containing the color data for this Mesh.
|
||||||
* @param {float[]} alphas - An array containing the alpha data for this Mesh.
|
* @param {number[]} alphas - An array containing the alpha data for this Mesh.
|
||||||
* @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
|
* @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
|
||||||
* @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with.
|
* @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with.
|
||||||
*
|
*
|
||||||
|
|
|
@ -23,7 +23,7 @@ var GameObject = require('../GameObject');
|
||||||
*/
|
*/
|
||||||
var MeshWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
var MeshWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||||
{
|
{
|
||||||
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera._id)))
|
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera.id)))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,7 +144,7 @@ var GravityWell = new Class({
|
||||||
*
|
*
|
||||||
* @param {Phaser.GameObjects.Particles.Particle} particle - The Particle to update.
|
* @param {Phaser.GameObjects.Particles.Particle} particle - The Particle to update.
|
||||||
* @param {number} delta - The delta time in ms.
|
* @param {number} delta - The delta time in ms.
|
||||||
* @param {float} step - The delta value divided by 1000.
|
* @param {number} step - The delta value divided by 1000.
|
||||||
*/
|
*/
|
||||||
update: function (particle, delta)
|
update: function (particle, delta)
|
||||||
{
|
{
|
||||||
|
|
|
@ -156,7 +156,7 @@ var Particle = new Class({
|
||||||
* The horizontal scale of this Particle.
|
* The horizontal scale of this Particle.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Particles.Particle#scaleX
|
* @name Phaser.GameObjects.Particles.Particle#scaleX
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @default 1
|
* @default 1
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
|
@ -166,7 +166,7 @@ var Particle = new Class({
|
||||||
* The vertical scale of this Particle.
|
* The vertical scale of this Particle.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Particles.Particle#scaleY
|
* @name Phaser.GameObjects.Particles.Particle#scaleY
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @default 1
|
* @default 1
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
|
@ -176,7 +176,7 @@ var Particle = new Class({
|
||||||
* The alpha value of this Particle.
|
* The alpha value of this Particle.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Particles.Particle#alpha
|
* @name Phaser.GameObjects.Particles.Particle#alpha
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @default 1
|
* @default 1
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
|
@ -255,7 +255,7 @@ var Particle = new Class({
|
||||||
* The normalized lifespan T value, where 0 is the start and 1 is the end.
|
* The normalized lifespan T value, where 0 is the start and 1 is the end.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Particles.Particle#lifeT
|
* @name Phaser.GameObjects.Particles.Particle#lifeT
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @default 0
|
* @default 0
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
|
@ -412,7 +412,7 @@ var Particle = new Class({
|
||||||
*
|
*
|
||||||
* @param {Phaser.GameObjects.Particles.ParticleEmitter} emitter - The Emitter that is updating this Particle.
|
* @param {Phaser.GameObjects.Particles.ParticleEmitter} emitter - The Emitter that is updating this Particle.
|
||||||
* @param {number} delta - The delta time in ms.
|
* @param {number} delta - The delta time in ms.
|
||||||
* @param {float} step - The delta value divided by 1000.
|
* @param {number} step - The delta value divided by 1000.
|
||||||
* @param {array} processors - Particle processors (gravity wells).
|
* @param {array} processors - Particle processors (gravity wells).
|
||||||
*/
|
*/
|
||||||
computeVelocity: function (emitter, delta, step, processors)
|
computeVelocity: function (emitter, delta, step, processors)
|
||||||
|
@ -514,7 +514,7 @@ var Particle = new Class({
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {number} delta - The delta time in ms.
|
* @param {number} delta - The delta time in ms.
|
||||||
* @param {float} step - The delta value divided by 1000.
|
* @param {number} step - The delta value divided by 1000.
|
||||||
* @param {array} processors - An optional array of update processors.
|
* @param {array} processors - An optional array of update processors.
|
||||||
*
|
*
|
||||||
* @return {boolean} Returns `true` if this Particle has now expired and should be removed, otherwise `false` if still active.
|
* @return {boolean} Returns `true` if this Particle has now expired and should be removed, otherwise `false` if still active.
|
||||||
|
|
|
@ -625,7 +625,7 @@ var ParticleEmitter = new Class({
|
||||||
* Calling {@link Phaser.GameObjects.Particles.ParticleEmitter#explode} also puts the emitter in explode mode (frequency = -1).
|
* Calling {@link Phaser.GameObjects.Particles.ParticleEmitter#explode} also puts the emitter in explode mode (frequency = -1).
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Particles.ParticleEmitter#frequency
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#frequency
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @default 0
|
* @default 0
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
* @see Phaser.GameObjects.Particles.ParticleEmitter#setFrequency
|
* @see Phaser.GameObjects.Particles.ParticleEmitter#setFrequency
|
||||||
|
@ -635,7 +635,7 @@ var ParticleEmitter = new Class({
|
||||||
/**
|
/**
|
||||||
* Controls if the emitter is currently emitting a particle flow (when frequency >= 0).
|
* Controls if the emitter is currently emitting a particle flow (when frequency >= 0).
|
||||||
* Already alive particles will continue to update until they expire.
|
* Already alive particles will continue to update until they expire.
|
||||||
* Controlled by {@link Phaser.GameObjects.Particles.ParticleEmitter#start}.
|
* Controlled by {@link Phaser.GameObjects.Particles.ParticleEmitter#start} and {@link Phaser.GameObjects.Particles.ParticleEmitter#stop}.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Particles.ParticleEmitter#on
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#on
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
|
@ -1207,8 +1207,8 @@ var ParticleEmitter = new Class({
|
||||||
* @method Phaser.GameObjects.Particles.ParticleEmitter#setPosition
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setPosition
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float|float[]|EmitterOpOnEmitCallback|object} x - The x-coordinate of the particle origin.
|
* @param {number|float[]|EmitterOpOnEmitCallback|object} x - The x-coordinate of the particle origin.
|
||||||
* @param {float|float[]|EmitterOpOnEmitCallback|object} y - The y-coordinate of the particle origin.
|
* @param {number|float[]|EmitterOpOnEmitCallback|object} y - The y-coordinate of the particle origin.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
||||||
*/
|
*/
|
||||||
|
@ -1229,9 +1229,9 @@ var ParticleEmitter = new Class({
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {(number|ParticleEmitterBounds|ParticleEmitterBoundsAlt)} x - The x-coordinate of the left edge of the boundary, or an object representing a rectangle.
|
* @param {(number|ParticleEmitterBounds|ParticleEmitterBoundsAlt)} x - The x-coordinate of the left edge of the boundary, or an object representing a rectangle.
|
||||||
* @param {float} y - The y-coordinate of the top edge of the boundary.
|
* @param {number} y - The y-coordinate of the top edge of the boundary.
|
||||||
* @param {float} width - The width of the boundary.
|
* @param {number} width - The width of the boundary.
|
||||||
* @param {float} height - The height of the boundary.
|
* @param {number} height - The height of the boundary.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
||||||
*/
|
*/
|
||||||
|
@ -1266,7 +1266,7 @@ var ParticleEmitter = new Class({
|
||||||
* @method Phaser.GameObjects.Particles.ParticleEmitter#setSpeedX
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setSpeedX
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float|float[]|EmitterOpOnEmitCallback|object} value - The speed, in pixels per second.
|
* @param {number|float[]|EmitterOpOnEmitCallback|object} value - The speed, in pixels per second.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
||||||
*/
|
*/
|
||||||
|
@ -1287,7 +1287,7 @@ var ParticleEmitter = new Class({
|
||||||
* @method Phaser.GameObjects.Particles.ParticleEmitter#setSpeedY
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setSpeedY
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float|float[]|EmitterOpOnEmitCallback|object} value - The speed, in pixels per second.
|
* @param {number|float[]|EmitterOpOnEmitCallback|object} value - The speed, in pixels per second.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
||||||
*/
|
*/
|
||||||
|
@ -1311,7 +1311,7 @@ var ParticleEmitter = new Class({
|
||||||
* @method Phaser.GameObjects.Particles.ParticleEmitter#setSpeed
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setSpeed
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float|float[]|EmitterOpOnEmitCallback|object} value - The speed, in pixels per second.
|
* @param {number|float[]|EmitterOpOnEmitCallback|object} value - The speed, in pixels per second.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
||||||
*/
|
*/
|
||||||
|
@ -1332,7 +1332,7 @@ var ParticleEmitter = new Class({
|
||||||
* @method Phaser.GameObjects.Particles.ParticleEmitter#setScaleX
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setScaleX
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float|float[]|EmitterOpOnUpdateCallback|object} value - The scale, relative to 1.
|
* @param {number|float[]|EmitterOpOnUpdateCallback|object} value - The scale, relative to 1.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
||||||
*/
|
*/
|
||||||
|
@ -1349,7 +1349,7 @@ var ParticleEmitter = new Class({
|
||||||
* @method Phaser.GameObjects.Particles.ParticleEmitter#setScaleY
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setScaleY
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float|float[]|EmitterOpOnUpdateCallback|object} value - The scale, relative to 1.
|
* @param {number|float[]|EmitterOpOnUpdateCallback|object} value - The scale, relative to 1.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
||||||
*/
|
*/
|
||||||
|
@ -1366,7 +1366,7 @@ var ParticleEmitter = new Class({
|
||||||
* @method Phaser.GameObjects.Particles.ParticleEmitter#setScale
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setScale
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float|float[]|EmitterOpOnUpdateCallback|object} value - The scale, relative to 1.
|
* @param {number|float[]|EmitterOpOnUpdateCallback|object} value - The scale, relative to 1.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
||||||
*/
|
*/
|
||||||
|
@ -1384,7 +1384,7 @@ var ParticleEmitter = new Class({
|
||||||
* @method Phaser.GameObjects.Particles.ParticleEmitter#setGravityX
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setGravityX
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} value - Acceleration due to gravity, in pixels per second squared.
|
* @param {number} value - Acceleration due to gravity, in pixels per second squared.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
||||||
*/
|
*/
|
||||||
|
@ -1401,7 +1401,7 @@ var ParticleEmitter = new Class({
|
||||||
* @method Phaser.GameObjects.Particles.ParticleEmitter#setGravityY
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setGravityY
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} value - Acceleration due to gravity, in pixels per second squared.
|
* @param {number} value - Acceleration due to gravity, in pixels per second squared.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
||||||
*/
|
*/
|
||||||
|
@ -1418,8 +1418,8 @@ var ParticleEmitter = new Class({
|
||||||
* @method Phaser.GameObjects.Particles.ParticleEmitter#setGravity
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setGravity
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} x - Horizontal acceleration due to gravity, in pixels per second squared.
|
* @param {number} x - Horizontal acceleration due to gravity, in pixels per second squared.
|
||||||
* @param {float} y - Vertical acceleration due to gravity, in pixels per second squared.
|
* @param {number} y - Vertical acceleration due to gravity, in pixels per second squared.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
||||||
*/
|
*/
|
||||||
|
@ -1437,7 +1437,7 @@ var ParticleEmitter = new Class({
|
||||||
* @method Phaser.GameObjects.Particles.ParticleEmitter#setAlpha
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setAlpha
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float|float[]|EmitterOpOnUpdateCallback|object} value - A value between 0 (transparent) and 1 (opaque).
|
* @param {number|float[]|EmitterOpOnUpdateCallback|object} value - A value between 0 (transparent) and 1 (opaque).
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
||||||
*/
|
*/
|
||||||
|
@ -1454,7 +1454,7 @@ var ParticleEmitter = new Class({
|
||||||
* @method Phaser.GameObjects.Particles.ParticleEmitter#setEmitterAngle
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setEmitterAngle
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float|float[]|EmitterOpOnEmitCallback|object} value - The angle of the initial velocity of emitted particles.
|
* @param {number|float[]|EmitterOpOnEmitCallback|object} value - The angle of the initial velocity of emitted particles.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
||||||
*/
|
*/
|
||||||
|
@ -1471,7 +1471,7 @@ var ParticleEmitter = new Class({
|
||||||
* @method Phaser.GameObjects.Particles.ParticleEmitter#setAngle
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setAngle
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float|float[]|EmitterOpOnEmitCallback|object} value - The angle of the initial velocity of emitted particles.
|
* @param {number|float[]|EmitterOpOnEmitCallback|object} value - The angle of the initial velocity of emitted particles.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
||||||
*/
|
*/
|
||||||
|
@ -1488,7 +1488,7 @@ var ParticleEmitter = new Class({
|
||||||
* @method Phaser.GameObjects.Particles.ParticleEmitter#setLifespan
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setLifespan
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float|float[]|EmitterOpOnEmitCallback|object} value - The particle lifespan, in ms.
|
* @param {number|float[]|EmitterOpOnEmitCallback|object} value - The particle lifespan, in ms.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
||||||
*/
|
*/
|
||||||
|
@ -1505,7 +1505,7 @@ var ParticleEmitter = new Class({
|
||||||
* @method Phaser.GameObjects.Particles.ParticleEmitter#setQuantity
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setQuantity
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float|float[]|EmitterOpOnEmitCallback|object} quantity - The number of particles to release at each flow cycle or explosion.
|
* @param {number|float[]|EmitterOpOnEmitCallback|object} quantity - The number of particles to release at each flow cycle or explosion.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
||||||
*/
|
*/
|
||||||
|
@ -1523,8 +1523,8 @@ var ParticleEmitter = new Class({
|
||||||
* @method Phaser.GameObjects.Particles.ParticleEmitter#setFrequency
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setFrequency
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} frequency - The time interval (>= 0) of each flow cycle, in ms; or -1 to put the emitter in explosion mode.
|
* @param {number} frequency - The time interval (>= 0) of each flow cycle, in ms; or -1 to put the emitter in explosion mode.
|
||||||
* @param {float|float[]|EmitterOpOnEmitCallback|object} [quantity] - The number of particles to release at each flow cycle or explosion.
|
* @param {number|float[]|EmitterOpOnEmitCallback|object} [quantity] - The number of particles to release at each flow cycle or explosion.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
||||||
*/
|
*/
|
||||||
|
@ -1862,6 +1862,21 @@ var ParticleEmitter = new Class({
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turns {@link Phaser.GameObjects.Particles.ParticleEmitter#on off} the emitter.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#stop
|
||||||
|
* @since 3.11.0
|
||||||
|
*
|
||||||
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
||||||
|
*/
|
||||||
|
stop: function ()
|
||||||
|
{
|
||||||
|
this.on = false;
|
||||||
|
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link Phaser.GameObjects.Particles.ParticleEmitter#active Deactivates} the emitter.
|
* {@link Phaser.GameObjects.Particles.ParticleEmitter#active Deactivates} the emitter.
|
||||||
*
|
*
|
||||||
|
@ -1915,8 +1930,8 @@ var ParticleEmitter = new Class({
|
||||||
* @method Phaser.GameObjects.Particles.ParticleEmitter#flow
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#flow
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} frequency - The time interval (>= 0) of each flow cycle, in ms.
|
* @param {number} frequency - The time interval (>= 0) of each flow cycle, in ms.
|
||||||
* @param {float|float[]|EmitterOpOnEmitCallback|object} [count=1] - The number of particles to emit at each flow cycle.
|
* @param {number|float[]|EmitterOpOnEmitCallback|object} [count=1] - The number of particles to emit at each flow cycle.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
||||||
*/
|
*/
|
||||||
|
@ -1938,8 +1953,8 @@ var ParticleEmitter = new Class({
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {integer} count - The amount of Particles to emit.
|
* @param {integer} count - The amount of Particles to emit.
|
||||||
* @param {float} x - The x coordinate to emit the Particles from.
|
* @param {number} x - The x coordinate to emit the Particles from.
|
||||||
* @param {float} y - The y coordinate to emit the Particles from.
|
* @param {number} y - The y coordinate to emit the Particles from.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Particles.Particle} The most recently emitted Particle.
|
* @return {Phaser.GameObjects.Particles.Particle} The most recently emitted Particle.
|
||||||
*/
|
*/
|
||||||
|
@ -1956,8 +1971,8 @@ var ParticleEmitter = new Class({
|
||||||
* @method Phaser.GameObjects.Particles.ParticleEmitter#emitParticleAt
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#emitParticleAt
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} [x=this.x] - The x coordinate to emit the Particles from.
|
* @param {number} [x=this.x] - The x coordinate to emit the Particles from.
|
||||||
* @param {float} [y=this.x] - The y coordinate to emit the Particles from.
|
* @param {number} [y=this.x] - The y coordinate to emit the Particles from.
|
||||||
* @param {integer} [count=this.quantity] - The number of Particles to emit.
|
* @param {integer} [count=this.quantity] - The number of Particles to emit.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Particles.Particle} The most recently emitted Particle.
|
* @return {Phaser.GameObjects.Particles.Particle} The most recently emitted Particle.
|
||||||
|
@ -1974,8 +1989,8 @@ var ParticleEmitter = new Class({
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {integer} [count=this.quantity] - The number of Particles to emit.
|
* @param {integer} [count=this.quantity] - The number of Particles to emit.
|
||||||
* @param {float} [x=this.x] - The x coordinate to emit the Particles from.
|
* @param {number} [x=this.x] - The x coordinate to emit the Particles from.
|
||||||
* @param {float} [y=this.x] - The y coordinate to emit the Particles from.
|
* @param {number} [y=this.x] - The y coordinate to emit the Particles from.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Particles.Particle} The most recently emitted Particle.
|
* @return {Phaser.GameObjects.Particles.Particle} The most recently emitted Particle.
|
||||||
*
|
*
|
||||||
|
@ -2040,7 +2055,7 @@ var ParticleEmitter = new Class({
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout.
|
* @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout.
|
||||||
* @param {float} delta - The delta time, in ms, elapsed since the last frame.
|
* @param {number} delta - The delta time, in ms, elapsed since the last frame.
|
||||||
*/
|
*/
|
||||||
preUpdate: function (time, delta)
|
preUpdate: function (time, delta)
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,9 +33,11 @@ var ParticleManagerCanvasRenderer = function (renderer, emitterManager, interpol
|
||||||
var ctx = renderer.currentContext;
|
var ctx = renderer.currentContext;
|
||||||
|
|
||||||
ctx.save();
|
ctx.save();
|
||||||
|
|
||||||
if (parentMatrix !== undefined)
|
if (parentMatrix !== undefined)
|
||||||
{
|
{
|
||||||
var matrix = parentMatrix.matrix;
|
var matrix = parentMatrix.matrix;
|
||||||
|
|
||||||
ctx.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
|
ctx.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,8 +53,8 @@ var ParticleManagerCanvasRenderer = function (renderer, emitterManager, interpol
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var lastAlpha = ctx.globalAlpha;
|
var lastAlpha = ctx.globalAlpha;
|
||||||
|
|
||||||
var cameraScrollX = camera.scrollX * emitter.scrollFactorX;
|
var cameraScrollX = camera.scrollX * emitter.scrollFactorX;
|
||||||
var cameraScrollY = camera.scrollY * emitter.scrollFactorY;
|
var cameraScrollY = camera.scrollY * emitter.scrollFactorY;
|
||||||
|
|
||||||
|
@ -62,15 +64,13 @@ var ParticleManagerCanvasRenderer = function (renderer, emitterManager, interpol
|
||||||
ctx.globalCompositeOperation = renderer.blendModes[emitter.blendMode];
|
ctx.globalCompositeOperation = renderer.blendModes[emitter.blendMode];
|
||||||
}
|
}
|
||||||
|
|
||||||
var roundPixels = renderer.config.roundPixels;
|
|
||||||
|
|
||||||
for (var index = 0; index < length; ++index)
|
for (var index = 0; index < length; ++index)
|
||||||
{
|
{
|
||||||
var particle = particles[index];
|
var particle = particles[index];
|
||||||
|
|
||||||
var alpha = ((particle.color >> 24) & 0xFF) / 255.0;
|
var particleAlpha = camera.alpha * ((particle.color >> 24) & 0xFF) / 255;
|
||||||
|
|
||||||
if (alpha <= 0)
|
if (particleAlpha <= 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -88,13 +88,13 @@ var ParticleManagerCanvasRenderer = function (renderer, emitterManager, interpol
|
||||||
var tx = particle.x - cameraScrollX;
|
var tx = particle.x - cameraScrollX;
|
||||||
var ty = particle.y - cameraScrollY;
|
var ty = particle.y - cameraScrollY;
|
||||||
|
|
||||||
if (roundPixels)
|
if (camera.roundPixels)
|
||||||
{
|
{
|
||||||
tx |= 0;
|
tx |= 0;
|
||||||
ty |= 0;
|
ty |= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.globalAlpha = alpha;
|
ctx.globalAlpha = particleAlpha;
|
||||||
|
|
||||||
ctx.save();
|
ctx.save();
|
||||||
|
|
||||||
|
|
|
@ -260,7 +260,7 @@ var Quad = new Class({
|
||||||
* The top-left alpha value of this Quad.
|
* The top-left alpha value of this Quad.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Quad#topLeftAlpha
|
* @name Phaser.GameObjects.Quad#topLeftAlpha
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
topLeftAlpha: {
|
topLeftAlpha: {
|
||||||
|
@ -282,7 +282,7 @@ var Quad = new Class({
|
||||||
* The top-right alpha value of this Quad.
|
* The top-right alpha value of this Quad.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Quad#topRightAlpha
|
* @name Phaser.GameObjects.Quad#topRightAlpha
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
topRightAlpha: {
|
topRightAlpha: {
|
||||||
|
@ -303,7 +303,7 @@ var Quad = new Class({
|
||||||
* The bottom-left alpha value of this Quad.
|
* The bottom-left alpha value of this Quad.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Quad#bottomLeftAlpha
|
* @name Phaser.GameObjects.Quad#bottomLeftAlpha
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
bottomLeftAlpha: {
|
bottomLeftAlpha: {
|
||||||
|
@ -324,7 +324,7 @@ var Quad = new Class({
|
||||||
* The bottom-right alpha value of this Quad.
|
* The bottom-right alpha value of this Quad.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Quad#bottomRightAlpha
|
* @name Phaser.GameObjects.Quad#bottomRightAlpha
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
bottomRightAlpha: {
|
bottomRightAlpha: {
|
||||||
|
|
|
@ -30,17 +30,30 @@ var RenderTextureCanvasRenderer = function (renderer, renderTexture, interpolati
|
||||||
|
|
||||||
var ctx = renderer.currentContext;
|
var ctx = renderer.currentContext;
|
||||||
|
|
||||||
|
// Alpha
|
||||||
|
|
||||||
|
var alpha = camera.alpha * renderTexture.alpha;
|
||||||
|
|
||||||
|
if (alpha === 0)
|
||||||
|
{
|
||||||
|
// Nothing to see, so abort early
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (renderer.currentAlpha !== alpha)
|
||||||
|
{
|
||||||
|
renderer.currentAlpha = alpha;
|
||||||
|
ctx.globalAlpha = alpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Blend Mode
|
||||||
|
|
||||||
if (renderer.currentBlendMode !== renderTexture.blendMode)
|
if (renderer.currentBlendMode !== renderTexture.blendMode)
|
||||||
{
|
{
|
||||||
renderer.currentBlendMode = renderTexture.blendMode;
|
renderer.currentBlendMode = renderTexture.blendMode;
|
||||||
ctx.globalCompositeOperation = renderer.blendModes[renderTexture.blendMode];
|
ctx.globalCompositeOperation = renderer.blendModes[renderTexture.blendMode];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (renderer.currentAlpha !== renderTexture.alpha)
|
// Scale Mode
|
||||||
{
|
|
||||||
renderer.currentAlpha = renderTexture.alpha;
|
|
||||||
ctx.globalAlpha = renderTexture.alpha;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (renderer.currentScaleMode !== renderTexture.scaleMode)
|
if (renderer.currentScaleMode !== renderTexture.scaleMode)
|
||||||
{
|
{
|
||||||
|
@ -74,11 +87,14 @@ var RenderTextureCanvasRenderer = function (renderer, renderTexture, interpolati
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.save();
|
ctx.save();
|
||||||
|
|
||||||
if (parentMatrix !== undefined)
|
if (parentMatrix !== undefined)
|
||||||
{
|
{
|
||||||
var matrix = parentMatrix.matrix;
|
var matrix = parentMatrix.matrix;
|
||||||
|
|
||||||
ctx.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
|
ctx.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.translate(renderTexture.x - camera.scrollX * renderTexture.scrollFactorX, renderTexture.y - camera.scrollY * renderTexture.scrollFactorY);
|
ctx.translate(renderTexture.x - camera.scrollX * renderTexture.scrollFactorX, renderTexture.y - camera.scrollY * renderTexture.scrollFactorY);
|
||||||
ctx.rotate(renderTexture.rotation);
|
ctx.rotate(renderTexture.rotation);
|
||||||
ctx.scale(renderTexture.scaleX, renderTexture.scaleY);
|
ctx.scale(renderTexture.scaleX, renderTexture.scaleY);
|
||||||
|
|
|
@ -23,7 +23,7 @@ var GameObject = require('../GameObject');
|
||||||
*/
|
*/
|
||||||
var SpriteCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
var SpriteCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||||
{
|
{
|
||||||
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera._id)))
|
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera.id)))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ var GameObject = require('../GameObject');
|
||||||
*/
|
*/
|
||||||
var SpriteWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
var SpriteWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||||
{
|
{
|
||||||
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera._id)))
|
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera.id)))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,30 +23,38 @@ var GameObject = require('../../GameObject');
|
||||||
*/
|
*/
|
||||||
var TextCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
var TextCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||||
{
|
{
|
||||||
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera._id)) || src.text === '')
|
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera.id)) || src.text === '')
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var ctx = renderer.currentContext;
|
var ctx = renderer.currentContext;
|
||||||
|
|
||||||
// var resolution = src.resolution;
|
// Alpha
|
||||||
|
|
||||||
|
var alpha = camera.alpha * src.alpha;
|
||||||
|
|
||||||
|
if (alpha === 0)
|
||||||
|
{
|
||||||
|
// Nothing to see, so abort early
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (renderer.currentAlpha !== alpha)
|
||||||
|
{
|
||||||
|
renderer.currentAlpha = alpha;
|
||||||
|
ctx.globalAlpha = alpha;
|
||||||
|
}
|
||||||
|
|
||||||
// Blend Mode
|
// Blend Mode
|
||||||
|
|
||||||
if (renderer.currentBlendMode !== src.blendMode)
|
if (renderer.currentBlendMode !== src.blendMode)
|
||||||
{
|
{
|
||||||
renderer.currentBlendMode = src.blendMode;
|
renderer.currentBlendMode = src.blendMode;
|
||||||
ctx.globalCompositeOperation = renderer.blendModes[src.blendMode];
|
ctx.globalCompositeOperation = renderer.blendModes[src.blendMode];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Alpha
|
|
||||||
if (renderer.currentAlpha !== src.alpha)
|
|
||||||
{
|
|
||||||
renderer.currentAlpha = src.alpha;
|
|
||||||
ctx.globalAlpha = src.alpha;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Smoothing
|
// Smoothing
|
||||||
|
|
||||||
if (renderer.currentScaleMode !== src.scaleMode)
|
if (renderer.currentScaleMode !== src.scaleMode)
|
||||||
{
|
{
|
||||||
renderer.currentScaleMode = src.scaleMode;
|
renderer.currentScaleMode = src.scaleMode;
|
||||||
|
@ -65,7 +73,7 @@ var TextCanvasRenderer = function (renderer, src, interpolationPercentage, camer
|
||||||
var tx = src.x - camera.scrollX * src.scrollFactorX;
|
var tx = src.x - camera.scrollX * src.scrollFactorX;
|
||||||
var ty = src.y - camera.scrollY * src.scrollFactorY;
|
var ty = src.y - camera.scrollY * src.scrollFactorY;
|
||||||
|
|
||||||
if (renderer.config.roundPixels)
|
if (camera.roundPixels)
|
||||||
{
|
{
|
||||||
tx |= 0;
|
tx |= 0;
|
||||||
ty |= 0;
|
ty |= 0;
|
||||||
|
|
|
@ -23,7 +23,7 @@ var GameObject = require('../../GameObject');
|
||||||
*/
|
*/
|
||||||
var TextWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
var TextWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||||
{
|
{
|
||||||
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera._id)) || src.text === '')
|
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera.id)) || src.text === '')
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,21 @@ var TileSpriteRender = require('./TileSpriteRender');
|
||||||
* The texture can be scrolled and scaled independently of the TileSprite itself. Textures will automatically wrap and
|
* The texture can be scrolled and scaled independently of the TileSprite itself. Textures will automatically wrap and
|
||||||
* are designed so that you can create game backdrops using seamless textures as a source.
|
* are designed so that you can create game backdrops using seamless textures as a source.
|
||||||
*
|
*
|
||||||
* [description]
|
* You shouldn't ever create a TileSprite any larger than your actual screen size. If you want to create a large repeating background
|
||||||
|
* that scrolls across the whole map of your game, then you create a TileSprite that fits the screen size and then use the `tilePosition`
|
||||||
|
* property to scroll the texture as the player moves. If you create a TileSprite that is thousands of pixels in size then it will
|
||||||
|
* consume huge amounts of memory and cause performance issues. Remember: use `tilePosition` to scroll your texture and `tileScale` to
|
||||||
|
* adjust the scale of the texture - don't resize the sprite itself or make it larger than it needs.
|
||||||
|
*
|
||||||
|
* An important note about Tile Sprites and NPOT textures: Internally, TileSprite textures use GL_REPEAT to provide
|
||||||
|
* seamless repeating of the textures. This, combined with the way in which the textures are handled in WebGL, means
|
||||||
|
* they need to be POT (power-of-two) sizes in order to wrap. If you provide a NPOT (non power-of-two) texture to a
|
||||||
|
* TileSprite it will generate a POT sized canvas and draw your texture to it, scaled up to the POT size. It's then
|
||||||
|
* scaled back down again during rendering to the original dimensions. While this works, in that it allows you to use
|
||||||
|
* any size texture for a Tile Sprite, it does mean that NPOT textures are going to appear anti-aliased when rendered,
|
||||||
|
* due to the interpolation that took place when it was resized into a POT texture. This is especially visible in
|
||||||
|
* pixel art graphics. If you notice it and it becomes an issue, the only way to avoid it is to ensure that you
|
||||||
|
* provide POT textures for Tile Sprites.
|
||||||
*
|
*
|
||||||
* @class TileSprite
|
* @class TileSprite
|
||||||
* @extends Phaser.GameObjects.GameObject
|
* @extends Phaser.GameObjects.GameObject
|
||||||
|
@ -29,6 +43,7 @@ var TileSpriteRender = require('./TileSpriteRender');
|
||||||
*
|
*
|
||||||
* @extends Phaser.GameObjects.Components.Alpha
|
* @extends Phaser.GameObjects.Components.Alpha
|
||||||
* @extends Phaser.GameObjects.Components.BlendMode
|
* @extends Phaser.GameObjects.Components.BlendMode
|
||||||
|
* @extends Phaser.GameObjects.Components.ComputedSize
|
||||||
* @extends Phaser.GameObjects.Components.Depth
|
* @extends Phaser.GameObjects.Components.Depth
|
||||||
* @extends Phaser.GameObjects.Components.Flip
|
* @extends Phaser.GameObjects.Components.Flip
|
||||||
* @extends Phaser.GameObjects.Components.GetBounds
|
* @extends Phaser.GameObjects.Components.GetBounds
|
||||||
|
@ -37,7 +52,6 @@ var TileSpriteRender = require('./TileSpriteRender');
|
||||||
* @extends Phaser.GameObjects.Components.Pipeline
|
* @extends Phaser.GameObjects.Components.Pipeline
|
||||||
* @extends Phaser.GameObjects.Components.ScaleMode
|
* @extends Phaser.GameObjects.Components.ScaleMode
|
||||||
* @extends Phaser.GameObjects.Components.ScrollFactor
|
* @extends Phaser.GameObjects.Components.ScrollFactor
|
||||||
* @extends Phaser.GameObjects.Components.Size
|
|
||||||
* @extends Phaser.GameObjects.Components.Texture
|
* @extends Phaser.GameObjects.Components.Texture
|
||||||
* @extends Phaser.GameObjects.Components.Tint
|
* @extends Phaser.GameObjects.Components.Tint
|
||||||
* @extends Phaser.GameObjects.Components.Transform
|
* @extends Phaser.GameObjects.Components.Transform
|
||||||
|
@ -58,6 +72,7 @@ var TileSprite = new Class({
|
||||||
Mixins: [
|
Mixins: [
|
||||||
Components.Alpha,
|
Components.Alpha,
|
||||||
Components.BlendMode,
|
Components.BlendMode,
|
||||||
|
Components.ComputedSize,
|
||||||
Components.Depth,
|
Components.Depth,
|
||||||
Components.Flip,
|
Components.Flip,
|
||||||
Components.GetBounds,
|
Components.GetBounds,
|
||||||
|
@ -66,7 +81,6 @@ var TileSprite = new Class({
|
||||||
Components.Pipeline,
|
Components.Pipeline,
|
||||||
Components.ScaleMode,
|
Components.ScaleMode,
|
||||||
Components.ScrollFactor,
|
Components.ScrollFactor,
|
||||||
Components.Size,
|
|
||||||
Components.Texture,
|
Components.Texture,
|
||||||
Components.Tint,
|
Components.Tint,
|
||||||
Components.Transform,
|
Components.Transform,
|
||||||
|
@ -102,6 +116,26 @@ var TileSprite = new Class({
|
||||||
*/
|
*/
|
||||||
this.tilePositionY = 0;
|
this.tilePositionY = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The horizontal scale of the Tile Sprite texture.
|
||||||
|
*
|
||||||
|
* @name Phaser.GameObjects.TileSprite#tileScaleX
|
||||||
|
* @type {number}
|
||||||
|
* @default 1
|
||||||
|
* @since 3.11.0
|
||||||
|
*/
|
||||||
|
this.tileScaleX = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The vertical scale of the Tile Sprite texture.
|
||||||
|
*
|
||||||
|
* @name Phaser.GameObjects.TileSprite#tileScaleY
|
||||||
|
* @type {number}
|
||||||
|
* @default 1
|
||||||
|
* @since 3.11.0
|
||||||
|
*/
|
||||||
|
this.tileScaleY = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the Tile Sprite has changed in some way, requiring an re-render of its tile texture.
|
* Whether the Tile Sprite has changed in some way, requiring an re-render of its tile texture.
|
||||||
*
|
*
|
||||||
|
@ -116,9 +150,10 @@ var TileSprite = new Class({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The texture that the Tile Sprite is rendered to, which is then rendered to a Scene.
|
* The texture that the Tile Sprite is rendered to, which is then rendered to a Scene.
|
||||||
|
* In WebGL this is a WebGLTexture. In Canvas it's a Canvas Fill Pattern.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.TileSprite#tileTexture
|
* @name Phaser.GameObjects.TileSprite#tileTexture
|
||||||
* @type {?WebGLTexture}
|
* @type {?(WebGLTexture|CanvasPattern)}
|
||||||
* @default null
|
* @default null
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
|
@ -165,7 +200,7 @@ var TileSprite = new Class({
|
||||||
* @default null
|
* @default null
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
this.canvasPattern = null;
|
// this.canvasPattern = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Canvas that the TileSprite's texture is rendered to.
|
* The Canvas that the TileSprite's texture is rendered to.
|
||||||
|
@ -185,6 +220,14 @@ var TileSprite = new Class({
|
||||||
*/
|
*/
|
||||||
this.canvasBufferCtx = this.canvasBuffer.getContext('2d');
|
this.canvasBufferCtx = this.canvasBuffer.getContext('2d');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The previous Texture Frame being used.
|
||||||
|
*
|
||||||
|
* @name Phaser.GameObjects.Components.Texture#oldFrame
|
||||||
|
* @type {Phaser.Textures.Frame}
|
||||||
|
* @private
|
||||||
|
* @since 3.0.0
|
||||||
|
*/
|
||||||
this.oldFrame = null;
|
this.oldFrame = null;
|
||||||
|
|
||||||
this.updateTileTexture();
|
this.updateTileTexture();
|
||||||
|
@ -236,41 +279,41 @@ var TileSprite = new Class({
|
||||||
*/
|
*/
|
||||||
updateTileTexture: function ()
|
updateTileTexture: function ()
|
||||||
{
|
{
|
||||||
if (!this.dirty && this.oldFrame === this.frame)
|
var frame = this.frame;
|
||||||
|
|
||||||
|
if (!this.dirty && this.oldFrame === frame)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.oldFrame = this.frame;
|
this.oldFrame = frame;
|
||||||
|
|
||||||
this.canvasBufferCtx.clearRect(0, 0, this.canvasBuffer.width, this.canvasBuffer.height);
|
var ctx = this.canvasBufferCtx;
|
||||||
|
var canvas = this.canvasBuffer;
|
||||||
|
|
||||||
if (this.renderer.gl)
|
var fw = this.potWidth;
|
||||||
|
var fh = this.potHeight;
|
||||||
|
|
||||||
|
if (!this.renderer.gl)
|
||||||
{
|
{
|
||||||
this.canvasBufferCtx.drawImage(
|
fw = frame.cutWidth;
|
||||||
this.frame.source.image,
|
fh = frame.cutHeight;
|
||||||
this.frame.cutX, this.frame.cutY,
|
}
|
||||||
this.frame.cutWidth, this.frame.cutHeight,
|
|
||||||
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||||
|
|
||||||
|
canvas.width = fw;
|
||||||
|
canvas.height = fh;
|
||||||
|
|
||||||
|
ctx.drawImage(
|
||||||
|
frame.source.image,
|
||||||
|
frame.cutX, frame.cutY,
|
||||||
|
frame.cutWidth, frame.cutHeight,
|
||||||
0, 0,
|
0, 0,
|
||||||
this.potWidth, this.potHeight
|
fw, fh
|
||||||
);
|
);
|
||||||
|
|
||||||
this.tileTexture = this.renderer.canvasToTexture(this.canvasBuffer, this.tileTexture);
|
this.tileTexture = (this.renderer.gl) ? this.renderer.canvasToTexture(canvas, this.tileTexture) : ctx.createPattern(canvas, 'repeat');
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.canvasBuffer.width = this.frame.cutWidth;
|
|
||||||
this.canvasBuffer.height = this.frame.cutHeight;
|
|
||||||
this.canvasBufferCtx.drawImage(
|
|
||||||
this.frame.source.image,
|
|
||||||
this.frame.cutX, this.frame.cutY,
|
|
||||||
this.frame.cutWidth, this.frame.cutHeight,
|
|
||||||
0, 0,
|
|
||||||
this.frame.cutWidth, this.frame.cutHeight
|
|
||||||
);
|
|
||||||
|
|
||||||
this.canvasPattern = this.canvasBufferCtx.createPattern(this.canvasBuffer, 'repeat');
|
|
||||||
}
|
|
||||||
|
|
||||||
this.dirty = false;
|
this.dirty = false;
|
||||||
},
|
},
|
||||||
|
@ -291,7 +334,7 @@ var TileSprite = new Class({
|
||||||
|
|
||||||
CanvasPool.remove(this.canvasBuffer);
|
CanvasPool.remove(this.canvasBuffer);
|
||||||
|
|
||||||
this.canvasPattern = null;
|
this.tileTexture = null;
|
||||||
this.canvasBufferCtx = null;
|
this.canvasBufferCtx = null;
|
||||||
this.canvasBuffer = null;
|
this.canvasBuffer = null;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ var GameObject = require('../GameObject');
|
||||||
*/
|
*/
|
||||||
var TileSpriteCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
var TileSpriteCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||||
{
|
{
|
||||||
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera._id)))
|
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera.id)))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,21 @@ var TileSpriteCanvasRenderer = function (renderer, src, interpolationPercentage,
|
||||||
|
|
||||||
src.updateTileTexture();
|
src.updateTileTexture();
|
||||||
|
|
||||||
|
// Alpha
|
||||||
|
|
||||||
|
var alpha = camera.alpha * src.alpha;
|
||||||
|
|
||||||
|
if (alpha === 0)
|
||||||
|
{
|
||||||
|
// Nothing to see, so abort early
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (renderer.currentAlpha !== alpha)
|
||||||
|
{
|
||||||
|
renderer.currentAlpha = alpha;
|
||||||
|
ctx.globalAlpha = alpha;
|
||||||
|
}
|
||||||
|
|
||||||
// Blend Mode
|
// Blend Mode
|
||||||
|
|
||||||
if (renderer.currentBlendMode !== src.blendMode)
|
if (renderer.currentBlendMode !== src.blendMode)
|
||||||
|
@ -41,14 +56,6 @@ var TileSpriteCanvasRenderer = function (renderer, src, interpolationPercentage,
|
||||||
ctx.globalCompositeOperation = renderer.blendModes[src.blendMode];
|
ctx.globalCompositeOperation = renderer.blendModes[src.blendMode];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Alpha
|
|
||||||
|
|
||||||
if (renderer.currentAlpha !== src.alpha)
|
|
||||||
{
|
|
||||||
renderer.currentAlpha = src.alpha;
|
|
||||||
ctx.globalAlpha = src.alpha;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Smoothing
|
// Smoothing
|
||||||
|
|
||||||
if (renderer.currentScaleMode !== src.scaleMode)
|
if (renderer.currentScaleMode !== src.scaleMode)
|
||||||
|
@ -79,7 +86,7 @@ var TileSpriteCanvasRenderer = function (renderer, src, interpolationPercentage,
|
||||||
dy += src.height;
|
dy += src.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (renderer.config.roundPixels)
|
if (camera.roundPixels)
|
||||||
{
|
{
|
||||||
dx |= 0;
|
dx |= 0;
|
||||||
dy |= 0;
|
dy |= 0;
|
||||||
|
@ -92,6 +99,7 @@ var TileSpriteCanvasRenderer = function (renderer, src, interpolationPercentage,
|
||||||
if (parentMatrix !== undefined)
|
if (parentMatrix !== undefined)
|
||||||
{
|
{
|
||||||
var matrix = parentMatrix.matrix;
|
var matrix = parentMatrix.matrix;
|
||||||
|
|
||||||
ctx.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
|
ctx.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,9 +117,12 @@ var TileSpriteCanvasRenderer = function (renderer, src, interpolationPercentage,
|
||||||
ctx.translate(-(src.originX * src.width), -(src.originY * src.height));
|
ctx.translate(-(src.originX * src.width), -(src.originY * src.height));
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
|
|
||||||
|
ctx.scale(src.tileScaleX, src.tileScaleY);
|
||||||
|
|
||||||
ctx.translate(-this.tilePositionX, -this.tilePositionY);
|
ctx.translate(-this.tilePositionX, -this.tilePositionY);
|
||||||
ctx.fillStyle = src.canvasPattern;
|
ctx.fillStyle = src.tileTexture;
|
||||||
ctx.fillRect(this.tilePositionX, this.tilePositionY, src.width, src.height);
|
ctx.fillRect(this.tilePositionX, this.tilePositionY, src.width / src.tileScaleX, src.height / src.tileScaleY);
|
||||||
|
|
||||||
ctx.restore();
|
ctx.restore();
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var GameObject = require('../GameObject');
|
var GameObject = require('../GameObject');
|
||||||
|
var Utils = require('../../renderer/webgl/Utils');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders this Game Object with the WebGL Renderer to the given Camera.
|
* Renders this Game Object with the WebGL Renderer to the given Camera.
|
||||||
|
@ -23,14 +24,36 @@ var GameObject = require('../GameObject');
|
||||||
*/
|
*/
|
||||||
var TileSpriteWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
var TileSpriteWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||||
{
|
{
|
||||||
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera._id)))
|
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera.id)))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
src.updateTileTexture();
|
src.updateTileTexture();
|
||||||
|
|
||||||
this.pipeline.batchTileSprite(this, camera, parentMatrix);
|
var getTint = Utils.getTintAppendFloatAlpha;
|
||||||
|
|
||||||
|
this.pipeline.batchTexture(
|
||||||
|
src,
|
||||||
|
src.tileTexture,
|
||||||
|
src.frame.width * src.tileScaleX, src.frame.height * src.tileScaleY,
|
||||||
|
src.x, src.y,
|
||||||
|
src.width, src.height,
|
||||||
|
src.scaleX, src.scaleY,
|
||||||
|
src.rotation,
|
||||||
|
src.flipX, src.flipY,
|
||||||
|
src.scrollFactorX, src.scrollFactorY,
|
||||||
|
src.originX * src.width, src.originY * src.height,
|
||||||
|
0, 0, src.width, src.height,
|
||||||
|
getTint(src._tintTL, camera.alpha * src._alphaTL),
|
||||||
|
getTint(src._tintTR, camera.alpha * src._alphaTR),
|
||||||
|
getTint(src._tintBL, camera.alpha * src._alphaBL),
|
||||||
|
getTint(src._tintBR, camera.alpha * src._alphaBR),
|
||||||
|
(src.tilePositionX % src.frame.width) / src.frame.width,
|
||||||
|
(src.tilePositionY % src.frame.height) / src.frame.height,
|
||||||
|
camera,
|
||||||
|
parentMatrix
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = TileSpriteWebGLRenderer;
|
module.exports = TileSpriteWebGLRenderer;
|
||||||
|
|
|
@ -104,7 +104,7 @@ var Circle = new Class({
|
||||||
*
|
*
|
||||||
* @generic {Phaser.Geom.Point} O - [out,$return]
|
* @generic {Phaser.Geom.Point} O - [out,$return]
|
||||||
*
|
*
|
||||||
* @param {float} position - A value between 0 and 1, where 0 equals 0 degrees, 0.5 equals 180 degrees and 1 equals 360 around the circle.
|
* @param {number} position - A value between 0 and 1, where 0 equals 0 degrees, 0.5 equals 180 degrees and 1 equals 360 around the circle.
|
||||||
* @param {(Phaser.Geom.Point|object)} [out] - An object to store the return values in. If not given a Point object will be created.
|
* @param {(Phaser.Geom.Point|object)} [out] - An object to store the return values in. If not given a Point object will be created.
|
||||||
*
|
*
|
||||||
* @return {(Phaser.Geom.Point|object)} A Point, or point-like object, containing the coordinates of the point around the circle.
|
* @return {(Phaser.Geom.Point|object)} A Point, or point-like object, containing the coordinates of the point around the circle.
|
||||||
|
|
|
@ -20,7 +20,7 @@ var Point = require('../point/Point');
|
||||||
* @generic {Phaser.Geom.Point} O - [out,$return]
|
* @generic {Phaser.Geom.Point} O - [out,$return]
|
||||||
*
|
*
|
||||||
* @param {Phaser.Geom.Circle} circle - The Circle to get the circumference point on.
|
* @param {Phaser.Geom.Circle} circle - The Circle to get the circumference point on.
|
||||||
* @param {float} position - A value between 0 and 1, where 0 equals 0 degrees, 0.5 equals 180 degrees and 1 equals 360 around the circle.
|
* @param {number} position - A value between 0 and 1, where 0 equals 0 degrees, 0.5 equals 180 degrees and 1 equals 360 around the circle.
|
||||||
* @param {(Phaser.Geom.Point|object)} [out] - An object to store the return values in. If not given a Point object will be created.
|
* @param {(Phaser.Geom.Point|object)} [out] - An object to store the return values in. If not given a Point object will be created.
|
||||||
*
|
*
|
||||||
* @return {(Phaser.Geom.Point|object)} A Point, or point-like object, containing the coordinates of the point around the circle.
|
* @return {(Phaser.Geom.Point|object)} A Point, or point-like object, containing the coordinates of the point around the circle.
|
||||||
|
|
|
@ -106,7 +106,7 @@ var Ellipse = new Class({
|
||||||
*
|
*
|
||||||
* @generic {Phaser.Geom.Point} O - [out,$return]
|
* @generic {Phaser.Geom.Point} O - [out,$return]
|
||||||
*
|
*
|
||||||
* @param {float} position - A value between 0 and 1, where 0 equals 0 degrees, 0.5 equals 180 degrees and 1 equals 360 around the ellipse.
|
* @param {number} position - A value between 0 and 1, where 0 equals 0 degrees, 0.5 equals 180 degrees and 1 equals 360 around the ellipse.
|
||||||
* @param {(Phaser.Geom.Point|object)} [out] - An object to store the return values in. If not given a Point object will be created.
|
* @param {(Phaser.Geom.Point|object)} [out] - An object to store the return values in. If not given a Point object will be created.
|
||||||
*
|
*
|
||||||
* @return {(Phaser.Geom.Point|object)} A Point, or point-like object, containing the coordinates of the point around the ellipse.
|
* @return {(Phaser.Geom.Point|object)} A Point, or point-like object, containing the coordinates of the point around the ellipse.
|
||||||
|
|
|
@ -20,7 +20,7 @@ var Point = require('../point/Point');
|
||||||
* @generic {Phaser.Geom.Point} O - [out,$return]
|
* @generic {Phaser.Geom.Point} O - [out,$return]
|
||||||
*
|
*
|
||||||
* @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to get the circumference point on.
|
* @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to get the circumference point on.
|
||||||
* @param {float} position - A value between 0 and 1, where 0 equals 0 degrees, 0.5 equals 180 degrees and 1 equals 360 around the ellipse.
|
* @param {number} position - A value between 0 and 1, where 0 equals 0 degrees, 0.5 equals 180 degrees and 1 equals 360 around the ellipse.
|
||||||
* @param {(Phaser.Geom.Point|object)} [out] - An object to store the return values in. If not given a Point object will be created.
|
* @param {(Phaser.Geom.Point|object)} [out] - An object to store the return values in. If not given a Point object will be created.
|
||||||
*
|
*
|
||||||
* @return {(Phaser.Geom.Point|object)} A Point, or point-like object, containing the coordinates of the point around the ellipse.
|
* @return {(Phaser.Geom.Point|object)} A Point, or point-like object, containing the coordinates of the point around the ellipse.
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* @param {number} right - [description]
|
* @param {number} right - [description]
|
||||||
* @param {number} top - [description]
|
* @param {number} top - [description]
|
||||||
* @param {number} bottom - [description]
|
* @param {number} bottom - [description]
|
||||||
* @param {float} [tolerance=0] - [description]
|
* @param {number} [tolerance=0] - [description]
|
||||||
*
|
*
|
||||||
* @return {boolean} [description]
|
* @return {boolean} [description]
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -182,7 +182,7 @@ var Line = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a Vector2 object that corresponds to the start of this Line.
|
* Returns a Vector2 object that corresponds to the end of this Line.
|
||||||
*
|
*
|
||||||
* @method Phaser.Geom.Line#getPointB
|
* @method Phaser.Geom.Line#getPointB
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
|
@ -191,7 +191,7 @@ var Line = new Class({
|
||||||
*
|
*
|
||||||
* @param {Phaser.Math.Vector2} [vec2] - A Vector2 object to set the results in. If `undefined` a new Vector2 will be created.
|
* @param {Phaser.Math.Vector2} [vec2] - A Vector2 object to set the results in. If `undefined` a new Vector2 will be created.
|
||||||
*
|
*
|
||||||
* @return {Phaser.Math.Vector2} A Vector2 object that corresponds to the start of this Line.
|
* @return {Phaser.Math.Vector2} A Vector2 object that corresponds to the end of this Line.
|
||||||
*/
|
*/
|
||||||
getPointB: function (vec2)
|
getPointB: function (vec2)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,7 @@ var Point = require('./Point');
|
||||||
*
|
*
|
||||||
* @param {Phaser.Geom.Point} pointA - [description]
|
* @param {Phaser.Geom.Point} pointA - [description]
|
||||||
* @param {Phaser.Geom.Point} pointB - [description]
|
* @param {Phaser.Geom.Point} pointB - [description]
|
||||||
* @param {float} [t=0] - [description]
|
* @param {number} [t=0] - [description]
|
||||||
* @param {(Phaser.Geom.Point|object)} [out] - [description]
|
* @param {(Phaser.Geom.Point|object)} [out] - [description]
|
||||||
*
|
*
|
||||||
* @return {(Phaser.Geom.Point|object)} [description]
|
* @return {(Phaser.Geom.Point|object)} [description]
|
||||||
|
|
|
@ -16,7 +16,7 @@ var Point = require('../point/Point');
|
||||||
* @generic {Phaser.Geom.Point} O - [out,$return]
|
* @generic {Phaser.Geom.Point} O - [out,$return]
|
||||||
*
|
*
|
||||||
* @param {Phaser.Geom.Rectangle} rectangle - [description]
|
* @param {Phaser.Geom.Rectangle} rectangle - [description]
|
||||||
* @param {float} position - [description]
|
* @param {number} position - [description]
|
||||||
* @param {(Phaser.Geom.Point|object)} [out] - [description]
|
* @param {(Phaser.Geom.Point|object)} [out] - [description]
|
||||||
*
|
*
|
||||||
* @return {Phaser.Geom.Point} [description]
|
* @return {Phaser.Geom.Point} [description]
|
||||||
|
|
|
@ -101,7 +101,7 @@ var Rectangle = new Class({
|
||||||
*
|
*
|
||||||
* @generic {Phaser.Geom.Point} O - [output,$return]
|
* @generic {Phaser.Geom.Point} O - [output,$return]
|
||||||
*
|
*
|
||||||
* @param {float} position - [description]
|
* @param {number} position - [description]
|
||||||
* @param {(Phaser.Geom.Point|object)} [output] - [description]
|
* @param {(Phaser.Geom.Point|object)} [output] - [description]
|
||||||
*
|
*
|
||||||
* @return {(Phaser.Geom.Point|object)} [description]
|
* @return {(Phaser.Geom.Point|object)} [description]
|
||||||
|
|
|
@ -17,8 +17,8 @@ var Triangle = require('./Triangle');
|
||||||
*
|
*
|
||||||
* @param {array} data - A flat array of vertice coordinates like [x0,y0, x1,y1, x2,y2, ...]
|
* @param {array} data - A flat array of vertice coordinates like [x0,y0, x1,y1, x2,y2, ...]
|
||||||
* @param {array} [holes=null] - An array of hole indices if any (e.g. [5, 8] for a 12-vertice input would mean one hole with vertices 5–7 and another with 8–11).
|
* @param {array} [holes=null] - An array of hole indices if any (e.g. [5, 8] for a 12-vertice input would mean one hole with vertices 5–7 and another with 8–11).
|
||||||
* @param {float} [scaleX=1] - [description]
|
* @param {number} [scaleX=1] - [description]
|
||||||
* @param {float} [scaleY=1] - [description]
|
* @param {number} [scaleY=1] - [description]
|
||||||
* @param {(array|Phaser.Geom.Triangle[])} [out] - [description]
|
* @param {(array|Phaser.Geom.Triangle[])} [out] - [description]
|
||||||
*
|
*
|
||||||
* @return {(array|Phaser.Geom.Triangle[])} [description]
|
* @return {(array|Phaser.Geom.Triangle[])} [description]
|
||||||
|
|
|
@ -17,7 +17,7 @@ var Length = require('../line/Length');
|
||||||
* @generic {Phaser.Geom.Point} O - [out,$return]
|
* @generic {Phaser.Geom.Point} O - [out,$return]
|
||||||
*
|
*
|
||||||
* @param {Phaser.Geom.Triangle} triangle - [description]
|
* @param {Phaser.Geom.Triangle} triangle - [description]
|
||||||
* @param {float} position - [description]
|
* @param {number} position - [description]
|
||||||
* @param {(Phaser.Geom.Point|object)} [out] - [description]
|
* @param {(Phaser.Geom.Point|object)} [out] - [description]
|
||||||
*
|
*
|
||||||
* @return {(Phaser.Geom.Point|object)} [description]
|
* @return {(Phaser.Geom.Point|object)} [description]
|
||||||
|
|
|
@ -127,7 +127,7 @@ var Triangle = new Class({
|
||||||
*
|
*
|
||||||
* @generic {Phaser.Geom.Point} O - [output,$return]
|
* @generic {Phaser.Geom.Point} O - [output,$return]
|
||||||
*
|
*
|
||||||
* @param {float} position - [description]
|
* @param {number} position - [description]
|
||||||
* @param {(Phaser.Geom.Point|object)} [output] - [description]
|
* @param {(Phaser.Geom.Point|object)} [output] - [description]
|
||||||
*
|
*
|
||||||
* @return {(Phaser.Geom.Point|object)} [description]
|
* @return {(Phaser.Geom.Point|object)} [description]
|
||||||
|
|
|
@ -683,7 +683,7 @@ var InputPlugin = new Class({
|
||||||
{
|
{
|
||||||
var camera = cameras[c];
|
var camera = cameras[c];
|
||||||
|
|
||||||
// Get a list of all objects that can be seen by the camera below the pointer in the scene and store in 'output' array.
|
// Get a list of all objects that can be seen by the camera below the pointer in the scene and store in 'over' array.
|
||||||
// All objects in this array are input enabled, as checked by the hitTest method, so we don't need to check later on as well.
|
// All objects in this array are input enabled, as checked by the hitTest method, so we don't need to check later on as well.
|
||||||
var over = this.manager.hitTest(pointer, this._list, camera);
|
var over = this.manager.hitTest(pointer, this._list, camera);
|
||||||
|
|
||||||
|
@ -706,6 +706,11 @@ var InputPlugin = new Class({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we got this far then there were no Game Objects below the pointer, but it was still over
|
||||||
|
// a camera, so set that the top-most one into the pointer
|
||||||
|
|
||||||
|
pointer.camera = cameras[0];
|
||||||
|
|
||||||
return [];
|
return [];
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ var Axis = new Class({
|
||||||
* Use the method `getValue` to get a normalized value with the threshold applied.
|
* Use the method `getValue` to get a normalized value with the threshold applied.
|
||||||
*
|
*
|
||||||
* @name Phaser.Input.Gamepad.Axis#value
|
* @name Phaser.Input.Gamepad.Axis#value
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @default 0
|
* @default 0
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
|
@ -67,7 +67,7 @@ var Axis = new Class({
|
||||||
* Movement tolerance threshold below which axis values are ignored in `getValue`.
|
* Movement tolerance threshold below which axis values are ignored in `getValue`.
|
||||||
*
|
*
|
||||||
* @name Phaser.Input.Gamepad.Axis#threshold
|
* @name Phaser.Input.Gamepad.Axis#threshold
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @default 0.1
|
* @default 0.1
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
|
@ -82,7 +82,7 @@ var Axis = new Class({
|
||||||
* @private
|
* @private
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} value - The value of the axis movement.
|
* @param {number} value - The value of the axis movement.
|
||||||
*/
|
*/
|
||||||
update: function (value)
|
update: function (value)
|
||||||
{
|
{
|
||||||
|
@ -95,7 +95,7 @@ var Axis = new Class({
|
||||||
* @method Phaser.Input.Gamepad.Axis#getValue
|
* @method Phaser.Input.Gamepad.Axis#getValue
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @return {float} The axis value, adjusted for the movement threshold.
|
* @return {number} The axis value, adjusted for the movement threshold.
|
||||||
*/
|
*/
|
||||||
getValue: function ()
|
getValue: function ()
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,7 +56,7 @@ var Button = new Class({
|
||||||
* Between 0 and 1.
|
* Between 0 and 1.
|
||||||
*
|
*
|
||||||
* @name Phaser.Input.Gamepad.Button#value
|
* @name Phaser.Input.Gamepad.Button#value
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @default 0
|
* @default 0
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
|
@ -67,7 +67,7 @@ var Button = new Class({
|
||||||
* before a button is considered as being 'pressed'.
|
* before a button is considered as being 'pressed'.
|
||||||
*
|
*
|
||||||
* @name Phaser.Input.Gamepad.Button#threshold
|
* @name Phaser.Input.Gamepad.Button#threshold
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @default 1
|
* @default 1
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -180,7 +180,7 @@ var File = new Class({
|
||||||
* Only set if loading via XHR.
|
* Only set if loading via XHR.
|
||||||
*
|
*
|
||||||
* @name Phaser.Loader.File#percentComplete
|
* @name Phaser.Loader.File#percentComplete
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @default -1
|
* @default -1
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -215,7 +215,7 @@ var LoaderPlugin = new Class({
|
||||||
* Note that it is possible for this value to go down again if you add content to the current load queue during a load.
|
* Note that it is possible for this value to go down again if you add content to the current load queue during a load.
|
||||||
*
|
*
|
||||||
* @name Phaser.Loader.LoaderPlugin#progress
|
* @name Phaser.Loader.LoaderPlugin#progress
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @default 0
|
* @default 0
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
|
@ -724,7 +724,7 @@ var LoaderPlugin = new Class({
|
||||||
* a file having completed loading.
|
* a file having completed loading.
|
||||||
*
|
*
|
||||||
* @event Phaser.Loader.LoaderPlugin#progressEvent
|
* @event Phaser.Loader.LoaderPlugin#progressEvent
|
||||||
* @param {float} progress - The current progress of the load. A value between 0 and 1.
|
* @param {number} progress - The current progress of the load. A value between 0 and 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -14,7 +14,7 @@ var CONST = require('./const');
|
||||||
*
|
*
|
||||||
* @param {integer} degrees - The angle (in degrees) to convert to radians.
|
* @param {integer} degrees - The angle (in degrees) to convert to radians.
|
||||||
*
|
*
|
||||||
* @return {float} The given angle converted to radians.
|
* @return {number} The given angle converted to radians.
|
||||||
*/
|
*/
|
||||||
var DegToRad = function (degrees)
|
var DegToRad = function (degrees)
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,10 +10,10 @@
|
||||||
* @function Phaser.Math.FloatBetween
|
* @function Phaser.Math.FloatBetween
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} min - The lower bound for the float, inclusive.
|
* @param {number} min - The lower bound for the float, inclusive.
|
||||||
* @param {float} max - The upper bound for the float exclusive.
|
* @param {number} max - The upper bound for the float exclusive.
|
||||||
*
|
*
|
||||||
* @return {float} A random float within the given range.
|
* @return {number} A random float within the given range.
|
||||||
*/
|
*/
|
||||||
var FloatBetween = function (min, max)
|
var FloatBetween = function (min, max)
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,7 +12,7 @@ var Clamp = require('./Clamp');
|
||||||
* @function Phaser.Math.FromPercent
|
* @function Phaser.Math.FromPercent
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} percent - A value between 0 and 1 representing the percentage.
|
* @param {number} percent - A value between 0 and 1 representing the percentage.
|
||||||
* @param {number} min - The minimum value.
|
* @param {number} min - The minimum value.
|
||||||
* @param {number} [max] - The maximum value.
|
* @param {number} [max] - The maximum value.
|
||||||
*
|
*
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
*
|
*
|
||||||
* @param {number} p0 - The first point.
|
* @param {number} p0 - The first point.
|
||||||
* @param {number} p1 - The second point.
|
* @param {number} p1 - The second point.
|
||||||
* @param {float} t - The percentage between p0 and p1 to return, represented as a number between 0 and 1.
|
* @param {number} t - The percentage between p0 and p1 to return, represented as a number between 0 and 1.
|
||||||
*
|
*
|
||||||
* @return {number} The step t% of the way between p0 and p1.
|
* @return {number} The step t% of the way between p0 and p1.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -666,7 +666,7 @@ var Matrix4 = new Class({
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} axis - The rotation axis.
|
* @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} axis - The rotation axis.
|
||||||
* @param {float} angle - The rotation angle in radians.
|
* @param {number} angle - The rotation angle in radians.
|
||||||
*
|
*
|
||||||
* @return {Phaser.Math.Matrix4} This Matrix4.
|
* @return {Phaser.Math.Matrix4} This Matrix4.
|
||||||
*/
|
*/
|
||||||
|
@ -699,7 +699,7 @@ var Matrix4 = new Class({
|
||||||
* @method Phaser.Math.Matrix4#rotate
|
* @method Phaser.Math.Matrix4#rotate
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} rad - The angle in radians to rotate by.
|
* @param {number} rad - The angle in radians to rotate by.
|
||||||
* @param {Phaser.Math.Vector3} axis - The axis to rotate upon.
|
* @param {Phaser.Math.Vector3} axis - The axis to rotate upon.
|
||||||
*
|
*
|
||||||
* @return {Phaser.Math.Matrix4} This Matrix4.
|
* @return {Phaser.Math.Matrix4} This Matrix4.
|
||||||
|
@ -777,7 +777,7 @@ var Matrix4 = new Class({
|
||||||
* @method Phaser.Math.Matrix4#rotateX
|
* @method Phaser.Math.Matrix4#rotateX
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} rad - The angle in radians to rotate by.
|
* @param {number} rad - The angle in radians to rotate by.
|
||||||
*
|
*
|
||||||
* @return {Phaser.Math.Matrix4} This Matrix4.
|
* @return {Phaser.Math.Matrix4} This Matrix4.
|
||||||
*/
|
*/
|
||||||
|
@ -816,7 +816,7 @@ var Matrix4 = new Class({
|
||||||
* @method Phaser.Math.Matrix4#rotateY
|
* @method Phaser.Math.Matrix4#rotateY
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} rad - The angle to rotate by, in radians.
|
* @param {number} rad - The angle to rotate by, in radians.
|
||||||
*
|
*
|
||||||
* @return {Phaser.Math.Matrix4} This Matrix4.
|
* @return {Phaser.Math.Matrix4} This Matrix4.
|
||||||
*/
|
*/
|
||||||
|
@ -855,7 +855,7 @@ var Matrix4 = new Class({
|
||||||
* @method Phaser.Math.Matrix4#rotateZ
|
* @method Phaser.Math.Matrix4#rotateZ
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} rad - The angle to rotate by, in radians.
|
* @param {number} rad - The angle to rotate by, in radians.
|
||||||
*
|
*
|
||||||
* @return {Phaser.Math.Matrix4} This Matrix4.
|
* @return {Phaser.Math.Matrix4} This Matrix4.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
* @param {number} [max] - The maximum value.
|
* @param {number} [max] - The maximum value.
|
||||||
* @param {number} [upperMax] - The mid-way point in the range that represents 100%.
|
* @param {number} [upperMax] - The mid-way point in the range that represents 100%.
|
||||||
*
|
*
|
||||||
* @return {float} A value between 0 and 1 representing the percentage.
|
* @return {number} A value between 0 and 1 representing the percentage.
|
||||||
*/
|
*/
|
||||||
var Percent = function (value, min, max, upperMax)
|
var Percent = function (value, min, max, upperMax)
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,7 +12,7 @@ var CONST = require('./const');
|
||||||
* @function Phaser.Math.RadToDeg
|
* @function Phaser.Math.RadToDeg
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} radians - The angle in radians to convert ot degrees.
|
* @param {number} radians - The angle in radians to convert ot degrees.
|
||||||
*
|
*
|
||||||
* @return {integer} The given angle converted to degrees.
|
* @return {integer} The given angle converted to degrees.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {Phaser.Math.Vector2} vector - The Vector to compute random values for.
|
* @param {Phaser.Math.Vector2} vector - The Vector to compute random values for.
|
||||||
* @param {float} [scale=1] - The scale of the random values.
|
* @param {number} [scale=1] - The scale of the random values.
|
||||||
*
|
*
|
||||||
* @return {Phaser.Math.Vector2} The given Vector.
|
* @return {Phaser.Math.Vector2} The given Vector.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {Phaser.Math.Vector4} vec4 - The Vector to compute random values for.
|
* @param {Phaser.Math.Vector4} vec4 - The Vector to compute random values for.
|
||||||
* @param {float} [scale=1] - The scale of the random values.
|
* @param {number} [scale=1] - The scale of the random values.
|
||||||
*
|
*
|
||||||
* @return {Phaser.Math.Vector4} The given Vector.
|
* @return {Phaser.Math.Vector4} The given Vector.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -162,8 +162,8 @@ var Vector2 = new Class({
|
||||||
* @method Phaser.Math.Vector2#setToPolar
|
* @method Phaser.Math.Vector2#setToPolar
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} azimuth - The angular coordinate, in radians.
|
* @param {number} azimuth - The angular coordinate, in radians.
|
||||||
* @param {float} [radius=1] - The radial coordinate (length).
|
* @param {number} [radius=1] - The radial coordinate (length).
|
||||||
*
|
*
|
||||||
* @return {Phaser.Math.Vector2} This Vector2.
|
* @return {Phaser.Math.Vector2} This Vector2.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {number} v - The value to be tweened.
|
* @param {number} v - The value to be tweened.
|
||||||
* @param {float} [amplitude=0.1] - The amplitude of the elastic ease.
|
* @param {number} [amplitude=0.1] - The amplitude of the elastic ease.
|
||||||
* @param {float} [period=0.1] - [description]
|
* @param {number} [period=0.1] - [description]
|
||||||
*
|
*
|
||||||
* @return {number} The tweened value.
|
* @return {number} The tweened value.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {number} v - The value to be tweened.
|
* @param {number} v - The value to be tweened.
|
||||||
* @param {float} [amplitude=0.1] - The amplitude of the elastic ease.
|
* @param {number} [amplitude=0.1] - The amplitude of the elastic ease.
|
||||||
* @param {float} [period=0.1] - [description]
|
* @param {number} [period=0.1] - [description]
|
||||||
*
|
*
|
||||||
* @return {number} The tweened value.
|
* @return {number} The tweened value.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {number} v - The value to be tweened.
|
* @param {number} v - The value to be tweened.
|
||||||
* @param {float} [amplitude=0.1] - The amplitude of the elastic ease.
|
* @param {number} [amplitude=0.1] - The amplitude of the elastic ease.
|
||||||
* @param {float} [period=0.1] - [description]
|
* @param {number} [period=0.1] - [description]
|
||||||
*
|
*
|
||||||
* @return {number} The tweened value.
|
* @return {number} The tweened value.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {number} value - The value.
|
* @param {number} value - The value.
|
||||||
* @param {float} [epsilon=0.0001] - The epsilon.
|
* @param {number} [epsilon=0.0001] - The epsilon.
|
||||||
*
|
*
|
||||||
* @return {number} The fuzzy ceiling of the value.
|
* @return {number} The fuzzy ceiling of the value.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
*
|
*
|
||||||
* @param {number} a - The first value.
|
* @param {number} a - The first value.
|
||||||
* @param {number} b - The second value.
|
* @param {number} b - The second value.
|
||||||
* @param {float} [epsilon=0.0001] - The epsilon.
|
* @param {number} [epsilon=0.0001] - The epsilon.
|
||||||
*
|
*
|
||||||
* @return {boolean} `true` if the values are fuzzily equal, otherwise `false`.
|
* @return {boolean} `true` if the values are fuzzily equal, otherwise `false`.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {number} value - The value.
|
* @param {number} value - The value.
|
||||||
* @param {float} [epsilon=0.0001] - The epsilon.
|
* @param {number} [epsilon=0.0001] - The epsilon.
|
||||||
*
|
*
|
||||||
* @return {number} The floor of the value.
|
* @return {number} The floor of the value.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
*
|
*
|
||||||
* @param {number} a - The first value.
|
* @param {number} a - The first value.
|
||||||
* @param {number} b - The second value.
|
* @param {number} b - The second value.
|
||||||
* @param {float} [epsilon=0.0001] - The epsilon.
|
* @param {number} [epsilon=0.0001] - The epsilon.
|
||||||
*
|
*
|
||||||
* @return {boolean} `true` if `a` is fuzzily greater than than `b`, otherwise `false`.
|
* @return {boolean} `true` if `a` is fuzzily greater than than `b`, otherwise `false`.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
*
|
*
|
||||||
* @param {number} a - The first value.
|
* @param {number} a - The first value.
|
||||||
* @param {number} b - The second value.
|
* @param {number} b - The second value.
|
||||||
* @param {float} [epsilon=0.0001] - The epsilon.
|
* @param {number} [epsilon=0.0001] - The epsilon.
|
||||||
*
|
*
|
||||||
* @return {boolean} `true` if `a` is fuzzily less than `b`, otherwise `false`.
|
* @return {boolean} `true` if `a` is fuzzily less than `b`, otherwise `false`.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -41,7 +41,7 @@ function P3 (t, p)
|
||||||
* @function Phaser.Math.Interpolation.CubicBezier
|
* @function Phaser.Math.Interpolation.CubicBezier
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} t - The percentage of interpolation, between 0 and 1.
|
* @param {number} t - The percentage of interpolation, between 0 and 1.
|
||||||
* @param {number} p0 - The start point.
|
* @param {number} p0 - The start point.
|
||||||
* @param {number} p1 - The first control point.
|
* @param {number} p1 - The first control point.
|
||||||
* @param {number} p2 - The second control point.
|
* @param {number} p2 - The second control point.
|
||||||
|
|
|
@ -33,7 +33,7 @@ function P2 (t, p)
|
||||||
* @function Phaser.Math.Interpolation.QuadraticBezier
|
* @function Phaser.Math.Interpolation.QuadraticBezier
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*
|
*
|
||||||
* @param {float} t - The percentage of interpolation, between 0 and 1.
|
* @param {number} t - The percentage of interpolation, between 0 and 1.
|
||||||
* @param {number} p0 - The start point.
|
* @param {number} p0 - The start point.
|
||||||
* @param {number} p1 - The control point.
|
* @param {number} p1 - The control point.
|
||||||
* @param {number} p2 - The end point.
|
* @param {number} p2 - The end point.
|
||||||
|
|
|
@ -22,7 +22,7 @@ var TYPE = require('./TYPE');
|
||||||
* @property {number} [gravity=0] - [description]
|
* @property {number} [gravity=0] - [description]
|
||||||
* @property {number} [cellSize=64] - [description]
|
* @property {number} [cellSize=64] - [description]
|
||||||
* @property {number} [timeScale=1] - [description]
|
* @property {number} [timeScale=1] - [description]
|
||||||
* @property {float} [maxStep=0.05] - [description]
|
* @property {number} [maxStep=0.05] - [description]
|
||||||
* @property {boolean} [debug=false] - [description]
|
* @property {boolean} [debug=false] - [description]
|
||||||
* @property {number} [maxVelocity=100] - [description]
|
* @property {number} [maxVelocity=100] - [description]
|
||||||
* @property {boolean} [debugShowBody=true] - [description]
|
* @property {boolean} [debugShowBody=true] - [description]
|
||||||
|
@ -145,7 +145,7 @@ var World = new Class({
|
||||||
* [description]
|
* [description]
|
||||||
*
|
*
|
||||||
* @name Phaser.Physics.Impact.World#timeScale
|
* @name Phaser.Physics.Impact.World#timeScale
|
||||||
* @type {float}
|
* @type {number}
|
||||||
* @default 1
|
* @default 1
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -18,7 +18,7 @@ var Bounce = {
|
||||||
* @method Phaser.Physics.Matter.Components.Bounce#setBounce
|
* @method Phaser.Physics.Matter.Components.Bounce#setBounce
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} value - [description]
|
* @param {number} value - [description]
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.GameObject} This Game Object.
|
* @return {Phaser.GameObjects.GameObject} This Game Object.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -86,10 +86,10 @@ var CanvasRenderer = new Class({
|
||||||
*/
|
*/
|
||||||
this.config = {
|
this.config = {
|
||||||
clearBeforeRender: game.config.clearBeforeRender,
|
clearBeforeRender: game.config.clearBeforeRender,
|
||||||
pixelArt: game.config.pixelArt,
|
|
||||||
backgroundColor: game.config.backgroundColor,
|
backgroundColor: game.config.backgroundColor,
|
||||||
resolution: game.config.resolution,
|
resolution: game.config.resolution,
|
||||||
autoResize: game.config.autoResize,
|
autoResize: game.config.autoResize,
|
||||||
|
antialias: game.config.antialias,
|
||||||
roundPixels: game.config.roundPixels
|
roundPixels: game.config.roundPixels
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ var CanvasRenderer = new Class({
|
||||||
* @type {integer}
|
* @type {integer}
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
this.scaleMode = (game.config.pixelArt) ? ScaleModes.NEAREST : ScaleModes.LINEAR;
|
this.scaleMode = (game.config.antialias) ? ScaleModes.LINEAR : ScaleModes.NEAREST;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* [description]
|
||||||
|
@ -136,7 +136,7 @@ var CanvasRenderer = new Class({
|
||||||
* @type {function}
|
* @type {function}
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
this.drawImage = DrawImage(this.config.roundPixels);
|
this.drawImage = DrawImage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* [description]
|
||||||
|
@ -324,9 +324,9 @@ var CanvasRenderer = new Class({
|
||||||
* @method Phaser.Renderer.Canvas.CanvasRenderer#setAlpha
|
* @method Phaser.Renderer.Canvas.CanvasRenderer#setAlpha
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} alpha - [description]
|
* @param {number} alpha - [description]
|
||||||
*
|
*
|
||||||
* @return {float} [description]
|
* @return {number} [description]
|
||||||
*/
|
*/
|
||||||
setAlpha: function (alpha)
|
setAlpha: function (alpha)
|
||||||
{
|
{
|
||||||
|
@ -375,7 +375,7 @@ var CanvasRenderer = new Class({
|
||||||
*
|
*
|
||||||
* @param {Phaser.Scene} scene - [description]
|
* @param {Phaser.Scene} scene - [description]
|
||||||
* @param {Phaser.GameObjects.DisplayList} children - [description]
|
* @param {Phaser.GameObjects.DisplayList} children - [description]
|
||||||
* @param {float} interpolationPercentage - [description]
|
* @param {number} interpolationPercentage - [description]
|
||||||
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
|
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
|
||||||
*/
|
*/
|
||||||
render: function (scene, children, interpolationPercentage, camera)
|
render: function (scene, children, interpolationPercentage, camera)
|
||||||
|
@ -395,11 +395,9 @@ var CanvasRenderer = new Class({
|
||||||
ctx.fillRect(camera.x, camera.y, camera.width, camera.height);
|
ctx.fillRect(camera.x, camera.y, camera.width, camera.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.currentAlpha !== 1)
|
ctx.globalAlpha = camera.alpha;
|
||||||
{
|
|
||||||
ctx.globalAlpha = 1;
|
this.currentAlpha = camera.alpha;
|
||||||
this.currentAlpha = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.currentBlendMode !== 0)
|
if (this.currentBlendMode !== 0)
|
||||||
{
|
{
|
||||||
|
@ -442,6 +440,7 @@ var CanvasRenderer = new Class({
|
||||||
|
|
||||||
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
||||||
ctx.globalCompositeOperation = 'source-over';
|
ctx.globalCompositeOperation = 'source-over';
|
||||||
|
ctx.globalAlpha = 1;
|
||||||
|
|
||||||
camera.flashEffect.postRenderCanvas(ctx);
|
camera.flashEffect.postRenderCanvas(ctx);
|
||||||
camera.fadeEffect.postRenderCanvas(ctx);
|
camera.fadeEffect.postRenderCanvas(ctx);
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var roundPixels = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* [description]
|
||||||
*
|
*
|
||||||
|
@ -22,6 +20,18 @@ var DrawImage = function (src, camera, parentMatrix)
|
||||||
var frame = src.frame;
|
var frame = src.frame;
|
||||||
var cd = frame.canvasData;
|
var cd = frame.canvasData;
|
||||||
|
|
||||||
|
// Alpha
|
||||||
|
|
||||||
|
var alpha = camera.alpha * src.alpha;
|
||||||
|
|
||||||
|
if (alpha === 0)
|
||||||
|
{
|
||||||
|
// Nothing to see, so abort early
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.globalAlpha = alpha;
|
||||||
|
|
||||||
// Blend Mode
|
// Blend Mode
|
||||||
|
|
||||||
if (this.currentBlendMode !== src.blendMode)
|
if (this.currentBlendMode !== src.blendMode)
|
||||||
|
@ -30,14 +40,6 @@ var DrawImage = function (src, camera, parentMatrix)
|
||||||
ctx.globalCompositeOperation = this.blendModes[src.blendMode];
|
ctx.globalCompositeOperation = this.blendModes[src.blendMode];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Alpha
|
|
||||||
|
|
||||||
if (this.currentAlpha !== src.alpha)
|
|
||||||
{
|
|
||||||
this.currentAlpha = src.alpha;
|
|
||||||
ctx.globalAlpha = src.alpha;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Smoothing
|
// Smoothing
|
||||||
|
|
||||||
if (this.currentScaleMode !== src.scaleMode)
|
if (this.currentScaleMode !== src.scaleMode)
|
||||||
|
@ -76,7 +78,7 @@ var DrawImage = function (src, camera, parentMatrix)
|
||||||
var tx = src.x - camera.scrollX * src.scrollFactorX;
|
var tx = src.x - camera.scrollX * src.scrollFactorX;
|
||||||
var ty = src.y - camera.scrollY * src.scrollFactorY;
|
var ty = src.y - camera.scrollY * src.scrollFactorY;
|
||||||
|
|
||||||
if (roundPixels)
|
if (camera.roundPixels)
|
||||||
{
|
{
|
||||||
tx |= 0;
|
tx |= 0;
|
||||||
ty |= 0;
|
ty |= 0;
|
||||||
|
@ -107,11 +109,4 @@ var DrawImage = function (src, camera, parentMatrix)
|
||||||
ctx.restore();
|
ctx.restore();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Special return so we can store the config value locally
|
module.exports = DrawImage;
|
||||||
|
|
||||||
module.exports = function (configRoundPixels)
|
|
||||||
{
|
|
||||||
roundPixels = configRoundPixels;
|
|
||||||
|
|
||||||
return DrawImage;
|
|
||||||
};
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
* @typedef {object} RendererConfig
|
* @typedef {object} RendererConfig
|
||||||
*
|
*
|
||||||
* @property {boolean} clearBeforeRender - [description]
|
* @property {boolean} clearBeforeRender - [description]
|
||||||
* @property {boolean} pixelArt - [description]
|
* @property {boolean} antialias - [description]
|
||||||
* @property {Phaser.Display.Color} backgroundColor - [description]
|
* @property {Phaser.Display.Color} backgroundColor - [description]
|
||||||
* @property {number} resolution - [description]
|
* @property {number} resolution - [description]
|
||||||
* @property {boolean} autoResize - [description]
|
* @property {boolean} autoResize - [description]
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
*
|
*
|
||||||
* @param {HTMLCanvasElement} canvas - [description]
|
* @param {HTMLCanvasElement} canvas - [description]
|
||||||
* @param {string} [type='image/png'] - [description]
|
* @param {string} [type='image/png'] - [description]
|
||||||
* @param {float} [encoderOptions=0.92] - [description]
|
* @param {number} [encoderOptions=0.92] - [description]
|
||||||
*
|
*
|
||||||
* @return {HTMLImageElement} [description]
|
* @return {HTMLImageElement} [description]
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
*
|
*
|
||||||
* @param {HTMLCanvasElement} sourceCanvas - [description]
|
* @param {HTMLCanvasElement} sourceCanvas - [description]
|
||||||
* @param {string} [type='image/png'] - [description]
|
* @param {string} [type='image/png'] - [description]
|
||||||
* @param {float} [encoderOptions=0.92] - [description]
|
* @param {number} [encoderOptions=0.92] - [description]
|
||||||
*
|
*
|
||||||
* @return {HTMLImageElement} [description]
|
* @return {HTMLImageElement} [description]
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -459,7 +459,7 @@ var WebGLPipeline = new Class({
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*
|
*
|
||||||
* @param {string} name - [description]
|
* @param {string} name - [description]
|
||||||
* @param {float} x - [description]
|
* @param {number} x - [description]
|
||||||
*
|
*
|
||||||
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
|
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
|
||||||
*/
|
*/
|
||||||
|
@ -476,8 +476,8 @@ var WebGLPipeline = new Class({
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*
|
*
|
||||||
* @param {string} name - [description]
|
* @param {string} name - [description]
|
||||||
* @param {float} x - [description]
|
* @param {number} x - [description]
|
||||||
* @param {float} y - [description]
|
* @param {number} y - [description]
|
||||||
*
|
*
|
||||||
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
|
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
|
||||||
*/
|
*/
|
||||||
|
@ -495,9 +495,9 @@ var WebGLPipeline = new Class({
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*
|
*
|
||||||
* @param {string} name - [description]
|
* @param {string} name - [description]
|
||||||
* @param {float} x - [description]
|
* @param {number} x - [description]
|
||||||
* @param {float} y - [description]
|
* @param {number} y - [description]
|
||||||
* @param {float} z - [description]
|
* @param {number} z - [description]
|
||||||
*
|
*
|
||||||
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
|
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
|
||||||
*/
|
*/
|
||||||
|
@ -515,10 +515,10 @@ var WebGLPipeline = new Class({
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*
|
*
|
||||||
* @param {string} name - Name of the uniform
|
* @param {string} name - Name of the uniform
|
||||||
* @param {float} x - X component of the uniform
|
* @param {number} x - X component of the uniform
|
||||||
* @param {float} y - Y component of the uniform
|
* @param {number} y - Y component of the uniform
|
||||||
* @param {float} z - Z component of the uniform
|
* @param {number} z - Z component of the uniform
|
||||||
* @param {float} w - W component of the uniform
|
* @param {number} w - W component of the uniform
|
||||||
*
|
*
|
||||||
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
|
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -29,7 +29,7 @@ var TextureTintPipeline = require('./pipelines/TextureTintPipeline');
|
||||||
*
|
*
|
||||||
* @property {SnapshotCallback} callback - [description]
|
* @property {SnapshotCallback} callback - [description]
|
||||||
* @property {string} type - [description]
|
* @property {string} type - [description]
|
||||||
* @property {float} encoder - [description]
|
* @property {number} encoder - [description]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -80,7 +80,7 @@ var WebGLRenderer = new Class({
|
||||||
*/
|
*/
|
||||||
this.config = {
|
this.config = {
|
||||||
clearBeforeRender: gameConfig.clearBeforeRender,
|
clearBeforeRender: gameConfig.clearBeforeRender,
|
||||||
pixelArt: gameConfig.pixelArt,
|
antialias: gameConfig.antialias,
|
||||||
backgroundColor: gameConfig.backgroundColor,
|
backgroundColor: gameConfig.backgroundColor,
|
||||||
contextCreation: contextCreationConfig,
|
contextCreation: contextCreationConfig,
|
||||||
resolution: gameConfig.resolution,
|
resolution: gameConfig.resolution,
|
||||||
|
@ -1120,14 +1120,10 @@ var WebGLRenderer = new Class({
|
||||||
wrap = gl.REPEAT;
|
wrap = gl.REPEAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scaleMode === CONST.ScaleModes.LINEAR)
|
if (scaleMode === CONST.ScaleModes.LINEAR && this.config.antialias)
|
||||||
{
|
{
|
||||||
filter = gl.LINEAR;
|
filter = gl.LINEAR;
|
||||||
}
|
}
|
||||||
else if (scaleMode === CONST.ScaleModes.NEAREST || this.config.pixelArt)
|
|
||||||
{
|
|
||||||
filter = gl.NEAREST;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!source && typeof width === 'number' && typeof height === 'number')
|
if (!source && typeof width === 'number' && typeof height === 'number')
|
||||||
{
|
{
|
||||||
|
@ -1157,7 +1153,7 @@ var WebGLRenderer = new Class({
|
||||||
* @param {object} pixels - pixel data
|
* @param {object} pixels - pixel data
|
||||||
* @param {integer} width - Width of the texture in pixels
|
* @param {integer} width - Width of the texture in pixels
|
||||||
* @param {integer} height - Height of the texture in pixels
|
* @param {integer} height - Height of the texture in pixels
|
||||||
* @param {boolean} pma - Does the texture hace premultiplied alpha.
|
* @param {boolean} pma - Does the texture have premultiplied alpha?
|
||||||
*
|
*
|
||||||
* @return {WebGLTexture} Raw WebGLTexture
|
* @return {WebGLTexture} Raw WebGLTexture
|
||||||
*/
|
*/
|
||||||
|
@ -1607,7 +1603,7 @@ var WebGLRenderer = new Class({
|
||||||
*
|
*
|
||||||
* @param {SnapshotCallback} callback - [description]
|
* @param {SnapshotCallback} callback - [description]
|
||||||
* @param {string} type - [description]
|
* @param {string} type - [description]
|
||||||
* @param {float} encoderOptions - [description]
|
* @param {number} encoderOptions - [description]
|
||||||
*
|
*
|
||||||
* @return {Phaser.Renderer.WebGL.WebGLRenderer} [description]
|
* @return {Phaser.Renderer.WebGL.WebGLRenderer} [description]
|
||||||
*/
|
*/
|
||||||
|
@ -1695,7 +1691,7 @@ var WebGLRenderer = new Class({
|
||||||
*
|
*
|
||||||
* @param {WebGLProgram} program - [description]
|
* @param {WebGLProgram} program - [description]
|
||||||
* @param {string} name - [description]
|
* @param {string} name - [description]
|
||||||
* @param {float} x - [description]
|
* @param {number} x - [description]
|
||||||
*
|
*
|
||||||
* @return {Phaser.Renderer.WebGL.WebGLRenderer} [description]
|
* @return {Phaser.Renderer.WebGL.WebGLRenderer} [description]
|
||||||
*/
|
*/
|
||||||
|
@ -1716,8 +1712,8 @@ var WebGLRenderer = new Class({
|
||||||
*
|
*
|
||||||
* @param {WebGLProgram} program - [description]
|
* @param {WebGLProgram} program - [description]
|
||||||
* @param {string} name - [description]
|
* @param {string} name - [description]
|
||||||
* @param {float} x - [description]
|
* @param {number} x - [description]
|
||||||
* @param {float} y - [description]
|
* @param {number} y - [description]
|
||||||
*
|
*
|
||||||
* @return {Phaser.Renderer.WebGL.WebGLRenderer} [description]
|
* @return {Phaser.Renderer.WebGL.WebGLRenderer} [description]
|
||||||
*/
|
*/
|
||||||
|
@ -1738,9 +1734,9 @@ var WebGLRenderer = new Class({
|
||||||
*
|
*
|
||||||
* @param {WebGLProgram} program - [description]
|
* @param {WebGLProgram} program - [description]
|
||||||
* @param {string} name - [description]
|
* @param {string} name - [description]
|
||||||
* @param {float} x - [description]
|
* @param {number} x - [description]
|
||||||
* @param {float} y - [description]
|
* @param {number} y - [description]
|
||||||
* @param {float} z - [description]
|
* @param {number} z - [description]
|
||||||
*
|
*
|
||||||
* @return {Phaser.Renderer.WebGL.WebGLRenderer} [description]
|
* @return {Phaser.Renderer.WebGL.WebGLRenderer} [description]
|
||||||
*/
|
*/
|
||||||
|
@ -1761,10 +1757,10 @@ var WebGLRenderer = new Class({
|
||||||
*
|
*
|
||||||
* @param {WebGLProgram} program - Target program
|
* @param {WebGLProgram} program - Target program
|
||||||
* @param {string} name - Name of the uniform
|
* @param {string} name - Name of the uniform
|
||||||
* @param {float} x - X component
|
* @param {number} x - X component
|
||||||
* @param {float} y - Y component
|
* @param {number} y - Y component
|
||||||
* @param {float} z - Z component
|
* @param {number} z - Z component
|
||||||
* @param {float} w - W component
|
* @param {number} w - W component
|
||||||
*
|
*
|
||||||
* @return {Phaser.Renderer.WebGL.WebGLRenderer} [description]
|
* @return {Phaser.Renderer.WebGL.WebGLRenderer} [description]
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -133,7 +133,7 @@ var FlatTintPipeline = new Class({
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used internally by for triangulating a polyong
|
* Used internally for triangulating a polygon
|
||||||
*
|
*
|
||||||
* @name Phaser.Renderer.WebGL.Pipelines.FlatTintPipeline#polygonCache
|
* @name Phaser.Renderer.WebGL.Pipelines.FlatTintPipeline#polygonCache
|
||||||
* @type {array}
|
* @type {array}
|
||||||
|
@ -187,23 +187,23 @@ var FlatTintPipeline = new Class({
|
||||||
* @method Phaser.Renderer.WebGL.Pipelines.FlatTintPipeline#batchFillRect
|
* @method Phaser.Renderer.WebGL.Pipelines.FlatTintPipeline#batchFillRect
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} srcX - Graphics horizontal component for translation
|
* @param {number} srcX - Graphics horizontal component for translation
|
||||||
* @param {float} srcY - Graphics vertical component for translation
|
* @param {number} srcY - Graphics vertical component for translation
|
||||||
* @param {float} srcScaleX - Graphics horizontal component for scale
|
* @param {number} srcScaleX - Graphics horizontal component for scale
|
||||||
* @param {float} srcScaleY - Graphics vertical component for scale
|
* @param {number} srcScaleY - Graphics vertical component for scale
|
||||||
* @param {float} srcRotation - Graphics rotation
|
* @param {number} srcRotation - Graphics rotation
|
||||||
* @param {float} x - Horiztonal top left coordinate of the rectangle
|
* @param {number} x - Horiztonal top left coordinate of the rectangle
|
||||||
* @param {float} y - Vertical top left coordinate of the rectangle
|
* @param {number} y - Vertical top left coordinate of the rectangle
|
||||||
* @param {float} width - Width of the rectangle
|
* @param {number} width - Width of the rectangle
|
||||||
* @param {float} height - Height of the rectangle
|
* @param {number} height - Height of the rectangle
|
||||||
* @param {integer} fillColor - RGB color packed as a uint
|
* @param {integer} fillColor - RGB color packed as a uint
|
||||||
* @param {float} fillAlpha - Alpha represented as float
|
* @param {number} fillAlpha - Alpha represented as float
|
||||||
* @param {float} a1 - Matrix stack top a component
|
* @param {number} a1 - Matrix stack top a component
|
||||||
* @param {float} b1 - Matrix stack top b component
|
* @param {number} b1 - Matrix stack top b component
|
||||||
* @param {float} c1 - Matrix stack top c component
|
* @param {number} c1 - Matrix stack top c component
|
||||||
* @param {float} d1 - Matrix stack top d component
|
* @param {number} d1 - Matrix stack top d component
|
||||||
* @param {float} e1 - Matrix stack top e component
|
* @param {number} e1 - Matrix stack top e component
|
||||||
* @param {float} f1 - Matrix stack top f component
|
* @param {number} f1 - Matrix stack top f component
|
||||||
* @param {Float32Array} currentMatrix - Parent matrix, generally used by containers
|
* @param {Float32Array} currentMatrix - Parent matrix, generally used by containers
|
||||||
*/
|
*/
|
||||||
batchFillRect: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, x, y, width, height, fillColor, fillAlpha, a1, b1, c1, d1, e1, f1, currentMatrix)
|
batchFillRect: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, x, y, width, height, fillColor, fillAlpha, a1, b1, c1, d1, e1, f1, currentMatrix)
|
||||||
|
@ -245,18 +245,23 @@ var FlatTintPipeline = new Class({
|
||||||
vertexViewF32[vertexOffset + 0] = tx0;
|
vertexViewF32[vertexOffset + 0] = tx0;
|
||||||
vertexViewF32[vertexOffset + 1] = ty0;
|
vertexViewF32[vertexOffset + 1] = ty0;
|
||||||
vertexViewU32[vertexOffset + 2] = tint;
|
vertexViewU32[vertexOffset + 2] = tint;
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 3] = tx1;
|
vertexViewF32[vertexOffset + 3] = tx1;
|
||||||
vertexViewF32[vertexOffset + 4] = ty1;
|
vertexViewF32[vertexOffset + 4] = ty1;
|
||||||
vertexViewU32[vertexOffset + 5] = tint;
|
vertexViewU32[vertexOffset + 5] = tint;
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 6] = tx2;
|
vertexViewF32[vertexOffset + 6] = tx2;
|
||||||
vertexViewF32[vertexOffset + 7] = ty2;
|
vertexViewF32[vertexOffset + 7] = ty2;
|
||||||
vertexViewU32[vertexOffset + 8] = tint;
|
vertexViewU32[vertexOffset + 8] = tint;
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 9] = tx0;
|
vertexViewF32[vertexOffset + 9] = tx0;
|
||||||
vertexViewF32[vertexOffset + 10] = ty0;
|
vertexViewF32[vertexOffset + 10] = ty0;
|
||||||
vertexViewU32[vertexOffset + 11] = tint;
|
vertexViewU32[vertexOffset + 11] = tint;
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 12] = tx2;
|
vertexViewF32[vertexOffset + 12] = tx2;
|
||||||
vertexViewF32[vertexOffset + 13] = ty2;
|
vertexViewF32[vertexOffset + 13] = ty2;
|
||||||
vertexViewU32[vertexOffset + 14] = tint;
|
vertexViewU32[vertexOffset + 14] = tint;
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 15] = tx3;
|
vertexViewF32[vertexOffset + 15] = tx3;
|
||||||
vertexViewF32[vertexOffset + 16] = ty3;
|
vertexViewF32[vertexOffset + 16] = ty3;
|
||||||
vertexViewU32[vertexOffset + 17] = tint;
|
vertexViewU32[vertexOffset + 17] = tint;
|
||||||
|
@ -270,25 +275,25 @@ var FlatTintPipeline = new Class({
|
||||||
* @method Phaser.Renderer.WebGL.Pipelines.FlatTintPipeline#batchFillTriangle
|
* @method Phaser.Renderer.WebGL.Pipelines.FlatTintPipeline#batchFillTriangle
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} srcX - Graphics horizontal component for translation
|
* @param {number} srcX - Graphics horizontal component for translation
|
||||||
* @param {float} srcY - Graphics vertical component for translation
|
* @param {number} srcY - Graphics vertical component for translation
|
||||||
* @param {float} srcScaleX - Graphics horizontal component for scale
|
* @param {number} srcScaleX - Graphics horizontal component for scale
|
||||||
* @param {float} srcScaleY - Graphics vertical component for scale
|
* @param {number} srcScaleY - Graphics vertical component for scale
|
||||||
* @param {float} srcRotation - Graphics rotation
|
* @param {number} srcRotation - Graphics rotation
|
||||||
* @param {float} x0 - Point 0 x coordinate
|
* @param {number} x0 - Point 0 x coordinate
|
||||||
* @param {float} y0 - Point 0 y coordinate
|
* @param {number} y0 - Point 0 y coordinate
|
||||||
* @param {float} x1 - Point 1 x coordinate
|
* @param {number} x1 - Point 1 x coordinate
|
||||||
* @param {float} y1 - Point 1 y coordinate
|
* @param {number} y1 - Point 1 y coordinate
|
||||||
* @param {float} x2 - Point 2 x coordinate
|
* @param {number} x2 - Point 2 x coordinate
|
||||||
* @param {float} y2 - Point 2 y coordinate
|
* @param {number} y2 - Point 2 y coordinate
|
||||||
* @param {integer} fillColor - RGB color packed as a uint
|
* @param {integer} fillColor - RGB color packed as a uint
|
||||||
* @param {float} fillAlpha - Alpha represented as float
|
* @param {number} fillAlpha - Alpha represented as float
|
||||||
* @param {float} a1 - Matrix stack top a component
|
* @param {number} a1 - Matrix stack top a component
|
||||||
* @param {float} b1 - Matrix stack top b component
|
* @param {number} b1 - Matrix stack top b component
|
||||||
* @param {float} c1 - Matrix stack top c component
|
* @param {number} c1 - Matrix stack top c component
|
||||||
* @param {float} d1 - Matrix stack top d component
|
* @param {number} d1 - Matrix stack top d component
|
||||||
* @param {float} e1 - Matrix stack top e component
|
* @param {number} e1 - Matrix stack top e component
|
||||||
* @param {float} f1 - Matrix stack top f component
|
* @param {number} f1 - Matrix stack top f component
|
||||||
* @param {Float32Array} currentMatrix - Parent matrix, generally used by containers
|
* @param {Float32Array} currentMatrix - Parent matrix, generally used by containers
|
||||||
*/
|
*/
|
||||||
batchFillTriangle: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, x0, y0, x1, y1, x2, y2, fillColor, fillAlpha, a1, b1, c1, d1, e1, f1, currentMatrix)
|
batchFillTriangle: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, x0, y0, x1, y1, x2, y2, fillColor, fillAlpha, a1, b1, c1, d1, e1, f1, currentMatrix)
|
||||||
|
@ -326,9 +331,11 @@ var FlatTintPipeline = new Class({
|
||||||
vertexViewF32[vertexOffset + 0] = tx0;
|
vertexViewF32[vertexOffset + 0] = tx0;
|
||||||
vertexViewF32[vertexOffset + 1] = ty0;
|
vertexViewF32[vertexOffset + 1] = ty0;
|
||||||
vertexViewU32[vertexOffset + 2] = tint;
|
vertexViewU32[vertexOffset + 2] = tint;
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 3] = tx1;
|
vertexViewF32[vertexOffset + 3] = tx1;
|
||||||
vertexViewF32[vertexOffset + 4] = ty1;
|
vertexViewF32[vertexOffset + 4] = ty1;
|
||||||
vertexViewU32[vertexOffset + 5] = tint;
|
vertexViewU32[vertexOffset + 5] = tint;
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 6] = tx2;
|
vertexViewF32[vertexOffset + 6] = tx2;
|
||||||
vertexViewF32[vertexOffset + 7] = ty2;
|
vertexViewF32[vertexOffset + 7] = ty2;
|
||||||
vertexViewU32[vertexOffset + 8] = tint;
|
vertexViewU32[vertexOffset + 8] = tint;
|
||||||
|
@ -342,26 +349,26 @@ var FlatTintPipeline = new Class({
|
||||||
* @method Phaser.Renderer.WebGL.Pipelines.FlatTintPipeline#batchStrokeTriangle
|
* @method Phaser.Renderer.WebGL.Pipelines.FlatTintPipeline#batchStrokeTriangle
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} srcX - Graphics horizontal component for translation
|
* @param {number} srcX - Graphics horizontal component for translation
|
||||||
* @param {float} srcY - Graphics vertical component for translation
|
* @param {number} srcY - Graphics vertical component for translation
|
||||||
* @param {float} srcScaleX - Graphics horizontal component for scale
|
* @param {number} srcScaleX - Graphics horizontal component for scale
|
||||||
* @param {float} srcScaleY - Graphics vertical component for scale
|
* @param {number} srcScaleY - Graphics vertical component for scale
|
||||||
* @param {float} srcRotation - Graphics rotation
|
* @param {number} srcRotation - Graphics rotation
|
||||||
* @param {float} x0 - [description]
|
* @param {number} x0 - [description]
|
||||||
* @param {float} y0 - [description]
|
* @param {number} y0 - [description]
|
||||||
* @param {float} x1 - [description]
|
* @param {number} x1 - [description]
|
||||||
* @param {float} y1 - [description]
|
* @param {number} y1 - [description]
|
||||||
* @param {float} x2 - [description]
|
* @param {number} x2 - [description]
|
||||||
* @param {float} y2 - [description]
|
* @param {number} y2 - [description]
|
||||||
* @param {float} lineWidth - Size of the line as a float value
|
* @param {number} lineWidth - Size of the line as a float value
|
||||||
* @param {integer} lineColor - RGB color packed as a uint
|
* @param {integer} lineColor - RGB color packed as a uint
|
||||||
* @param {float} lineAlpha - Alpha represented as float
|
* @param {number} lineAlpha - Alpha represented as float
|
||||||
* @param {float} a - Matrix stack top a component
|
* @param {number} a - Matrix stack top a component
|
||||||
* @param {float} b - Matrix stack top b component
|
* @param {number} b - Matrix stack top b component
|
||||||
* @param {float} c - Matrix stack top c component
|
* @param {number} c - Matrix stack top c component
|
||||||
* @param {float} d - Matrix stack top d component
|
* @param {number} d - Matrix stack top d component
|
||||||
* @param {float} e - Matrix stack top e component
|
* @param {number} e - Matrix stack top e component
|
||||||
* @param {float} f - Matrix stack top f component
|
* @param {number} f - Matrix stack top f component
|
||||||
* @param {Float32Array} currentMatrix - Parent matrix, generally used by containers
|
* @param {Float32Array} currentMatrix - Parent matrix, generally used by containers
|
||||||
*/
|
*/
|
||||||
batchStrokeTriangle: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, x0, y0, x1, y1, x2, y2, lineWidth, lineColor, lineAlpha, a, b, c, d, e, f, currentMatrix)
|
batchStrokeTriangle: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, x0, y0, x1, y1, x2, y2, lineWidth, lineColor, lineAlpha, a, b, c, d, e, f, currentMatrix)
|
||||||
|
@ -404,20 +411,20 @@ var FlatTintPipeline = new Class({
|
||||||
* @method Phaser.Renderer.WebGL.Pipelines.FlatTintPipeline#batchFillPath
|
* @method Phaser.Renderer.WebGL.Pipelines.FlatTintPipeline#batchFillPath
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} srcX - Graphics horizontal component for translation
|
* @param {number} srcX - Graphics horizontal component for translation
|
||||||
* @param {float} srcY - Graphics vertical component for translation
|
* @param {number} srcY - Graphics vertical component for translation
|
||||||
* @param {float} srcScaleX - Graphics horizontal component for scale
|
* @param {number} srcScaleX - Graphics horizontal component for scale
|
||||||
* @param {float} srcScaleY - Graphics vertical component for scale
|
* @param {number} srcScaleY - Graphics vertical component for scale
|
||||||
* @param {float} srcRotation - Graphics rotation
|
* @param {number} srcRotation - Graphics rotation
|
||||||
* @param {float} path - Collection of points that represent the path
|
* @param {number} path - Collection of points that represent the path
|
||||||
* @param {integer} fillColor - RGB color packed as a uint
|
* @param {integer} fillColor - RGB color packed as a uint
|
||||||
* @param {float} fillAlpha - Alpha represented as float
|
* @param {number} fillAlpha - Alpha represented as float
|
||||||
* @param {float} a1 - Matrix stack top a component
|
* @param {number} a1 - Matrix stack top a component
|
||||||
* @param {float} b1 - Matrix stack top b component
|
* @param {number} b1 - Matrix stack top b component
|
||||||
* @param {float} c1 - Matrix stack top c component
|
* @param {number} c1 - Matrix stack top c component
|
||||||
* @param {float} d1 - Matrix stack top d component
|
* @param {number} d1 - Matrix stack top d component
|
||||||
* @param {float} e1 - Matrix stack top e component
|
* @param {number} e1 - Matrix stack top e component
|
||||||
* @param {float} f1 - Matrix stack top f component
|
* @param {number} f1 - Matrix stack top f component
|
||||||
* @param {Float32Array} currentMatrix - Parent matrix, generally used by containers
|
* @param {Float32Array} currentMatrix - Parent matrix, generally used by containers
|
||||||
*/
|
*/
|
||||||
batchFillPath: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, path, fillColor, fillAlpha, a1, b1, c1, d1, e1, f1, currentMatrix)
|
batchFillPath: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, path, fillColor, fillAlpha, a1, b1, c1, d1, e1, f1, currentMatrix)
|
||||||
|
@ -487,9 +494,11 @@ var FlatTintPipeline = new Class({
|
||||||
vertexViewF32[vertexOffset + 0] = tx0;
|
vertexViewF32[vertexOffset + 0] = tx0;
|
||||||
vertexViewF32[vertexOffset + 1] = ty0;
|
vertexViewF32[vertexOffset + 1] = ty0;
|
||||||
vertexViewU32[vertexOffset + 2] = tint;
|
vertexViewU32[vertexOffset + 2] = tint;
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 3] = tx1;
|
vertexViewF32[vertexOffset + 3] = tx1;
|
||||||
vertexViewF32[vertexOffset + 4] = ty1;
|
vertexViewF32[vertexOffset + 4] = ty1;
|
||||||
vertexViewU32[vertexOffset + 5] = tint;
|
vertexViewU32[vertexOffset + 5] = tint;
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 6] = tx2;
|
vertexViewF32[vertexOffset + 6] = tx2;
|
||||||
vertexViewF32[vertexOffset + 7] = ty2;
|
vertexViewF32[vertexOffset + 7] = ty2;
|
||||||
vertexViewU32[vertexOffset + 8] = tint;
|
vertexViewU32[vertexOffset + 8] = tint;
|
||||||
|
@ -506,21 +515,21 @@ var FlatTintPipeline = new Class({
|
||||||
* @method Phaser.Renderer.WebGL.Pipelines.FlatTintPipeline#batchStrokePath
|
* @method Phaser.Renderer.WebGL.Pipelines.FlatTintPipeline#batchStrokePath
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} srcX - Graphics horizontal component for translation
|
* @param {number} srcX - Graphics horizontal component for translation
|
||||||
* @param {float} srcY - Graphics vertical component for translation
|
* @param {number} srcY - Graphics vertical component for translation
|
||||||
* @param {float} srcScaleX - Graphics horizontal component for scale
|
* @param {number} srcScaleX - Graphics horizontal component for scale
|
||||||
* @param {float} srcScaleY - Graphics vertical component for scale
|
* @param {number} srcScaleY - Graphics vertical component for scale
|
||||||
* @param {float} srcRotation - Graphics rotation
|
* @param {number} srcRotation - Graphics rotation
|
||||||
* @param {array} path - [description]
|
* @param {array} path - [description]
|
||||||
* @param {float} lineWidth - [description]
|
* @param {number} lineWidth - [description]
|
||||||
* @param {integer} lineColor - RGB color packed as a uint
|
* @param {integer} lineColor - RGB color packed as a uint
|
||||||
* @param {float} lineAlpha - Alpha represented as float
|
* @param {number} lineAlpha - Alpha represented as float
|
||||||
* @param {float} a - Matrix stack top a component
|
* @param {number} a - Matrix stack top a component
|
||||||
* @param {float} b - Matrix stack top b component
|
* @param {number} b - Matrix stack top b component
|
||||||
* @param {float} c - Matrix stack top c component
|
* @param {number} c - Matrix stack top c component
|
||||||
* @param {float} d - Matrix stack top d component
|
* @param {number} d - Matrix stack top d component
|
||||||
* @param {float} e - Matrix stack top e component
|
* @param {number} e - Matrix stack top e component
|
||||||
* @param {float} f - Matrix stack top f component
|
* @param {number} f - Matrix stack top f component
|
||||||
* @param {boolean} isLastPath - Indicates if the path should be closed
|
* @param {boolean} isLastPath - Indicates if the path should be closed
|
||||||
* @param {Float32Array} currentMatrix - Parent matrix, generally used by containers
|
* @param {Float32Array} currentMatrix - Parent matrix, generally used by containers
|
||||||
*/
|
*/
|
||||||
|
@ -571,18 +580,23 @@ var FlatTintPipeline = new Class({
|
||||||
vertexViewF32[vertexOffset + 0] = last[3 * 2 + 0];
|
vertexViewF32[vertexOffset + 0] = last[3 * 2 + 0];
|
||||||
vertexViewF32[vertexOffset + 1] = last[3 * 2 + 1];
|
vertexViewF32[vertexOffset + 1] = last[3 * 2 + 1];
|
||||||
vertexViewU32[vertexOffset + 2] = getTint(last[3 * 2 + 2], lineAlpha);
|
vertexViewU32[vertexOffset + 2] = getTint(last[3 * 2 + 2], lineAlpha);
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 3] = last[3 * 0 + 0];
|
vertexViewF32[vertexOffset + 3] = last[3 * 0 + 0];
|
||||||
vertexViewF32[vertexOffset + 4] = last[3 * 0 + 1];
|
vertexViewF32[vertexOffset + 4] = last[3 * 0 + 1];
|
||||||
vertexViewU32[vertexOffset + 5] = getTint(last[3 * 0 + 2], lineAlpha);
|
vertexViewU32[vertexOffset + 5] = getTint(last[3 * 0 + 2], lineAlpha);
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 6] = curr[3 * 3 + 0];
|
vertexViewF32[vertexOffset + 6] = curr[3 * 3 + 0];
|
||||||
vertexViewF32[vertexOffset + 7] = curr[3 * 3 + 1];
|
vertexViewF32[vertexOffset + 7] = curr[3 * 3 + 1];
|
||||||
vertexViewU32[vertexOffset + 8] = getTint(curr[3 * 3 + 2], lineAlpha);
|
vertexViewU32[vertexOffset + 8] = getTint(curr[3 * 3 + 2], lineAlpha);
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 9] = last[3 * 0 + 0];
|
vertexViewF32[vertexOffset + 9] = last[3 * 0 + 0];
|
||||||
vertexViewF32[vertexOffset + 10] = last[3 * 0 + 1];
|
vertexViewF32[vertexOffset + 10] = last[3 * 0 + 1];
|
||||||
vertexViewU32[vertexOffset + 11] = getTint(last[3 * 0 + 2], lineAlpha);
|
vertexViewU32[vertexOffset + 11] = getTint(last[3 * 0 + 2], lineAlpha);
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 12] = last[3 * 2 + 0];
|
vertexViewF32[vertexOffset + 12] = last[3 * 2 + 0];
|
||||||
vertexViewF32[vertexOffset + 13] = last[3 * 2 + 1];
|
vertexViewF32[vertexOffset + 13] = last[3 * 2 + 1];
|
||||||
vertexViewU32[vertexOffset + 14] = getTint(last[3 * 2 + 2], lineAlpha);
|
vertexViewU32[vertexOffset + 14] = getTint(last[3 * 2 + 2], lineAlpha);
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 15] = curr[3 * 1 + 0];
|
vertexViewF32[vertexOffset + 15] = curr[3 * 1 + 0];
|
||||||
vertexViewF32[vertexOffset + 16] = curr[3 * 1 + 1];
|
vertexViewF32[vertexOffset + 16] = curr[3 * 1 + 1];
|
||||||
vertexViewU32[vertexOffset + 17] = getTint(curr[3 * 1 + 2], lineAlpha);
|
vertexViewU32[vertexOffset + 17] = getTint(curr[3 * 1 + 2], lineAlpha);
|
||||||
|
@ -599,26 +613,26 @@ var FlatTintPipeline = new Class({
|
||||||
* @method Phaser.Renderer.WebGL.Pipelines.FlatTintPipeline#batchLine
|
* @method Phaser.Renderer.WebGL.Pipelines.FlatTintPipeline#batchLine
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {float} srcX - Graphics horizontal component for translation
|
* @param {number} srcX - Graphics horizontal component for translation
|
||||||
* @param {float} srcY - Graphics vertical component for translation
|
* @param {number} srcY - Graphics vertical component for translation
|
||||||
* @param {float} srcScaleX - Graphics horizontal component for scale
|
* @param {number} srcScaleX - Graphics horizontal component for scale
|
||||||
* @param {float} srcScaleY - Graphics vertical component for scale
|
* @param {number} srcScaleY - Graphics vertical component for scale
|
||||||
* @param {float} srcRotation - Graphics rotation
|
* @param {number} srcRotation - Graphics rotation
|
||||||
* @param {float} ax - X coordinate to the start of the line
|
* @param {number} ax - X coordinate to the start of the line
|
||||||
* @param {float} ay - Y coordinate to the start of the line
|
* @param {number} ay - Y coordinate to the start of the line
|
||||||
* @param {float} bx - X coordinate to the end of the line
|
* @param {number} bx - X coordinate to the end of the line
|
||||||
* @param {float} by - Y coordinate to the end of the line
|
* @param {number} by - Y coordinate to the end of the line
|
||||||
* @param {float} aLineWidth - Width of the start of the line
|
* @param {number} aLineWidth - Width of the start of the line
|
||||||
* @param {float} bLineWidth - Width of the end of the line
|
* @param {number} bLineWidth - Width of the end of the line
|
||||||
* @param {integer} aLineColor - RGB color packed as a uint
|
* @param {integer} aLineColor - RGB color packed as a uint
|
||||||
* @param {integer} bLineColor - RGB color packed as a uint
|
* @param {integer} bLineColor - RGB color packed as a uint
|
||||||
* @param {float} lineAlpha - Alpha represented as float
|
* @param {number} lineAlpha - Alpha represented as float
|
||||||
* @param {float} a1 - Matrix stack top a component
|
* @param {number} a1 - Matrix stack top a component
|
||||||
* @param {float} b1 - Matrix stack top b component
|
* @param {number} b1 - Matrix stack top b component
|
||||||
* @param {float} c1 - Matrix stack top c component
|
* @param {number} c1 - Matrix stack top c component
|
||||||
* @param {float} d1 - Matrix stack top d component
|
* @param {number} d1 - Matrix stack top d component
|
||||||
* @param {float} e1 - Matrix stack top e component
|
* @param {number} e1 - Matrix stack top e component
|
||||||
* @param {float} f1 - Matrix stack top f component
|
* @param {number} f1 - Matrix stack top f component
|
||||||
* @param {Float32Array} currentMatrix - Parent matrix, generally used by containers
|
* @param {Float32Array} currentMatrix - Parent matrix, generally used by containers
|
||||||
*/
|
*/
|
||||||
batchLine: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, ax, ay, bx, by, aLineWidth, bLineWidth, aLineColor, bLineColor, lineAlpha, a1, b1, c1, d1, e1, f1, currentMatrix)
|
batchLine: function (srcX, srcY, srcScaleX, srcScaleY, srcRotation, ax, ay, bx, by, aLineWidth, bLineWidth, aLineColor, bLineColor, lineAlpha, a1, b1, c1, d1, e1, f1, currentMatrix)
|
||||||
|
@ -675,18 +689,23 @@ var FlatTintPipeline = new Class({
|
||||||
vertexViewF32[vertexOffset + 0] = x0;
|
vertexViewF32[vertexOffset + 0] = x0;
|
||||||
vertexViewF32[vertexOffset + 1] = y0;
|
vertexViewF32[vertexOffset + 1] = y0;
|
||||||
vertexViewU32[vertexOffset + 2] = bTint;
|
vertexViewU32[vertexOffset + 2] = bTint;
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 3] = x1;
|
vertexViewF32[vertexOffset + 3] = x1;
|
||||||
vertexViewF32[vertexOffset + 4] = y1;
|
vertexViewF32[vertexOffset + 4] = y1;
|
||||||
vertexViewU32[vertexOffset + 5] = aTint;
|
vertexViewU32[vertexOffset + 5] = aTint;
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 6] = x2;
|
vertexViewF32[vertexOffset + 6] = x2;
|
||||||
vertexViewF32[vertexOffset + 7] = y2;
|
vertexViewF32[vertexOffset + 7] = y2;
|
||||||
vertexViewU32[vertexOffset + 8] = bTint;
|
vertexViewU32[vertexOffset + 8] = bTint;
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 9] = x1;
|
vertexViewF32[vertexOffset + 9] = x1;
|
||||||
vertexViewF32[vertexOffset + 10] = y1;
|
vertexViewF32[vertexOffset + 10] = y1;
|
||||||
vertexViewU32[vertexOffset + 11] = aTint;
|
vertexViewU32[vertexOffset + 11] = aTint;
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 12] = x3;
|
vertexViewF32[vertexOffset + 12] = x3;
|
||||||
vertexViewF32[vertexOffset + 13] = y3;
|
vertexViewF32[vertexOffset + 13] = y3;
|
||||||
vertexViewU32[vertexOffset + 14] = aTint;
|
vertexViewU32[vertexOffset + 14] = aTint;
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 15] = x2;
|
vertexViewF32[vertexOffset + 15] = x2;
|
||||||
vertexViewF32[vertexOffset + 16] = y2;
|
vertexViewF32[vertexOffset + 16] = y2;
|
||||||
vertexViewU32[vertexOffset + 17] = bTint;
|
vertexViewU32[vertexOffset + 17] = bTint;
|
||||||
|
@ -732,7 +751,7 @@ var FlatTintPipeline = new Class({
|
||||||
var srcScaleY = graphics.scaleY;
|
var srcScaleY = graphics.scaleY;
|
||||||
var srcRotation = graphics.rotation;
|
var srcRotation = graphics.rotation;
|
||||||
var commands = graphics.commandBuffer;
|
var commands = graphics.commandBuffer;
|
||||||
var alpha = graphics.alpha;
|
var alpha = camera.alpha * graphics.alpha;
|
||||||
var lineAlpha = 1.0;
|
var lineAlpha = 1.0;
|
||||||
var fillAlpha = 1.0;
|
var fillAlpha = 1.0;
|
||||||
var lineColor = 0;
|
var lineColor = 0;
|
||||||
|
@ -1137,138 +1156,6 @@ var FlatTintPipeline = new Class({
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
// Stubs
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [description]
|
|
||||||
*
|
|
||||||
* @method Phaser.Renderer.WebGL.Pipelines.FlatTintPipeline#drawStaticTilemapLayer
|
|
||||||
* @since 3.0.0
|
|
||||||
*
|
|
||||||
* @param {Phaser.Tilemaps.StaticTilemapLayer} tilemap - [description]
|
|
||||||
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
|
|
||||||
*/
|
|
||||||
drawStaticTilemapLayer: function ()
|
|
||||||
{
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [description]
|
|
||||||
*
|
|
||||||
* @method Phaser.Renderer.WebGL.Pipelines.FlatTintPipeline#drawEmitterManager
|
|
||||||
* @since 3.0.0
|
|
||||||
*
|
|
||||||
* @param {Phaser.GameObjects.Particles.ParticleEmitterManager} emitterManager - [description]
|
|
||||||
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
|
|
||||||
*/
|
|
||||||
drawEmitterManager: function ()
|
|
||||||
{
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [description]
|
|
||||||
*
|
|
||||||
* @method Phaser.Renderer.WebGL.Pipelines.FlatTintPipeline#drawBlitter
|
|
||||||
* @since 3.0.0
|
|
||||||
*
|
|
||||||
* @param {Phaser.GameObjects.Blitter} blitter - [description]
|
|
||||||
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
|
|
||||||
*/
|
|
||||||
drawBlitter: function ()
|
|
||||||
{
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [description]
|
|
||||||
*
|
|
||||||
* @method Phaser.Renderer.WebGL.Pipelines.FlatTintPipeline#batchSprite
|
|
||||||
* @since 3.0.0
|
|
||||||
*
|
|
||||||
* @param {Phaser.GameObjects.Sprite} sprite - [description]
|
|
||||||
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
|
|
||||||
*/
|
|
||||||
batchSprite: function ()
|
|
||||||
{
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [description]
|
|
||||||
*
|
|
||||||
* @method Phaser.Renderer.WebGL.Pipelines.FlatTintPipeline#batchMesh
|
|
||||||
* @since 3.0.0
|
|
||||||
*
|
|
||||||
* @param {Phaser.GameObjects.Mesh} mesh - [description]
|
|
||||||
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
|
|
||||||
*/
|
|
||||||
batchMesh: function ()
|
|
||||||
{
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [description]
|
|
||||||
*
|
|
||||||
* @method Phaser.Renderer.WebGL.Pipelines.FlatTintPipeline#batchBitmapText
|
|
||||||
* @since 3.0.0
|
|
||||||
*
|
|
||||||
* @param {Phaser.GameObjects.BitmapText} bitmapText - [description]
|
|
||||||
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
|
|
||||||
*/
|
|
||||||
batchBitmapText: function ()
|
|
||||||
{
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [description]
|
|
||||||
*
|
|
||||||
* @method Phaser.Renderer.WebGL.Pipelines.FlatTintPipeline#batchDynamicBitmapText
|
|
||||||
* @since 3.0.0
|
|
||||||
*
|
|
||||||
* @param {Phaser.GameObjects.DynamicBitmapText} bitmapText - [description]
|
|
||||||
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
|
|
||||||
*/
|
|
||||||
batchDynamicBitmapText: function ()
|
|
||||||
{
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [description]
|
|
||||||
*
|
|
||||||
* @method Phaser.Renderer.WebGL.Pipelines.FlatTintPipeline#batchText
|
|
||||||
* @since 3.0.0
|
|
||||||
*
|
|
||||||
* @param {Phaser.GameObjects.Text} text - [description]
|
|
||||||
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
|
|
||||||
*/
|
|
||||||
batchText: function ()
|
|
||||||
{
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [description]
|
|
||||||
*
|
|
||||||
* @method Phaser.Renderer.WebGL.Pipelines.FlatTintPipeline#batchDynamicTilemapLayer
|
|
||||||
* @since 3.0.0
|
|
||||||
*
|
|
||||||
* @param {Phaser.Tilemaps.DynamicTilemapLayer} tilemapLayer - [description]
|
|
||||||
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
|
|
||||||
*/
|
|
||||||
batchDynamicTilemapLayer: function ()
|
|
||||||
{
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [description]
|
|
||||||
*
|
|
||||||
* @method Phaser.Renderer.WebGL.Pipelines.FlatTintPipeline#batchTileSprite
|
|
||||||
* @since 3.0.0
|
|
||||||
*
|
|
||||||
* @param {Phaser.GameObjects.TileSprite} tileSprite - [description]
|
|
||||||
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
|
|
||||||
*/
|
|
||||||
batchTileSprite: function ()
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -397,7 +397,7 @@ var TextureTintPipeline = new Class({
|
||||||
|
|
||||||
this.renderer.setPipeline(this);
|
this.renderer.setPipeline(this);
|
||||||
|
|
||||||
var roundPixels = this.renderer.config.roundPixels;
|
var roundPixels = camera.roundPixels;
|
||||||
var emitters = emitterManager.emitters.list;
|
var emitters = emitterManager.emitters.list;
|
||||||
var emitterCount = emitters.length;
|
var emitterCount = emitters.length;
|
||||||
var vertexViewF32 = this.vertexViewF32;
|
var vertexViewF32 = this.vertexViewF32;
|
||||||
|
@ -502,18 +502,21 @@ var TextureTintPipeline = new Class({
|
||||||
var yh = y + frame.height;
|
var yh = y + frame.height;
|
||||||
var sr = sin(particle.rotation);
|
var sr = sin(particle.rotation);
|
||||||
var cr = cos(particle.rotation);
|
var cr = cos(particle.rotation);
|
||||||
|
|
||||||
var sra = cr * particle.scaleX;
|
var sra = cr * particle.scaleX;
|
||||||
var srb = sr * particle.scaleX;
|
var srb = sr * particle.scaleX;
|
||||||
var src = -sr * particle.scaleY;
|
var src = -sr * particle.scaleY;
|
||||||
var srd = cr * particle.scaleY;
|
var srd = cr * particle.scaleY;
|
||||||
var sre = particle.x - scrollX;
|
var sre = particle.x - scrollX;
|
||||||
var srf = particle.y - scrollY;
|
var srf = particle.y - scrollY;
|
||||||
|
|
||||||
var mva = sra * cma + srb * cmc;
|
var mva = sra * cma + srb * cmc;
|
||||||
var mvb = sra * cmb + srb * cmd;
|
var mvb = sra * cmb + srb * cmd;
|
||||||
var mvc = src * cma + srd * cmc;
|
var mvc = src * cma + srd * cmc;
|
||||||
var mvd = src * cmb + srd * cmd;
|
var mvd = src * cmb + srd * cmd;
|
||||||
var mve = sre * cma + srf * cmc + cme;
|
var mve = sre * cma + srf * cmc + cme;
|
||||||
var mvf = sre * cmb + srf * cmd + cmf;
|
var mvf = sre * cmb + srf * cmd + cmf;
|
||||||
|
|
||||||
var tx0 = x * mva + y * mvc + mve;
|
var tx0 = x * mva + y * mvc + mve;
|
||||||
var ty0 = x * mvb + y * mvd + mvf;
|
var ty0 = x * mvb + y * mvd + mvf;
|
||||||
var tx1 = x * mva + yh * mvc + mve;
|
var tx1 = x * mva + yh * mvc + mve;
|
||||||
|
@ -522,6 +525,7 @@ var TextureTintPipeline = new Class({
|
||||||
var ty2 = xw * mvb + yh * mvd + mvf;
|
var ty2 = xw * mvb + yh * mvd + mvf;
|
||||||
var tx3 = xw * mva + y * mvc + mve;
|
var tx3 = xw * mva + y * mvc + mve;
|
||||||
var ty3 = xw * mvb + y * mvd + mvf;
|
var ty3 = xw * mvb + y * mvd + mvf;
|
||||||
|
|
||||||
var vertexOffset = this.vertexCount * vertexComponentCount;
|
var vertexOffset = this.vertexCount * vertexComponentCount;
|
||||||
|
|
||||||
if (roundPixels)
|
if (roundPixels)
|
||||||
|
@ -541,26 +545,31 @@ var TextureTintPipeline = new Class({
|
||||||
vertexViewF32[vertexOffset + 2] = uvs.x0;
|
vertexViewF32[vertexOffset + 2] = uvs.x0;
|
||||||
vertexViewF32[vertexOffset + 3] = uvs.y0;
|
vertexViewF32[vertexOffset + 3] = uvs.y0;
|
||||||
vertexViewU32[vertexOffset + 4] = color;
|
vertexViewU32[vertexOffset + 4] = color;
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 5] = tx1;
|
vertexViewF32[vertexOffset + 5] = tx1;
|
||||||
vertexViewF32[vertexOffset + 6] = ty1;
|
vertexViewF32[vertexOffset + 6] = ty1;
|
||||||
vertexViewF32[vertexOffset + 7] = uvs.x1;
|
vertexViewF32[vertexOffset + 7] = uvs.x1;
|
||||||
vertexViewF32[vertexOffset + 8] = uvs.y1;
|
vertexViewF32[vertexOffset + 8] = uvs.y1;
|
||||||
vertexViewU32[vertexOffset + 9] = color;
|
vertexViewU32[vertexOffset + 9] = color;
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 10] = tx2;
|
vertexViewF32[vertexOffset + 10] = tx2;
|
||||||
vertexViewF32[vertexOffset + 11] = ty2;
|
vertexViewF32[vertexOffset + 11] = ty2;
|
||||||
vertexViewF32[vertexOffset + 12] = uvs.x2;
|
vertexViewF32[vertexOffset + 12] = uvs.x2;
|
||||||
vertexViewF32[vertexOffset + 13] = uvs.y2;
|
vertexViewF32[vertexOffset + 13] = uvs.y2;
|
||||||
vertexViewU32[vertexOffset + 14] = color;
|
vertexViewU32[vertexOffset + 14] = color;
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 15] = tx0;
|
vertexViewF32[vertexOffset + 15] = tx0;
|
||||||
vertexViewF32[vertexOffset + 16] = ty0;
|
vertexViewF32[vertexOffset + 16] = ty0;
|
||||||
vertexViewF32[vertexOffset + 17] = uvs.x0;
|
vertexViewF32[vertexOffset + 17] = uvs.x0;
|
||||||
vertexViewF32[vertexOffset + 18] = uvs.y0;
|
vertexViewF32[vertexOffset + 18] = uvs.y0;
|
||||||
vertexViewU32[vertexOffset + 19] = color;
|
vertexViewU32[vertexOffset + 19] = color;
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 20] = tx2;
|
vertexViewF32[vertexOffset + 20] = tx2;
|
||||||
vertexViewF32[vertexOffset + 21] = ty2;
|
vertexViewF32[vertexOffset + 21] = ty2;
|
||||||
vertexViewF32[vertexOffset + 22] = uvs.x2;
|
vertexViewF32[vertexOffset + 22] = uvs.x2;
|
||||||
vertexViewF32[vertexOffset + 23] = uvs.y2;
|
vertexViewF32[vertexOffset + 23] = uvs.y2;
|
||||||
vertexViewU32[vertexOffset + 24] = color;
|
vertexViewU32[vertexOffset + 24] = color;
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 25] = tx3;
|
vertexViewF32[vertexOffset + 25] = tx3;
|
||||||
vertexViewF32[vertexOffset + 26] = ty3;
|
vertexViewF32[vertexOffset + 26] = ty3;
|
||||||
vertexViewF32[vertexOffset + 27] = uvs.x3;
|
vertexViewF32[vertexOffset + 27] = uvs.x3;
|
||||||
|
@ -574,7 +583,6 @@ var TextureTintPipeline = new Class({
|
||||||
this.flush();
|
this.flush();
|
||||||
this.setTexture2D(texture, 0);
|
this.setTexture2D(texture, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
particleOffset += batchSize;
|
particleOffset += batchSize;
|
||||||
|
@ -612,7 +620,7 @@ var TextureTintPipeline = new Class({
|
||||||
|
|
||||||
this.renderer.setPipeline(this);
|
this.renderer.setPipeline(this);
|
||||||
|
|
||||||
var roundPixels = this.renderer.config.roundPixels;
|
var roundPixels = camera.roundPixels;
|
||||||
var getTint = Utils.getTintAppendFloatAlpha;
|
var getTint = Utils.getTintAppendFloatAlpha;
|
||||||
var vertexViewF32 = this.vertexViewF32;
|
var vertexViewF32 = this.vertexViewF32;
|
||||||
var vertexViewU32 = this.vertexViewU32;
|
var vertexViewU32 = this.vertexViewU32;
|
||||||
|
@ -665,6 +673,8 @@ var TextureTintPipeline = new Class({
|
||||||
|
|
||||||
var prevTextureSourceIndex;
|
var prevTextureSourceIndex;
|
||||||
|
|
||||||
|
var alpha = camera.alpha * blitter.alpha;
|
||||||
|
|
||||||
for (var batchIndex = 0; batchIndex < batchCount; ++batchIndex)
|
for (var batchIndex = 0; batchIndex < batchCount; ++batchIndex)
|
||||||
{
|
{
|
||||||
var batchSize = Math.min(length, this.maxQuads);
|
var batchSize = Math.min(length, this.maxQuads);
|
||||||
|
@ -673,15 +683,15 @@ var TextureTintPipeline = new Class({
|
||||||
{
|
{
|
||||||
var bob = list[batchOffset + index];
|
var bob = list[batchOffset + index];
|
||||||
var frame = bob.frame;
|
var frame = bob.frame;
|
||||||
var alpha = bob.alpha;
|
var bobAlpha = bob.alpha * alpha;
|
||||||
|
|
||||||
if (alpha === 0)
|
if (bobAlpha === 0)
|
||||||
{
|
{
|
||||||
// Nothing to see here, moving on ...
|
// Nothing to see here, moving on ...
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var tint = getTint(0xffffff, alpha);
|
var tint = getTint(0xffffff, bobAlpha);
|
||||||
var uvs = frame.uvs;
|
var uvs = frame.uvs;
|
||||||
var flipX = bob.flipX;
|
var flipX = bob.flipX;
|
||||||
var flipY = bob.flipY;
|
var flipY = bob.flipY;
|
||||||
|
@ -791,34 +801,36 @@ var TextureTintPipeline = new Class({
|
||||||
this.flush();
|
this.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
var roundPixels = this.renderer.config.roundPixels;
|
|
||||||
var getTint = Utils.getTintAppendFloatAlpha;
|
|
||||||
var vertexViewF32 = this.vertexViewF32;
|
|
||||||
var vertexViewU32 = this.vertexViewU32;
|
|
||||||
var cameraMatrix = camera.matrix.matrix;
|
|
||||||
var frame = sprite.frame;
|
var frame = sprite.frame;
|
||||||
var texture = frame.texture.source[frame.sourceIndex].glTexture;
|
var texture = frame.texture.source[frame.sourceIndex].glTexture;
|
||||||
|
var getTint = Utils.getTintAppendFloatAlpha;
|
||||||
var forceFlipY = (texture.isRenderTexture ? true : false);
|
var forceFlipY = (texture.isRenderTexture ? true : false);
|
||||||
var flipX = sprite.flipX;
|
var flipX = sprite.flipX;
|
||||||
var flipY = sprite.flipY ^ forceFlipY;
|
var flipY = sprite.flipY ^ forceFlipY;
|
||||||
var uvs = frame.uvs;
|
var uvs = frame.uvs;
|
||||||
|
|
||||||
|
var scaleX = sprite.scaleX;
|
||||||
|
var scaleY = sprite.scaleY;
|
||||||
|
var rotation = sprite.rotation;
|
||||||
|
var alphaTL = camera.alpha * sprite._alphaTL;
|
||||||
|
var alphaTR = camera.alpha * sprite._alphaTR;
|
||||||
|
var alphaBL = camera.alpha * sprite._alphaBL;
|
||||||
|
var alphaBR = camera.alpha * sprite._alphaBR;
|
||||||
|
var tintTL = sprite._tintTL;
|
||||||
|
var tintTR = sprite._tintTR;
|
||||||
|
var tintBL = sprite._tintBL;
|
||||||
|
var tintBR = sprite._tintBR;
|
||||||
|
|
||||||
|
var roundPixels = camera.roundPixels;
|
||||||
|
var vertexViewF32 = this.vertexViewF32;
|
||||||
|
var vertexViewU32 = this.vertexViewU32;
|
||||||
|
var cameraMatrix = camera.matrix.matrix;
|
||||||
var width = frame.width * (flipX ? -1.0 : 1.0);
|
var width = frame.width * (flipX ? -1.0 : 1.0);
|
||||||
var height = frame.height * (flipY ? -1.0 : 1.0);
|
var height = frame.height * (flipY ? -1.0 : 1.0);
|
||||||
var x = -sprite.displayOriginX + frame.x + ((frame.width) * (flipX ? 1.0 : 0.0));
|
var x = -sprite.displayOriginX + frame.x + ((frame.width) * (flipX ? 1.0 : 0.0));
|
||||||
var y = -sprite.displayOriginY + frame.y + ((frame.height) * (flipY ? 1.0 : 0.0));
|
var y = -sprite.displayOriginY + frame.y + ((frame.height) * (flipY ? 1.0 : 0.0));
|
||||||
var xw = (roundPixels ? (x | 0) : x) + width;
|
var xw = (roundPixels ? (x | 0) : x) + width;
|
||||||
var yh = (roundPixels ? (y | 0) : y) + height;
|
var yh = (roundPixels ? (y | 0) : y) + height;
|
||||||
var scaleX = sprite.scaleX;
|
|
||||||
var scaleY = sprite.scaleY;
|
|
||||||
var rotation = sprite.rotation;
|
|
||||||
var alphaTL = sprite._alphaTL;
|
|
||||||
var alphaTR = sprite._alphaTR;
|
|
||||||
var alphaBL = sprite._alphaBL;
|
|
||||||
var alphaBR = sprite._alphaBR;
|
|
||||||
var tintTL = sprite._tintTL;
|
|
||||||
var tintTR = sprite._tintTR;
|
|
||||||
var tintBL = sprite._tintBL;
|
|
||||||
var tintBR = sprite._tintBR;
|
|
||||||
var sr = Math.sin(rotation);
|
var sr = Math.sin(rotation);
|
||||||
var cr = Math.cos(rotation);
|
var cr = Math.cos(rotation);
|
||||||
var sra = cr * scaleX;
|
var sra = cr * scaleX;
|
||||||
|
@ -886,7 +898,6 @@ var TextureTintPipeline = new Class({
|
||||||
var vTintTR = getTint(tintTR, alphaTR);
|
var vTintTR = getTint(tintTR, alphaTR);
|
||||||
var vTintBL = getTint(tintBL, alphaBL);
|
var vTintBL = getTint(tintBL, alphaBL);
|
||||||
var vTintBR = getTint(tintBR, alphaBR);
|
var vTintBR = getTint(tintBR, alphaBR);
|
||||||
var vertexOffset = 0;
|
|
||||||
|
|
||||||
if (roundPixels)
|
if (roundPixels)
|
||||||
{
|
{
|
||||||
|
@ -902,33 +913,38 @@ var TextureTintPipeline = new Class({
|
||||||
|
|
||||||
this.setTexture2D(texture, 0);
|
this.setTexture2D(texture, 0);
|
||||||
|
|
||||||
vertexOffset = this.vertexCount * this.vertexComponentCount;
|
var vertexOffset = this.vertexCount * this.vertexComponentCount;
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 0] = tx0;
|
vertexViewF32[vertexOffset + 0] = tx0;
|
||||||
vertexViewF32[vertexOffset + 1] = ty0;
|
vertexViewF32[vertexOffset + 1] = ty0;
|
||||||
vertexViewF32[vertexOffset + 2] = uvs.x0;
|
vertexViewF32[vertexOffset + 2] = uvs.x0;
|
||||||
vertexViewF32[vertexOffset + 3] = uvs.y0;
|
vertexViewF32[vertexOffset + 3] = uvs.y0;
|
||||||
vertexViewU32[vertexOffset + 4] = vTintTL;
|
vertexViewU32[vertexOffset + 4] = vTintTL;
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 5] = tx1;
|
vertexViewF32[vertexOffset + 5] = tx1;
|
||||||
vertexViewF32[vertexOffset + 6] = ty1;
|
vertexViewF32[vertexOffset + 6] = ty1;
|
||||||
vertexViewF32[vertexOffset + 7] = uvs.x1;
|
vertexViewF32[vertexOffset + 7] = uvs.x1;
|
||||||
vertexViewF32[vertexOffset + 8] = uvs.y1;
|
vertexViewF32[vertexOffset + 8] = uvs.y1;
|
||||||
vertexViewU32[vertexOffset + 9] = vTintBL;
|
vertexViewU32[vertexOffset + 9] = vTintBL;
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 10] = tx2;
|
vertexViewF32[vertexOffset + 10] = tx2;
|
||||||
vertexViewF32[vertexOffset + 11] = ty2;
|
vertexViewF32[vertexOffset + 11] = ty2;
|
||||||
vertexViewF32[vertexOffset + 12] = uvs.x2;
|
vertexViewF32[vertexOffset + 12] = uvs.x2;
|
||||||
vertexViewF32[vertexOffset + 13] = uvs.y2;
|
vertexViewF32[vertexOffset + 13] = uvs.y2;
|
||||||
vertexViewU32[vertexOffset + 14] = vTintBR;
|
vertexViewU32[vertexOffset + 14] = vTintBR;
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 15] = tx0;
|
vertexViewF32[vertexOffset + 15] = tx0;
|
||||||
vertexViewF32[vertexOffset + 16] = ty0;
|
vertexViewF32[vertexOffset + 16] = ty0;
|
||||||
vertexViewF32[vertexOffset + 17] = uvs.x0;
|
vertexViewF32[vertexOffset + 17] = uvs.x0;
|
||||||
vertexViewF32[vertexOffset + 18] = uvs.y0;
|
vertexViewF32[vertexOffset + 18] = uvs.y0;
|
||||||
vertexViewU32[vertexOffset + 19] = vTintTL;
|
vertexViewU32[vertexOffset + 19] = vTintTL;
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 20] = tx2;
|
vertexViewF32[vertexOffset + 20] = tx2;
|
||||||
vertexViewF32[vertexOffset + 21] = ty2;
|
vertexViewF32[vertexOffset + 21] = ty2;
|
||||||
vertexViewF32[vertexOffset + 22] = uvs.x2;
|
vertexViewF32[vertexOffset + 22] = uvs.x2;
|
||||||
vertexViewF32[vertexOffset + 23] = uvs.y2;
|
vertexViewF32[vertexOffset + 23] = uvs.y2;
|
||||||
vertexViewU32[vertexOffset + 24] = vTintBR;
|
vertexViewU32[vertexOffset + 24] = vTintBR;
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 25] = tx3;
|
vertexViewF32[vertexOffset + 25] = tx3;
|
||||||
vertexViewF32[vertexOffset + 26] = ty3;
|
vertexViewF32[vertexOffset + 26] = ty3;
|
||||||
vertexViewF32[vertexOffset + 27] = uvs.x3;
|
vertexViewF32[vertexOffset + 27] = uvs.x3;
|
||||||
|
@ -968,7 +984,7 @@ var TextureTintPipeline = new Class({
|
||||||
this.flush();
|
this.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
var roundPixels = this.renderer.config.roundPixels;
|
var roundPixels = camera.roundPixels;
|
||||||
var getTint = Utils.getTintAppendFloatAlpha;
|
var getTint = Utils.getTintAppendFloatAlpha;
|
||||||
var uvs = mesh.uv;
|
var uvs = mesh.uv;
|
||||||
var colors = mesh.colors;
|
var colors = mesh.colors;
|
||||||
|
@ -1060,7 +1076,7 @@ var TextureTintPipeline = new Class({
|
||||||
vertexViewF32[vertexOffset + 1] = ty;
|
vertexViewF32[vertexOffset + 1] = ty;
|
||||||
vertexViewF32[vertexOffset + 2] = uvs[index + 0];
|
vertexViewF32[vertexOffset + 2] = uvs[index + 0];
|
||||||
vertexViewF32[vertexOffset + 3] = uvs[index + 1];
|
vertexViewF32[vertexOffset + 3] = uvs[index + 1];
|
||||||
vertexViewU32[vertexOffset + 4] = getTint(colors[index0], alphas[index0]);
|
vertexViewU32[vertexOffset + 4] = getTint(colors[index0], camera.alpha * alphas[index0]);
|
||||||
|
|
||||||
vertexOffset += 5;
|
vertexOffset += 5;
|
||||||
index0 += 1;
|
index0 += 1;
|
||||||
|
@ -1095,7 +1111,7 @@ var TextureTintPipeline = new Class({
|
||||||
this.flush();
|
this.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
var roundPixels = this.renderer.config.roundPixels;
|
var roundPixels = camera.roundPixels;
|
||||||
var text = bitmapText.text;
|
var text = bitmapText.text;
|
||||||
var textLength = text.length;
|
var textLength = text.length;
|
||||||
var getTint = Utils.getTintAppendFloatAlpha;
|
var getTint = Utils.getTintAppendFloatAlpha;
|
||||||
|
@ -1114,7 +1130,7 @@ var TextureTintPipeline = new Class({
|
||||||
var lineHeight = fontData.lineHeight;
|
var lineHeight = fontData.lineHeight;
|
||||||
var scale = (bitmapText.fontSize / fontData.size);
|
var scale = (bitmapText.fontSize / fontData.size);
|
||||||
var chars = fontData.chars;
|
var chars = fontData.chars;
|
||||||
var alpha = bitmapText.alpha;
|
var alpha = camera.alpha * bitmapText.alpha;
|
||||||
var vTintTL = getTint(bitmapText._tintTL, alpha);
|
var vTintTL = getTint(bitmapText._tintTL, alpha);
|
||||||
var vTintTR = getTint(bitmapText._tintTR, alpha);
|
var vTintTR = getTint(bitmapText._tintTR, alpha);
|
||||||
var vTintBL = getTint(bitmapText._tintBL, alpha);
|
var vTintBL = getTint(bitmapText._tintBL, alpha);
|
||||||
|
@ -1372,7 +1388,7 @@ var TextureTintPipeline = new Class({
|
||||||
this.flush();
|
this.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
var roundPixels = this.renderer.config.roundPixels;
|
var roundPixels = camera.roundPixels;
|
||||||
var displayCallback = bitmapText.displayCallback;
|
var displayCallback = bitmapText.displayCallback;
|
||||||
var text = bitmapText.text;
|
var text = bitmapText.text;
|
||||||
var textLength = text.length;
|
var textLength = text.length;
|
||||||
|
@ -1391,7 +1407,7 @@ var TextureTintPipeline = new Class({
|
||||||
var lineHeight = fontData.lineHeight;
|
var lineHeight = fontData.lineHeight;
|
||||||
var scale = (bitmapText.fontSize / fontData.size);
|
var scale = (bitmapText.fontSize / fontData.size);
|
||||||
var chars = fontData.chars;
|
var chars = fontData.chars;
|
||||||
var alpha = bitmapText.alpha;
|
var alpha = camera.alpha * bitmapText.alpha;
|
||||||
var vTintTL = getTint(bitmapText._tintTL, alpha);
|
var vTintTL = getTint(bitmapText._tintTL, alpha);
|
||||||
var vTintTR = getTint(bitmapText._tintTR, alpha);
|
var vTintTR = getTint(bitmapText._tintTR, alpha);
|
||||||
var vTintBL = getTint(bitmapText._tintBL, alpha);
|
var vTintBL = getTint(bitmapText._tintBL, alpha);
|
||||||
|
@ -1722,10 +1738,10 @@ var TextureTintPipeline = new Class({
|
||||||
text.scrollFactorX, text.scrollFactorY,
|
text.scrollFactorX, text.scrollFactorY,
|
||||||
text.displayOriginX, text.displayOriginY,
|
text.displayOriginX, text.displayOriginY,
|
||||||
0, 0, text.canvasTexture.width, text.canvasTexture.height,
|
0, 0, text.canvasTexture.width, text.canvasTexture.height,
|
||||||
getTint(text._tintTL, text._alphaTL),
|
getTint(text._tintTL, camera.alpha * text._alphaTL),
|
||||||
getTint(text._tintTR, text._alphaTR),
|
getTint(text._tintTR, camera.alpha * text._alphaTR),
|
||||||
getTint(text._tintBL, text._alphaBL),
|
getTint(text._tintBL, camera.alpha * text._alphaBL),
|
||||||
getTint(text._tintBR, text._alphaBR),
|
getTint(text._tintBR, camera.alpha * text._alphaBR),
|
||||||
0, 0,
|
0, 0,
|
||||||
camera,
|
camera,
|
||||||
parentTransformMatrix
|
parentTransformMatrix
|
||||||
|
@ -1750,7 +1766,7 @@ var TextureTintPipeline = new Class({
|
||||||
var tileset = tilemapLayer.tileset;
|
var tileset = tilemapLayer.tileset;
|
||||||
var scrollFactorX = tilemapLayer.scrollFactorX;
|
var scrollFactorX = tilemapLayer.scrollFactorX;
|
||||||
var scrollFactorY = tilemapLayer.scrollFactorY;
|
var scrollFactorY = tilemapLayer.scrollFactorY;
|
||||||
var alpha = tilemapLayer.alpha;
|
var alpha = camera.alpha * tilemapLayer.alpha;
|
||||||
var x = tilemapLayer.x;
|
var x = tilemapLayer.x;
|
||||||
var y = tilemapLayer.y;
|
var y = tilemapLayer.y;
|
||||||
var sx = tilemapLayer.scaleX;
|
var sx = tilemapLayer.scaleX;
|
||||||
|
@ -1790,43 +1806,6 @@ var TextureTintPipeline = new Class({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Batches TileSprite game object
|
|
||||||
*
|
|
||||||
* @method Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline#batchTileSprite
|
|
||||||
* @since 3.0.0
|
|
||||||
*
|
|
||||||
* @param {Phaser.GameObjects.TileSprite} tileSprite - [description]
|
|
||||||
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
|
|
||||||
* @param {Phaser.GameObjects.Components.TransformMatrix} parentTransformMatrix - [description]
|
|
||||||
*/
|
|
||||||
batchTileSprite: function (tileSprite, camera, parentTransformMatrix)
|
|
||||||
{
|
|
||||||
var getTint = Utils.getTintAppendFloatAlpha;
|
|
||||||
|
|
||||||
this.batchTexture(
|
|
||||||
tileSprite,
|
|
||||||
tileSprite.tileTexture,
|
|
||||||
tileSprite.frame.width, tileSprite.frame.height,
|
|
||||||
tileSprite.x, tileSprite.y,
|
|
||||||
tileSprite.width, tileSprite.height,
|
|
||||||
tileSprite.scaleX, tileSprite.scaleY,
|
|
||||||
tileSprite.rotation,
|
|
||||||
tileSprite.flipX, tileSprite.flipY,
|
|
||||||
tileSprite.scrollFactorX, tileSprite.scrollFactorY,
|
|
||||||
tileSprite.originX * tileSprite.width, tileSprite.originY * tileSprite.height,
|
|
||||||
0, 0, tileSprite.width, tileSprite.height,
|
|
||||||
getTint(tileSprite._tintTL, tileSprite._alphaTL),
|
|
||||||
getTint(tileSprite._tintTR, tileSprite._alphaTR),
|
|
||||||
getTint(tileSprite._tintBL, tileSprite._alphaBL),
|
|
||||||
getTint(tileSprite._tintBR, tileSprite._alphaBR),
|
|
||||||
(tileSprite.tilePositionX % tileSprite.frame.width) / tileSprite.frame.width,
|
|
||||||
(tileSprite.tilePositionY % tileSprite.frame.height) / tileSprite.frame.height,
|
|
||||||
camera,
|
|
||||||
parentTransformMatrix
|
|
||||||
);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic function for batching a textured quad
|
* Generic function for batching a textured quad
|
||||||
*
|
*
|
||||||
|
@ -1837,29 +1816,29 @@ var TextureTintPipeline = new Class({
|
||||||
* @param {WebGLTexture} texture - Raw WebGLTexture associated with the quad
|
* @param {WebGLTexture} texture - Raw WebGLTexture associated with the quad
|
||||||
* @param {integer} textureWidth - Real texture width
|
* @param {integer} textureWidth - Real texture width
|
||||||
* @param {integer} textureHeight - Real texture height
|
* @param {integer} textureHeight - Real texture height
|
||||||
* @param {float} srcX - X coordinate of the quad
|
* @param {number} srcX - X coordinate of the quad
|
||||||
* @param {float} srcY - Y coordinate of the quad
|
* @param {number} srcY - Y coordinate of the quad
|
||||||
* @param {float} srcWidth - Width of the quad
|
* @param {number} srcWidth - Width of the quad
|
||||||
* @param {float} srcHeight - Height of the quad
|
* @param {number} srcHeight - Height of the quad
|
||||||
* @param {float} scaleX - X component of scale
|
* @param {number} scaleX - X component of scale
|
||||||
* @param {float} scaleY - Y component of scale
|
* @param {number} scaleY - Y component of scale
|
||||||
* @param {float} rotation - Rotation of the quad
|
* @param {number} rotation - Rotation of the quad
|
||||||
* @param {boolean} flipX - Indicates if the quad is horizontally flipped
|
* @param {boolean} flipX - Indicates if the quad is horizontally flipped
|
||||||
* @param {boolean} flipY - Indicates if the quad is vertically flipped
|
* @param {boolean} flipY - Indicates if the quad is vertically flipped
|
||||||
* @param {float} scrollFactorX - By which factor is the quad affected by the camera horizontal scroll
|
* @param {number} scrollFactorX - By which factor is the quad affected by the camera horizontal scroll
|
||||||
* @param {float} scrollFactorY - By which factor is the quad effected by the camera vertical scroll
|
* @param {number} scrollFactorY - By which factor is the quad effected by the camera vertical scroll
|
||||||
* @param {float} displayOriginX - Horizontal origin in pixels
|
* @param {number} displayOriginX - Horizontal origin in pixels
|
||||||
* @param {float} displayOriginY - Vertical origin in pixels
|
* @param {number} displayOriginY - Vertical origin in pixels
|
||||||
* @param {float} frameX - X coordinate of the texture frame
|
* @param {number} frameX - X coordinate of the texture frame
|
||||||
* @param {float} frameY - Y coordinate of the texture frame
|
* @param {number} frameY - Y coordinate of the texture frame
|
||||||
* @param {float} frameWidth - Width of the texture frame
|
* @param {number} frameWidth - Width of the texture frame
|
||||||
* @param {float} frameHeight - Height of the texture frame
|
* @param {number} frameHeight - Height of the texture frame
|
||||||
* @param {integer} tintTL - Tint for top left
|
* @param {integer} tintTL - Tint for top left
|
||||||
* @param {integer} tintTR - Tint for top right
|
* @param {integer} tintTR - Tint for top right
|
||||||
* @param {integer} tintBL - Tint for bottom left
|
* @param {integer} tintBL - Tint for bottom left
|
||||||
* @param {integer} tintBR - Tint for bottom right
|
* @param {integer} tintBR - Tint for bottom right
|
||||||
* @param {float} uOffset - Horizontal offset on texture coordinate
|
* @param {number} uOffset - Horizontal offset on texture coordinate
|
||||||
* @param {float} vOffset - Vertical offset on texture coordinate
|
* @param {number} vOffset - Vertical offset on texture coordinate
|
||||||
* @param {Phaser.Cameras.Scene2D.Camera} camera - Current used camera
|
* @param {Phaser.Cameras.Scene2D.Camera} camera - Current used camera
|
||||||
* @param {Phaser.GameObjects.Components.TransformMatrix} parentTransformMatrix - Parent container
|
* @param {Phaser.GameObjects.Components.TransformMatrix} parentTransformMatrix - Parent container
|
||||||
*/
|
*/
|
||||||
|
@ -1896,7 +1875,7 @@ var TextureTintPipeline = new Class({
|
||||||
|
|
||||||
flipY = flipY ^ (texture.isRenderTexture ? 1 : 0);
|
flipY = flipY ^ (texture.isRenderTexture ? 1 : 0);
|
||||||
|
|
||||||
var roundPixels = this.renderer.config.roundPixels;
|
var roundPixels = camera.roundPixels;
|
||||||
var vertexViewF32 = this.vertexViewF32;
|
var vertexViewF32 = this.vertexViewF32;
|
||||||
var vertexViewU32 = this.vertexViewU32;
|
var vertexViewU32 = this.vertexViewU32;
|
||||||
var cameraMatrix = camera.matrix.matrix;
|
var cameraMatrix = camera.matrix.matrix;
|
||||||
|
@ -1904,18 +1883,20 @@ var TextureTintPipeline = new Class({
|
||||||
var height = srcHeight * (flipY ? -1.0 : 1.0);
|
var height = srcHeight * (flipY ? -1.0 : 1.0);
|
||||||
var x = -displayOriginX + ((srcWidth) * (flipX ? 1.0 : 0.0));
|
var x = -displayOriginX + ((srcWidth) * (flipX ? 1.0 : 0.0));
|
||||||
var y = -displayOriginY + ((srcHeight) * (flipY ? 1.0 : 0.0));
|
var y = -displayOriginY + ((srcHeight) * (flipY ? 1.0 : 0.0));
|
||||||
var xw = x + width;
|
|
||||||
var yh = y + height;
|
// var x = -displayOriginX + frameX + ((frameWidth) * (flipX ? 1.0 : 0.0));
|
||||||
var translateX = srcX;
|
// var y = -displayOriginY + frameY + ((frameHeight) * (flipY ? 1.0 : 0.0));
|
||||||
var translateY = srcY;
|
|
||||||
|
var xw = (roundPixels ? (x | 0) : x) + width;
|
||||||
|
var yh = (roundPixels ? (y | 0) : y) + height;
|
||||||
var sr = Math.sin(rotation);
|
var sr = Math.sin(rotation);
|
||||||
var cr = Math.cos(rotation);
|
var cr = Math.cos(rotation);
|
||||||
var sra = cr * scaleX;
|
var sra = cr * scaleX;
|
||||||
var srb = sr * scaleX;
|
var srb = sr * scaleX;
|
||||||
var src = -sr * scaleY;
|
var src = -sr * scaleY;
|
||||||
var srd = cr * scaleY;
|
var srd = cr * scaleY;
|
||||||
var sre = translateX;
|
var sre = srcX;
|
||||||
var srf = translateY;
|
var srf = srcY;
|
||||||
var cma = cameraMatrix[0];
|
var cma = cameraMatrix[0];
|
||||||
var cmb = cameraMatrix[1];
|
var cmb = cameraMatrix[1];
|
||||||
var cmc = cameraMatrix[2];
|
var cmc = cameraMatrix[2];
|
||||||
|
@ -1971,16 +1952,12 @@ var TextureTintPipeline = new Class({
|
||||||
var ty2 = xw * mvb + yh * mvd + mvf;
|
var ty2 = xw * mvb + yh * mvd + mvf;
|
||||||
var tx3 = xw * mva + y * mvc + mve;
|
var tx3 = xw * mva + y * mvc + mve;
|
||||||
var ty3 = xw * mvb + y * mvd + mvf;
|
var ty3 = xw * mvb + y * mvd + mvf;
|
||||||
var vertexOffset = 0;
|
|
||||||
var u0 = (frameX / textureWidth) + uOffset;
|
var u0 = (frameX / textureWidth) + uOffset;
|
||||||
var v0 = (frameY / textureHeight) + vOffset;
|
var v0 = (frameY / textureHeight) + vOffset;
|
||||||
var u1 = (frameX + frameWidth) / textureWidth + uOffset;
|
var u1 = (frameX + frameWidth) / textureWidth + uOffset;
|
||||||
var v1 = (frameY + frameHeight) / textureHeight + vOffset;
|
var v1 = (frameY + frameHeight) / textureHeight + vOffset;
|
||||||
|
|
||||||
this.setTexture2D(texture, 0);
|
|
||||||
|
|
||||||
vertexOffset = this.vertexCount * this.vertexComponentCount;
|
|
||||||
|
|
||||||
if (roundPixels)
|
if (roundPixels)
|
||||||
{
|
{
|
||||||
tx0 |= 0;
|
tx0 |= 0;
|
||||||
|
@ -1993,31 +1970,40 @@ var TextureTintPipeline = new Class({
|
||||||
ty3 |= 0;
|
ty3 |= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.setTexture2D(texture, 0);
|
||||||
|
|
||||||
|
var vertexOffset = this.vertexCount * this.vertexComponentCount;
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 0] = tx0;
|
vertexViewF32[vertexOffset + 0] = tx0;
|
||||||
vertexViewF32[vertexOffset + 1] = ty0;
|
vertexViewF32[vertexOffset + 1] = ty0;
|
||||||
vertexViewF32[vertexOffset + 2] = u0;
|
vertexViewF32[vertexOffset + 2] = u0;
|
||||||
vertexViewF32[vertexOffset + 3] = v0;
|
vertexViewF32[vertexOffset + 3] = v0;
|
||||||
vertexViewU32[vertexOffset + 4] = tintTL;
|
vertexViewU32[vertexOffset + 4] = tintTL;
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 5] = tx1;
|
vertexViewF32[vertexOffset + 5] = tx1;
|
||||||
vertexViewF32[vertexOffset + 6] = ty1;
|
vertexViewF32[vertexOffset + 6] = ty1;
|
||||||
vertexViewF32[vertexOffset + 7] = u0;
|
vertexViewF32[vertexOffset + 7] = u0;
|
||||||
vertexViewF32[vertexOffset + 8] = v1;
|
vertexViewF32[vertexOffset + 8] = v1;
|
||||||
vertexViewU32[vertexOffset + 9] = tintTR;
|
vertexViewU32[vertexOffset + 9] = tintTR;
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 10] = tx2;
|
vertexViewF32[vertexOffset + 10] = tx2;
|
||||||
vertexViewF32[vertexOffset + 11] = ty2;
|
vertexViewF32[vertexOffset + 11] = ty2;
|
||||||
vertexViewF32[vertexOffset + 12] = u1;
|
vertexViewF32[vertexOffset + 12] = u1;
|
||||||
vertexViewF32[vertexOffset + 13] = v1;
|
vertexViewF32[vertexOffset + 13] = v1;
|
||||||
vertexViewU32[vertexOffset + 14] = tintBL;
|
vertexViewU32[vertexOffset + 14] = tintBL;
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 15] = tx0;
|
vertexViewF32[vertexOffset + 15] = tx0;
|
||||||
vertexViewF32[vertexOffset + 16] = ty0;
|
vertexViewF32[vertexOffset + 16] = ty0;
|
||||||
vertexViewF32[vertexOffset + 17] = u0;
|
vertexViewF32[vertexOffset + 17] = u0;
|
||||||
vertexViewF32[vertexOffset + 18] = v0;
|
vertexViewF32[vertexOffset + 18] = v0;
|
||||||
vertexViewU32[vertexOffset + 19] = tintTL;
|
vertexViewU32[vertexOffset + 19] = tintTL;
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 20] = tx2;
|
vertexViewF32[vertexOffset + 20] = tx2;
|
||||||
vertexViewF32[vertexOffset + 21] = ty2;
|
vertexViewF32[vertexOffset + 21] = ty2;
|
||||||
vertexViewF32[vertexOffset + 22] = u1;
|
vertexViewF32[vertexOffset + 22] = u1;
|
||||||
vertexViewF32[vertexOffset + 23] = v1;
|
vertexViewF32[vertexOffset + 23] = v1;
|
||||||
vertexViewU32[vertexOffset + 24] = tintBL;
|
vertexViewU32[vertexOffset + 24] = tintBL;
|
||||||
|
|
||||||
vertexViewF32[vertexOffset + 25] = tx3;
|
vertexViewF32[vertexOffset + 25] = tx3;
|
||||||
vertexViewF32[vertexOffset + 26] = ty3;
|
vertexViewF32[vertexOffset + 26] = ty3;
|
||||||
vertexViewF32[vertexOffset + 27] = u1;
|
vertexViewF32[vertexOffset + 27] = u1;
|
||||||
|
@ -2176,20 +2162,6 @@ var TextureTintPipeline = new Class({
|
||||||
|
|
||||||
// Force an immediate draw
|
// Force an immediate draw
|
||||||
this.flush();
|
this.flush();
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [description]
|
|
||||||
*
|
|
||||||
* @method Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline#batchGraphics
|
|
||||||
* @since 3.0.0
|
|
||||||
*
|
|
||||||
* @param {Phaser.GameObjects.Graphics} graphics - [description]
|
|
||||||
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
|
|
||||||
*/
|
|
||||||
batchGraphics: function ()
|
|
||||||
{
|
|
||||||
// Stub
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue