mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 21:53:59 +00:00
Phaser 2.2.0 Release Candidate 7.
This commit is contained in:
parent
deeb2c4942
commit
a41226cdad
14 changed files with 3461 additions and 2075 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -16,3 +16,4 @@ node_modules/
|
|||
# Build
|
||||
dist/
|
||||
/npm-debug.log
|
||||
out/
|
File diff suppressed because it is too large
Load diff
36
build/custom/phaser-arcade-physics.min.js
vendored
36
build/custom/phaser-arcade-physics.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load diff
38
build/custom/phaser-ninja-physics.min.js
vendored
38
build/custom/phaser-ninja-physics.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load diff
22
build/custom/phaser-no-libs.min.js
vendored
22
build/custom/phaser-no-libs.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load diff
32
build/custom/phaser-no-physics.min.js
vendored
32
build/custom/phaser-no-physics.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -11,23 +11,63 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* The [pixi.js](http://www.pixijs.com/) module/namespace.
|
||||
*
|
||||
* @module PIXI
|
||||
*/
|
||||
|
||||
/**
|
||||
* Namespace-class for [pixi.js](http://www.pixijs.com/).
|
||||
*
|
||||
* Contains assorted static properties and enumerations.
|
||||
*
|
||||
* @class PIXI
|
||||
* @static
|
||||
*/
|
||||
var PIXI = PIXI || {};
|
||||
|
||||
/*
|
||||
*
|
||||
* This file contains a lot of pixi consts which are used across the rendering engine
|
||||
* @class Consts
|
||||
*/
|
||||
/**
|
||||
* @property {Number} WEBGL_RENDERER
|
||||
* @protected
|
||||
* @static
|
||||
*/
|
||||
PIXI.WEBGL_RENDERER = 0;
|
||||
/**
|
||||
* @property {Number} CANVAS_RENDERER
|
||||
* @protected
|
||||
* @static
|
||||
*/
|
||||
PIXI.CANVAS_RENDERER = 1;
|
||||
|
||||
// useful for testing against if your lib is using pixi.
|
||||
/**
|
||||
* Version of pixi that is loaded.
|
||||
* @property {String} VERSION
|
||||
* @static
|
||||
*/
|
||||
PIXI.VERSION = "v2.1.0";
|
||||
|
||||
|
||||
// the various blend modes supported by pixi
|
||||
/**
|
||||
* Various blend modes supported by pixi.
|
||||
* @property {Object} blendModes
|
||||
* @property {Number} blendModes.NORMAL
|
||||
* @property {Number} blendModes.ADD
|
||||
* @property {Number} blendModes.MULTIPLY
|
||||
* @property {Number} blendModes.SCREEN
|
||||
* @property {Number} blendModes.OVERLAY
|
||||
* @property {Number} blendModes.DARKEN
|
||||
* @property {Number} blendModes.LIGHTEN
|
||||
* @property {Number} blendModes.COLOR_DODGE
|
||||
* @property {Number} blendModes.COLOR_BURN
|
||||
* @property {Number} blendModes.HARD_LIGHT
|
||||
* @property {Number} blendModes.SOFT_LIGHT
|
||||
* @property {Number} blendModes.DIFFERENCE
|
||||
* @property {Number} blendModes.EXCLUSION
|
||||
* @property {Number} blendModes.HUE
|
||||
* @property {Number} blendModes.SATURATION
|
||||
* @property {Number} blendModes.COLOR
|
||||
* @property {Number} blendModes.LUMINOSITY
|
||||
* @static
|
||||
*/
|
||||
PIXI.blendModes = {
|
||||
NORMAL:0,
|
||||
ADD:1,
|
||||
|
@ -48,7 +88,18 @@ PIXI.blendModes = {
|
|||
LUMINOSITY:16
|
||||
};
|
||||
|
||||
// the scale modes
|
||||
/**
|
||||
* The scale modes that are supported by pixi.
|
||||
*
|
||||
* The DEFAULT scale mode affects the default scaling mode of future operations.
|
||||
* It can be re-assigned to either LINEAR or NEAREST, depending upon suitability.
|
||||
*
|
||||
* @property {Object} scaleModes
|
||||
* @property {Number} scaleModes.DEFAULT=LINEAR
|
||||
* @property {Number} scaleModes.LINEAR Smooth scaling
|
||||
* @property {Number} scaleModes.NEAREST Pixelating scaling
|
||||
* @static
|
||||
*/
|
||||
PIXI.scaleModes = {
|
||||
DEFAULT:0,
|
||||
LINEAR:0,
|
||||
|
@ -73,19 +124,58 @@ else
|
|||
PIXI.INTERACTION_FREQUENCY = 30;
|
||||
PIXI.AUTO_PREVENT_DEFAULT = true;
|
||||
|
||||
/**
|
||||
* @property {Number} PI_2
|
||||
* @static
|
||||
*/
|
||||
PIXI.PI_2 = Math.PI * 2;
|
||||
|
||||
/**
|
||||
* @property {Number} RAD_TO_DEG
|
||||
* @static
|
||||
*/
|
||||
PIXI.RAD_TO_DEG = 180 / Math.PI;
|
||||
|
||||
/**
|
||||
* @property {Number} DEG_TO_RAD
|
||||
* @static
|
||||
*/
|
||||
PIXI.DEG_TO_RAD = Math.PI / 180;
|
||||
|
||||
/**
|
||||
* @property {String} RETINA_PREFIX
|
||||
* @protected
|
||||
* @static
|
||||
*/
|
||||
PIXI.RETINA_PREFIX = "@2x";
|
||||
//PIXI.SCALE_PREFIX "@x%%";
|
||||
|
||||
/**
|
||||
* If true the default pixi startup (console) banner message will be suppressed.
|
||||
*
|
||||
* @property {Boolean} dontSayHello
|
||||
* @default false
|
||||
* @static
|
||||
*/
|
||||
PIXI.dontSayHello = false;
|
||||
|
||||
|
||||
/**
|
||||
* The default render options if none are supplied to
|
||||
* {{#crossLink "WebGLRenderer"}}{{/crossLink}} or {{#crossLink "CanvasRenderer"}}{{/crossLink}}.
|
||||
*
|
||||
* @property {Object} defaultRenderOptions
|
||||
* @property {Object} defaultRenderOptions.view=null
|
||||
* @property {Boolean} defaultRenderOptions.transparent=false
|
||||
* @property {Boolean} defaultRenderOptions.antialias=false
|
||||
* @property {Boolean} defaultRenderOptions.preserveDrawingBuffer=false
|
||||
* @property {Number} defaultRenderOptions.resolution=1
|
||||
* @property {Boolean} defaultRenderOptions.clearBeforeRender=true
|
||||
* @property {Boolean} defaultRenderOptions.autoResize=false
|
||||
* @static
|
||||
*/
|
||||
PIXI.defaultRenderOptions = {
|
||||
view:null,
|
||||
transparent:false,
|
||||
view:null,
|
||||
transparent:false,
|
||||
antialias:false,
|
||||
preserveDrawingBuffer:false,
|
||||
resolution:1,
|
||||
|
@ -112,8 +202,6 @@ PIXI.sayHello = function (type)
|
|||
'color: #ff2424; background: #fff'
|
||||
];
|
||||
|
||||
|
||||
|
||||
console.log.apply(console, args);
|
||||
}
|
||||
else if (window['console'])
|
||||
|
@ -131,7 +219,7 @@ PIXI.sayHello = function (type)
|
|||
/**
|
||||
* @class Polygon
|
||||
* @constructor
|
||||
* @param points* {Array<Point>|Array<Number>|Point...|Number...} This can be an array of Points that form the polygon,
|
||||
* @param points* {Array(Point)|Array(Number)|Point...|Number...} This can be an array of Points that form the polygon,
|
||||
* a flat array of numbers that will be interpreted as [x,y, x,y, ...], or the arguments passed can be
|
||||
* all the points of the polygon e.g. `new PIXI.Polygon(new PIXI.Point(), new PIXI.Point(), ...)`, or the
|
||||
* arguments passed can be flat x,y values e.g. `new PIXI.Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are
|
||||
|
@ -562,9 +650,9 @@ PIXI.EmptyRectangle = new PIXI.Rectangle(0,0,0,0);
|
|||
*/
|
||||
|
||||
/**
|
||||
* the Rounded Rectangle object is an area defined by its position and has nice rounded corners, as indicated by its top-left corner point (x, y) and by its width and its height.
|
||||
* The Rounded Rectangle object is an area defined by its position and has nice rounded corners, as indicated by its top-left corner point (x, y) and by its width and its height.
|
||||
*
|
||||
* @class Rounded Rectangle
|
||||
* @class RoundedRectangle
|
||||
* @constructor
|
||||
* @param x {Number} The X coordinate of the upper-left corner of the rounded rectangle
|
||||
* @param y {Number} The Y coordinate of the upper-left corner of the rounded rectangle
|
||||
|
@ -614,7 +702,7 @@ PIXI.RoundedRectangle = function(x, y, width, height, radius)
|
|||
* Creates a clone of this Rounded Rectangle
|
||||
*
|
||||
* @method clone
|
||||
* @return {rounded Rectangle} a copy of the rounded rectangle
|
||||
* @return {RoundedRectangle} a copy of the rounded rectangle
|
||||
*/
|
||||
PIXI.RoundedRectangle.prototype.clone = function()
|
||||
{
|
||||
|
@ -1056,7 +1144,7 @@ Object.defineProperty(PIXI.DisplayObject.prototype, 'mask', {
|
|||
* * IMPORTANT: This is a webGL only feature and will be ignored by the canvas renderer.
|
||||
* To remove filters simply set this property to 'null'
|
||||
* @property filters
|
||||
* @type Array An array of filters
|
||||
* @type Array(Filter)
|
||||
*/
|
||||
Object.defineProperty(PIXI.DisplayObject.prototype, 'filters', {
|
||||
|
||||
|
@ -1173,8 +1261,8 @@ PIXI.DisplayObject.prototype.updateTransform = function()
|
|||
a = this.scale.x;
|
||||
d = this.scale.y;
|
||||
|
||||
tx = this.position.x;
|
||||
ty = this.position.y;
|
||||
tx = this.position.x - this.pivot.x * a;
|
||||
ty = this.position.y - this.pivot.y * d;
|
||||
|
||||
wt.a = a * pt.a;
|
||||
wt.b = a * pt.b;
|
||||
|
@ -1240,7 +1328,7 @@ PIXI.DisplayObject.prototype.setStageReference = function(stage)
|
|||
*
|
||||
* @method generateTexture
|
||||
* @param resolution {Number} The resolution of the texture being generated
|
||||
* @param scaleMode {Number} Should be one of the PIXI.scaleMode consts
|
||||
* @param scaleMode {Number} See {{#crossLink "PIXI/scaleModes:property"}}PIXI.scaleModes{{/crossLink}} for possible values
|
||||
* @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture.
|
||||
* @return {Texture} a texture of the graphics object
|
||||
*/
|
||||
|
@ -1277,7 +1365,8 @@ PIXI.DisplayObject.prototype.updateCache = function()
|
|||
*/
|
||||
PIXI.DisplayObject.prototype.toGlobal = function(position)
|
||||
{
|
||||
this.updateTransform();
|
||||
// don't need to u[date the lot
|
||||
this.displayObjectUpdateTransform();
|
||||
return this.worldTransform.apply(position);
|
||||
};
|
||||
|
||||
|
@ -1291,13 +1380,14 @@ PIXI.DisplayObject.prototype.toGlobal = function(position)
|
|||
*/
|
||||
PIXI.DisplayObject.prototype.toLocal = function(position, from)
|
||||
{
|
||||
//
|
||||
if (from)
|
||||
{
|
||||
position = from.toGlobal(position);
|
||||
}
|
||||
|
||||
this.updateTransform();
|
||||
|
||||
// don't need to u[date the lot
|
||||
this.displayObjectUpdateTransform();
|
||||
return this.worldTransform.applyInverse(position);
|
||||
};
|
||||
|
||||
|
@ -1354,7 +1444,7 @@ PIXI.DisplayObject.prototype._generateCachedSprite = function()
|
|||
PIXI.DisplayObject._tempMatrix.tx = -bounds.x;
|
||||
PIXI.DisplayObject._tempMatrix.ty = -bounds.y;
|
||||
|
||||
this._cachedSprite.texture.render(this, PIXI.DisplayObject._tempMatrix );
|
||||
this._cachedSprite.texture.render(this, PIXI.DisplayObject._tempMatrix, true);
|
||||
|
||||
this._cachedSprite.anchor.x = -( bounds.x / bounds.width );
|
||||
this._cachedSprite.anchor.y = -( bounds.y / bounds.height );
|
||||
|
@ -1461,7 +1551,7 @@ PIXI.DisplayObjectContainer = function()
|
|||
* [read-only] The array of children of this container.
|
||||
*
|
||||
* @property children
|
||||
* @type Array<DisplayObject>
|
||||
* @type Array(DisplayObject)
|
||||
* @readOnly
|
||||
*/
|
||||
this.children = [];
|
||||
|
@ -2037,7 +2127,7 @@ PIXI.Sprite = function(texture)
|
|||
* The shader that will be used to render the texture to the stage. Set to null to remove a current shader.
|
||||
*
|
||||
* @property shader
|
||||
* @type PIXI.AbstractFilter
|
||||
* @type AbstractFilter
|
||||
* @default null
|
||||
*/
|
||||
this.shader = null;
|
||||
|
@ -3749,7 +3839,7 @@ PIXI.EventTarget = {
|
|||
*
|
||||
* @method listeners
|
||||
* @param eventName {String} The events that should be listed.
|
||||
* @returns {Array} An array of listener functions
|
||||
* @return {Array} An array of listener functions
|
||||
*/
|
||||
obj.listeners = function listeners(eventName) {
|
||||
this._listeners = this._listeners || {};
|
||||
|
@ -3763,7 +3853,7 @@ PIXI.EventTarget = {
|
|||
* @method emit
|
||||
* @alias dispatchEvent
|
||||
* @param eventName {String} The name of the event.
|
||||
* @returns {Boolean} Indication if we've emitted an event.
|
||||
* @return {Boolean} Indication if we've emitted an event.
|
||||
*/
|
||||
obj.emit = obj.dispatchEvent = function emit(eventName, data) {
|
||||
this._listeners = this._listeners || {};
|
||||
|
@ -4275,7 +4365,7 @@ PIXI.PixiShader = function(gl)
|
|||
/**
|
||||
* The WebGL program.
|
||||
* @property program
|
||||
* @type {Any}
|
||||
* @type Any
|
||||
*/
|
||||
this.program = null;
|
||||
|
||||
|
@ -4620,7 +4710,7 @@ PIXI.PixiShader.prototype.destroy = function()
|
|||
PIXI.PixiShader.defaultVertexSrc = [
|
||||
'attribute vec2 aVertexPosition;',
|
||||
'attribute vec2 aTextureCoord;',
|
||||
'attribute vec4 aColor;',
|
||||
'attribute vec2 aColor;',
|
||||
|
||||
'uniform vec2 projectionVector;',
|
||||
'uniform vec2 offsetVector;',
|
||||
|
@ -4665,7 +4755,7 @@ PIXI.PixiFastShader = function(gl)
|
|||
/**
|
||||
* The WebGL program.
|
||||
* @property program
|
||||
* @type {Any}
|
||||
* @type Any
|
||||
*/
|
||||
this.program = null;
|
||||
|
||||
|
@ -4821,7 +4911,7 @@ PIXI.StripShader = function(gl)
|
|||
/**
|
||||
* The WebGL program.
|
||||
* @property program
|
||||
* @type {Any}
|
||||
* @type Any
|
||||
*/
|
||||
this.program = null;
|
||||
|
||||
|
@ -4945,7 +5035,7 @@ PIXI.PrimitiveShader = function(gl)
|
|||
/**
|
||||
* The WebGL program.
|
||||
* @property program
|
||||
* @type {Any}
|
||||
* @type Any
|
||||
*/
|
||||
this.program = null;
|
||||
|
||||
|
@ -5061,7 +5151,7 @@ PIXI.ComplexPrimitiveShader = function(gl)
|
|||
/**
|
||||
* The WebGL program.
|
||||
* @property program
|
||||
* @type {Any}
|
||||
* @type Any
|
||||
*/
|
||||
this.program = null;
|
||||
|
||||
|
@ -5547,7 +5637,7 @@ PIXI.WebGLGraphics.buildRoundedRectangle = function(graphicsData, webGLData)
|
|||
* @param cpY {Number} Control point y
|
||||
* @param toX {Number} Destination point x
|
||||
* @param toY {Number} Destination point y
|
||||
* @return {Array<Number>}
|
||||
* @return {Array(Number)}
|
||||
*/
|
||||
PIXI.WebGLGraphics.quadraticBezierCurve = function(fromX, fromY, cpX, cpY, toX, toY) {
|
||||
|
||||
|
@ -8670,7 +8760,7 @@ PIXI.WebGLFilterManager.prototype.destroy = function()
|
|||
* @param gl {WebGLContext} the current WebGL drawing context
|
||||
* @param width {Number} the horizontal range of the filter
|
||||
* @param height {Number} the vertical range of the filter
|
||||
* @param scaleMode {Number} Should be one of the PIXI.scaleMode consts
|
||||
* @param scaleMode {Number} See {{#crossLink "PIXI/scaleModes:property"}}PIXI.scaleModes{{/crossLink}} for possible values
|
||||
*/
|
||||
PIXI.FilterTexture = function(gl, width, height, scaleMode)
|
||||
{
|
||||
|
@ -8912,8 +9002,9 @@ PIXI.CanvasMaskManager.prototype.popMask = function(renderSession)
|
|||
*/
|
||||
|
||||
/**
|
||||
* Utility methods for Sprite/Texture tinting.
|
||||
*
|
||||
* @class CanvasTinter
|
||||
* @constructor
|
||||
* @static
|
||||
*/
|
||||
PIXI.CanvasTinter = function()
|
||||
|
@ -8924,6 +9015,7 @@ PIXI.CanvasTinter = function()
|
|||
* Basically this method just needs a sprite and a color and tints the sprite with the given color.
|
||||
*
|
||||
* @method getTintedTexture
|
||||
* @static
|
||||
* @param sprite {Sprite} the sprite to tint
|
||||
* @param color {Number} the color to use to tint the sprite with
|
||||
* @return {HTMLCanvasElement} The tinted canvas
|
||||
|
@ -8968,6 +9060,7 @@ PIXI.CanvasTinter.getTintedTexture = function(sprite, color)
|
|||
* Tint a texture using the "multiply" operation.
|
||||
*
|
||||
* @method tintWithMultiply
|
||||
* @static
|
||||
* @param texture {Texture} the texture to tint
|
||||
* @param color {Number} the color to use to tint the sprite with
|
||||
* @param canvas {HTMLCanvasElement} the current canvas
|
||||
|
@ -9014,6 +9107,7 @@ PIXI.CanvasTinter.tintWithMultiply = function(texture, color, canvas)
|
|||
* Tint a texture using the "overlay" operation.
|
||||
*
|
||||
* @method tintWithOverlay
|
||||
* @static
|
||||
* @param texture {Texture} the texture to tint
|
||||
* @param color {Number} the color to use to tint the sprite with
|
||||
* @param canvas {HTMLCanvasElement} the current canvas
|
||||
|
@ -9049,6 +9143,7 @@ PIXI.CanvasTinter.tintWithOverlay = function(texture, color, canvas)
|
|||
* Tint a texture pixel per pixel.
|
||||
*
|
||||
* @method tintPerPixel
|
||||
* @static
|
||||
* @param texture {Texture} the texture to tint
|
||||
* @param color {Number} the color to use to tint the sprite with
|
||||
* @param canvas {HTMLCanvasElement} the current canvas
|
||||
|
@ -9094,6 +9189,7 @@ PIXI.CanvasTinter.tintWithPerPixel = function(texture, color, canvas)
|
|||
* Rounds the specified color according to the PIXI.CanvasTinter.cacheStepsPerColorChannel.
|
||||
*
|
||||
* @method roundColor
|
||||
* @static
|
||||
* @param color {number} the color to round, should be a hex color
|
||||
*/
|
||||
PIXI.CanvasTinter.roundColor = function(color)
|
||||
|
@ -9112,8 +9208,9 @@ PIXI.CanvasTinter.roundColor = function(color)
|
|||
/**
|
||||
* Number of steps which will be used as a cap when rounding colors.
|
||||
*
|
||||
* @property cacheStepsPerColorChannel
|
||||
* @property cacheStepsPerColorChannel
|
||||
* @type Number
|
||||
* @static
|
||||
*/
|
||||
PIXI.CanvasTinter.cacheStepsPerColorChannel = 8;
|
||||
|
||||
|
@ -9122,6 +9219,7 @@ PIXI.CanvasTinter.cacheStepsPerColorChannel = 8;
|
|||
*
|
||||
* @property convertTintToImage
|
||||
* @type Boolean
|
||||
* @static
|
||||
*/
|
||||
PIXI.CanvasTinter.convertTintToImage = false;
|
||||
|
||||
|
@ -9130,6 +9228,7 @@ PIXI.CanvasTinter.convertTintToImage = false;
|
|||
*
|
||||
* @property canUseMultiply
|
||||
* @type Boolean
|
||||
* @static
|
||||
*/
|
||||
PIXI.CanvasTinter.canUseMultiply = PIXI.canUseNewCanvasBlendModes();
|
||||
|
||||
|
@ -9137,6 +9236,7 @@ PIXI.CanvasTinter.canUseMultiply = PIXI.canUseNewCanvasBlendModes();
|
|||
* The tinting method that will be used.
|
||||
*
|
||||
* @method tintMethod
|
||||
* @static
|
||||
*/
|
||||
PIXI.CanvasTinter.tintMethod = PIXI.CanvasTinter.canUseMultiply ? PIXI.CanvasTinter.tintWithMultiply : PIXI.CanvasTinter.tintWithPerPixel;
|
||||
|
||||
|
@ -9512,14 +9612,21 @@ PIXI.CanvasGraphics = function()
|
|||
PIXI.CanvasGraphics.renderGraphics = function(graphics, context)
|
||||
{
|
||||
var worldAlpha = graphics.worldAlpha;
|
||||
var color = '';
|
||||
|
||||
if(graphics.dirty)
|
||||
{
|
||||
this.updateGraphicsTint(graphics);
|
||||
graphics.dirty = false;
|
||||
}
|
||||
|
||||
|
||||
for (var i = 0; i < graphics.graphicsData.length; i++)
|
||||
{
|
||||
var data = graphics.graphicsData[i];
|
||||
var shape = data.shape;
|
||||
|
||||
context.strokeStyle = color = '#' + ('00000' + ( data.lineColor | 0).toString(16)).substr(-6);
|
||||
var fillColor = data._fillTint;
|
||||
var lineColor = data._lineTint;
|
||||
|
||||
context.lineWidth = data.lineWidth;
|
||||
|
||||
|
@ -9550,12 +9657,13 @@ PIXI.CanvasGraphics.renderGraphics = function(graphics, context)
|
|||
if(data.fill)
|
||||
{
|
||||
context.globalAlpha = data.fillAlpha * worldAlpha;
|
||||
context.fillStyle = color = '#' + ('00000' + ( data.fillColor | 0).toString(16)).substr(-6);
|
||||
context.fillStyle = '#' + ('00000' + ( fillColor | 0).toString(16)).substr(-6);
|
||||
context.fill();
|
||||
}
|
||||
if(data.lineWidth)
|
||||
{
|
||||
context.globalAlpha = data.lineAlpha * worldAlpha;
|
||||
context.strokeStyle = '#' + ('00000' + ( lineColor | 0).toString(16)).substr(-6);
|
||||
context.stroke();
|
||||
}
|
||||
}
|
||||
|
@ -9565,13 +9673,14 @@ PIXI.CanvasGraphics.renderGraphics = function(graphics, context)
|
|||
if(data.fillColor || data.fillColor === 0)
|
||||
{
|
||||
context.globalAlpha = data.fillAlpha * worldAlpha;
|
||||
context.fillStyle = color = '#' + ('00000' + ( data.fillColor | 0).toString(16)).substr(-6);
|
||||
context.fillRect(shape.x, shape.y, shape.width, shape.height);
|
||||
context.fillStyle = '#' + ('00000' + ( fillColor | 0).toString(16)).substr(-6);
|
||||
context.colorRect(shape.x, shape.y, shape.width, shape.height);
|
||||
|
||||
}
|
||||
if(data.lineWidth)
|
||||
{
|
||||
context.globalAlpha = data.lineAlpha * worldAlpha;
|
||||
context.strokeStyle = '#' + ('00000' + ( lineColor | 0).toString(16)).substr(-6);
|
||||
context.strokeRect(shape.x, shape.y, shape.width, shape.height);
|
||||
}
|
||||
}
|
||||
|
@ -9585,12 +9694,13 @@ PIXI.CanvasGraphics.renderGraphics = function(graphics, context)
|
|||
if(data.fill)
|
||||
{
|
||||
context.globalAlpha = data.fillAlpha * worldAlpha;
|
||||
context.fillStyle = color = '#' + ('00000' + ( data.fillColor | 0).toString(16)).substr(-6);
|
||||
context.fillStyle = '#' + ('00000' + ( fillColor | 0).toString(16)).substr(-6);
|
||||
context.fill();
|
||||
}
|
||||
if(data.lineWidth)
|
||||
{
|
||||
context.globalAlpha = data.lineAlpha * worldAlpha;
|
||||
context.strokeStyle = '#' + ('00000' + ( lineColor | 0).toString(16)).substr(-6);
|
||||
context.stroke();
|
||||
}
|
||||
}
|
||||
|
@ -9625,12 +9735,13 @@ PIXI.CanvasGraphics.renderGraphics = function(graphics, context)
|
|||
if(data.fill)
|
||||
{
|
||||
context.globalAlpha = data.fillAlpha * worldAlpha;
|
||||
context.fillStyle = color = '#' + ('00000' + ( data.fillColor | 0).toString(16)).substr(-6);
|
||||
context.fillStyle = '#' + ('00000' + ( fillColor | 0).toString(16)).substr(-6);
|
||||
context.fill();
|
||||
}
|
||||
if(data.lineWidth)
|
||||
{
|
||||
context.globalAlpha = data.lineAlpha * worldAlpha;
|
||||
context.strokeStyle = '#' + ('00000' + ( lineColor | 0).toString(16)).substr(-6);
|
||||
context.stroke();
|
||||
}
|
||||
}
|
||||
|
@ -9660,13 +9771,14 @@ PIXI.CanvasGraphics.renderGraphics = function(graphics, context)
|
|||
if(data.fillColor || data.fillColor === 0)
|
||||
{
|
||||
context.globalAlpha = data.fillAlpha * worldAlpha;
|
||||
context.fillStyle = color = '#' + ('00000' + ( data.fillColor | 0).toString(16)).substr(-6);
|
||||
context.fillStyle = '#' + ('00000' + ( fillColor | 0).toString(16)).substr(-6);
|
||||
context.fill();
|
||||
|
||||
}
|
||||
if(data.lineWidth)
|
||||
{
|
||||
context.globalAlpha = data.lineAlpha * worldAlpha;
|
||||
context.strokeStyle = '#' + ('00000' + ( lineColor | 0).toString(16)).substr(-6);
|
||||
context.stroke();
|
||||
}
|
||||
}
|
||||
|
@ -9788,6 +9900,51 @@ PIXI.CanvasGraphics.renderGraphicsMask = function(graphics, context)
|
|||
}
|
||||
};
|
||||
|
||||
PIXI.CanvasGraphics.updateGraphicsTint = function(graphics)
|
||||
{
|
||||
if(graphics.tint === 0xFFFFFF)return;
|
||||
|
||||
var tintR = (graphics.tint >> 16 & 0xFF) / 255;
|
||||
var tintG = (graphics.tint >> 8 & 0xFF) / 255;
|
||||
var tintB = (graphics.tint & 0xFF)/ 255;
|
||||
|
||||
for (var i = 0; i < graphics.graphicsData.length; i++)
|
||||
{
|
||||
var data = graphics.graphicsData[i];
|
||||
|
||||
var fillColor = data.fillColor | 0;
|
||||
var lineColor = data.lineColor | 0;
|
||||
|
||||
/*
|
||||
var colorR = (fillColor >> 16 & 0xFF) / 255;
|
||||
var colorG = (fillColor >> 8 & 0xFF) / 255;
|
||||
var colorB = (fillColor & 0xFF) / 255;
|
||||
|
||||
colorR *= tintR;
|
||||
colorG *= tintG;
|
||||
colorB *= tintB;
|
||||
|
||||
fillColor = ((colorR*255 << 16) + (colorG*255 << 8) + colorB*255);
|
||||
|
||||
colorR = (lineColor >> 16 & 0xFF) / 255;
|
||||
colorG = (lineColor >> 8 & 0xFF) / 255;
|
||||
colorB = (lineColor & 0xFF) / 255;
|
||||
|
||||
colorR *= tintR;
|
||||
colorG *= tintG;
|
||||
colorB *= tintB;
|
||||
|
||||
lineColor = ((colorR*255 << 16) + (colorG*255 << 8) + colorB*255);
|
||||
*/
|
||||
|
||||
// super inline cos im an optimization NAZI :)
|
||||
data._fillTint = (((fillColor >> 16 & 0xFF) / 255 * tintR*255 << 16) + ((fillColor >> 8 & 0xFF) / 255 * tintG*255 << 8) + (fillColor & 0xFF) / 255 * tintB*255);
|
||||
data._lineTint = (((lineColor >> 16 & 0xFF) / 255 * tintR*255 << 16) + ((lineColor >> 8 & 0xFF) / 255 * tintG*255 << 8) + (lineColor & 0xFF) / 255 * tintB*255);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @author Mat Groves http://matgroves.com/
|
||||
*/
|
||||
|
@ -10805,7 +10962,7 @@ PIXI.BaseTextureCacheIdGenerator = 0;
|
|||
* @uses EventTarget
|
||||
* @constructor
|
||||
* @param source {String} the source object (image or canvas)
|
||||
* @param scaleMode {Number} Should be one of the PIXI.scaleMode consts
|
||||
* @param scaleMode {Number} See {{#crossLink "PIXI/scaleModes:property"}}PIXI.scaleModes{{/crossLink}} for possible values
|
||||
*/
|
||||
PIXI.BaseTexture = function(source, scaleMode)
|
||||
{
|
||||
|
@ -10839,7 +10996,7 @@ PIXI.BaseTexture = function(source, scaleMode)
|
|||
* The scale mode to apply when scaling this texture
|
||||
*
|
||||
* @property scaleMode
|
||||
* @type PIXI.scaleModes
|
||||
* @type {Number}
|
||||
* @default PIXI.scaleModes.LINEAR
|
||||
*/
|
||||
this.scaleMode = scaleMode || PIXI.scaleModes.DEFAULT;
|
||||
|
@ -11025,7 +11182,7 @@ PIXI.BaseTexture.prototype.unloadFromGPU = function()
|
|||
* @method fromImage
|
||||
* @param imageUrl {String} The image url of the texture
|
||||
* @param crossorigin {Boolean}
|
||||
* @param scaleMode {Number} Should be one of the PIXI.scaleMode consts
|
||||
* @param scaleMode {Number} See {{#crossLink "PIXI/scaleModes:property"}}PIXI.scaleModes{{/crossLink}} for possible values
|
||||
* @return BaseTexture
|
||||
*/
|
||||
PIXI.BaseTexture.fromImage = function(imageUrl, crossorigin, scaleMode)
|
||||
|
@ -11065,7 +11222,7 @@ PIXI.BaseTexture.fromImage = function(imageUrl, crossorigin, scaleMode)
|
|||
* @static
|
||||
* @method fromCanvas
|
||||
* @param canvas {Canvas} The canvas element source of the texture
|
||||
* @param scaleMode {Number} Should be one of the PIXI.scaleMode consts
|
||||
* @param scaleMode {Number} See {{#crossLink "PIXI/scaleModes:property"}}PIXI.scaleModes{{/crossLink}} for possible values
|
||||
* @return BaseTexture
|
||||
*/
|
||||
PIXI.BaseTexture.fromCanvas = function(canvas, scaleMode)
|
||||
|
@ -11320,7 +11477,7 @@ PIXI.Texture.prototype._updateUvs = function()
|
|||
* @method fromImage
|
||||
* @param imageUrl {String} The image url of the texture
|
||||
* @param crossorigin {Boolean} Whether requests should be treated as crossorigin
|
||||
* @param scaleMode {Number} Should be one of the PIXI.scaleMode consts
|
||||
* @param scaleMode {Number} See {{#crossLink "PIXI/scaleModes:property"}}PIXI.scaleModes{{/crossLink}} for possible values
|
||||
* @return Texture
|
||||
*/
|
||||
PIXI.Texture.fromImage = function(imageUrl, crossorigin, scaleMode)
|
||||
|
@ -11358,7 +11515,7 @@ PIXI.Texture.fromFrame = function(frameId)
|
|||
* @static
|
||||
* @method fromCanvas
|
||||
* @param canvas {Canvas} The canvas element source of the texture
|
||||
* @param scaleMode {Number} Should be one of the PIXI.scaleMode consts
|
||||
* @param scaleMode {Number} See {{#crossLink "PIXI/scaleModes:property"}}PIXI.scaleModes{{/crossLink}} for possible values
|
||||
* @return Texture
|
||||
*/
|
||||
PIXI.Texture.fromCanvas = function(canvas, scaleMode)
|
||||
|
@ -11447,7 +11604,7 @@ PIXI.Texture.emptyTexture = new PIXI.Texture(new PIXI.BaseTexture());
|
|||
* @param width {Number} The width of the render texture
|
||||
* @param height {Number} The height of the render texture
|
||||
* @param renderer {CanvasRenderer|WebGLRenderer} The renderer used for this RenderTexture
|
||||
* @param scaleMode {Number} Should be one of the PIXI.scaleMode consts
|
||||
* @param scaleMode {Number} See {{#crossLink "PIXI/scaleModes:property"}}PIXI.scaleModes{{/crossLink}} for possible values
|
||||
* @param resolution {Number} The resolution of the texture being generated
|
||||
*/
|
||||
PIXI.RenderTexture = function(width, height, renderer, scaleMode, resolution)
|
||||
|
@ -11771,14 +11928,14 @@ PIXI.AbstractFilter = function(fragmentSrc, uniforms)
|
|||
* An array of passes - some filters contain a few steps this array simply stores the steps in a liniear fashion.
|
||||
* For example the blur filter has two passes blurX and blurY.
|
||||
* @property passes
|
||||
* @type Array an array of filter objects
|
||||
* @type Array(Filter)
|
||||
* @private
|
||||
*/
|
||||
this.passes = [this];
|
||||
|
||||
/**
|
||||
* @property shaders
|
||||
* @type Array an array of shaders
|
||||
* @type Array(Shader)
|
||||
* @private
|
||||
*/
|
||||
this.shaders = [];
|
||||
|
|
8
build/custom/pixi.min.js
vendored
8
build/custom/pixi.min.js
vendored
File diff suppressed because one or more lines are too long
1071
build/phaser.js
1071
build/phaser.js
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
46
build/phaser.min.js
vendored
46
build/phaser.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue