mirror of
https://github.com/wassname/phaser.git
synced 2026-06-28 16:20:37 +08:00
Updated DynamicTexture.setPixel, added GameMath.shuffleArray, fixed Animation.frame and created a few new tests
This commit is contained in:
@@ -86,8 +86,9 @@ module Phaser {
|
||||
* @param frameRate {number} The speed in frames per second that the animation should play at (e.g. 60 fps).
|
||||
* @param loop {boolean} Whether or not the animation is looped or just plays once.
|
||||
* @param useNumericIndex {boolean} Use number indexes instead of string indexes?
|
||||
* @return {Animation} The Animation that was created
|
||||
*/
|
||||
public add(name: string, frames: any[] = null, frameRate: number = 60, loop: bool = false, useNumericIndex: bool = true) {
|
||||
public add(name: string, frames: any[] = null, frameRate: number = 60, loop: bool = false, useNumericIndex: bool = true): Animation {
|
||||
|
||||
if (this._frameData == null)
|
||||
{
|
||||
@@ -117,6 +118,8 @@ module Phaser {
|
||||
this.currentAnim = this._anims[name];
|
||||
this.currentFrame = this.currentAnim.currentFrame;
|
||||
|
||||
return this._anims[name];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -117,7 +117,7 @@ module Phaser {
|
||||
* @param y {number} Y position of the target pixel.
|
||||
* @param color {number} Native integer with color value. (format: 0xRRGGBB)
|
||||
*/
|
||||
public setPixel(x: number, y: number, color: number) {
|
||||
public setPixel(x: number, y: number, color: string) {
|
||||
|
||||
this.context.fillStyle = color;
|
||||
this.context.fillRect(x, y, 1, 1);
|
||||
|
||||
+1
-1
@@ -470,7 +470,7 @@ module Phaser {
|
||||
this.onDestroyCallback.call(this.callbackContext);
|
||||
}
|
||||
|
||||
this.input.reset();
|
||||
this.input.reset(true);
|
||||
|
||||
// Prototype?
|
||||
if (typeof state === 'function')
|
||||
|
||||
@@ -1003,6 +1003,24 @@ module Phaser {
|
||||
return ax * bx + ay * by;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shuffles the data in the given array into a new order
|
||||
* @param array The array to shuffle
|
||||
* @return The array
|
||||
*/
|
||||
public shuffleArray(array) {
|
||||
|
||||
for (var i = array.length - 1; i > 0; i--)
|
||||
{
|
||||
var j = Math.floor(Math.random() * (i + 1));
|
||||
var temp = array[i];
|
||||
array[i] = array[j];
|
||||
array[j] = temp;
|
||||
}
|
||||
|
||||
return array;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -29,7 +29,6 @@ module Phaser {
|
||||
this._game = game;
|
||||
|
||||
this.canvas = <HTMLCanvasElement> document.createElement('canvas');
|
||||
this.canvas.id = 'bob';
|
||||
this.canvas.width = width;
|
||||
this.canvas.height = height;
|
||||
|
||||
@@ -212,6 +211,9 @@ module Phaser {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the DOM offset values of the given element
|
||||
*/
|
||||
private getOffset(element): MicroPoint {
|
||||
|
||||
var box = element.getBoundingClientRect();
|
||||
|
||||
@@ -120,8 +120,8 @@ module Phaser {
|
||||
public lineColor: string = 'rgb(0,255,0)';
|
||||
|
||||
/**
|
||||
* Width of outline. (default is 1)
|
||||
* @type {number}
|
||||
* The color of the filled area in rgb or rgba string format
|
||||
* @type {string} Defaults to rgb(0,100,0) - a green color
|
||||
*/
|
||||
public fillColor: string = 'rgb(0,100,0)';
|
||||
|
||||
@@ -341,13 +341,6 @@ module Phaser {
|
||||
this._dw = this.bounds.width * this.scale.x;
|
||||
this._dh = this.bounds.height * this.scale.y;
|
||||
|
||||
// Circles are drawn center based
|
||||
if (this.type == GeomSprite.CIRCLE)
|
||||
{
|
||||
this._dx += this.circle.radius;
|
||||
this._dy += this.circle.radius;
|
||||
}
|
||||
|
||||
// Apply camera difference
|
||||
if (this.scrollFactor.x !== 1.0 || this.scrollFactor.y !== 1.0)
|
||||
{
|
||||
@@ -391,7 +384,11 @@ module Phaser {
|
||||
{
|
||||
this.context.beginPath();
|
||||
this.context.arc(this._dx, this._dy, this.circle.radius, 0, Math.PI * 2);
|
||||
this.context.stroke();
|
||||
|
||||
if (this.renderOutline)
|
||||
{
|
||||
this.context.stroke();
|
||||
}
|
||||
|
||||
if (this.renderFill)
|
||||
{
|
||||
|
||||
@@ -33,6 +33,7 @@ module Phaser {
|
||||
|
||||
if (key !== null)
|
||||
{
|
||||
this.cacheKey = key;
|
||||
this.loadGraphic(key);
|
||||
}
|
||||
else
|
||||
@@ -70,6 +71,11 @@ module Phaser {
|
||||
*/
|
||||
public animations: AnimationManager;
|
||||
|
||||
/**
|
||||
* The cache key that was used for this texture (if any)
|
||||
*/
|
||||
public cacheKey: string;
|
||||
|
||||
/**
|
||||
* Render bound of this sprite for debugging? (default to false)
|
||||
* @type {boolean}
|
||||
@@ -95,7 +101,7 @@ module Phaser {
|
||||
public renderDebugPointColor: string = 'rgba(255,255,255,1)';
|
||||
|
||||
/**
|
||||
* Flip the graphic vertically? (default to false)
|
||||
* Flip the graphic horizontally? (defaults to false)
|
||||
* @type {boolean}
|
||||
*/
|
||||
public flipped: bool = false;
|
||||
|
||||
@@ -470,6 +470,27 @@ module Phaser {
|
||||
|
||||
}
|
||||
|
||||
public isConsoleOpen(): bool {
|
||||
|
||||
if (window.console && window.console['firebug'])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (window.console)
|
||||
{
|
||||
console.profile();
|
||||
console.profileEnd();
|
||||
|
||||
if (console.clear) console.clear();
|
||||
|
||||
return console['profiles'].length > 0;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all informations of host device.
|
||||
* @return {string} Informations in a string.
|
||||
|
||||
+10
-4
@@ -114,14 +114,15 @@ module Phaser {
|
||||
public onComplete: Phaser.Signal;
|
||||
|
||||
/**
|
||||
* Config the tween result.
|
||||
* Configure the Tween
|
||||
* @param properties {object} Propertis you want to tween.
|
||||
* @param [duration] {number} duration of this tween.
|
||||
* @param ease {any} Easing function.
|
||||
* @param autoStart {boolean} Whether this tween will start automatically or not.
|
||||
* @param [ease] {any} Easing function.
|
||||
* @param [autoStart] {boolean} Whether this tween will start automatically or not.
|
||||
* @param [delay] {number} delay before this tween will start, defaults to 0 (no delay)
|
||||
* @return {Tween} Itself.
|
||||
*/
|
||||
public to(properties, duration?: number = 1000, ease?: any = null, autoStart?: bool = false) {
|
||||
public to(properties, duration?: number = 1000, ease?: any = null, autoStart?: bool = false, delay?:number = 0) {
|
||||
|
||||
this._duration = duration;
|
||||
|
||||
@@ -133,6 +134,11 @@ module Phaser {
|
||||
this._easingFunction = ease;
|
||||
}
|
||||
|
||||
if (delay > 0)
|
||||
{
|
||||
this._delayTime = delay;
|
||||
}
|
||||
|
||||
if (autoStart === true)
|
||||
{
|
||||
return this.start();
|
||||
|
||||
@@ -44,21 +44,25 @@ module Phaser {
|
||||
* Local private reference to game.
|
||||
*/
|
||||
private _game: Game;
|
||||
|
||||
/**
|
||||
* Local private reference to its owner sprite.
|
||||
* @type {Sprite}
|
||||
*/
|
||||
private _parent: Sprite;
|
||||
|
||||
/**
|
||||
* Animation frame container.
|
||||
* @type {number[]}
|
||||
*/
|
||||
private _frames: number[];
|
||||
|
||||
/**
|
||||
* Frame data of this animation.(parsed from sprite sheet)
|
||||
* @type {FrameData}
|
||||
*/
|
||||
private _frameData: FrameData;
|
||||
|
||||
/**
|
||||
* Index of current frame.
|
||||
* @type {number}
|
||||
@@ -70,6 +74,7 @@ module Phaser {
|
||||
* @type number
|
||||
*/
|
||||
private _timeLastFrame: number;
|
||||
|
||||
/**
|
||||
* Time when this will switch to next frame (in ms).
|
||||
* @type number
|
||||
@@ -81,6 +86,7 @@ module Phaser {
|
||||
* @type {string}
|
||||
*/
|
||||
public name: string;
|
||||
|
||||
/**
|
||||
* Currently played frame instance.
|
||||
* @type {Frame}
|
||||
@@ -92,16 +98,19 @@ module Phaser {
|
||||
* @type {boolean}
|
||||
*/
|
||||
public isFinished: bool;
|
||||
|
||||
/**
|
||||
* Whethor or not this animation is currently playing.
|
||||
* @type {boolean}
|
||||
*/
|
||||
public isPlaying: bool;
|
||||
|
||||
/**
|
||||
* Whether or not the animation is looped.
|
||||
* @type {boolean}
|
||||
*/
|
||||
public looped: bool;
|
||||
|
||||
/**
|
||||
* Time between frames in ms.
|
||||
* @type {number}
|
||||
@@ -113,7 +122,16 @@ module Phaser {
|
||||
}
|
||||
|
||||
public get frame(): number {
|
||||
return this._frameIndex;
|
||||
|
||||
if (this.currentFrame !== null)
|
||||
{
|
||||
return this.currentFrame.index;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this._frameIndex;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public set frame(value: number) {
|
||||
|
||||
@@ -42,6 +42,9 @@ module Phaser {
|
||||
this.onTap = new Phaser.Signal();
|
||||
this.onHold = new Phaser.Signal();
|
||||
|
||||
this.point = new Point();
|
||||
this.circle = new Circle(0, 0, 44);
|
||||
|
||||
this.currentPointers = 0;
|
||||
|
||||
}
|
||||
@@ -111,6 +114,21 @@ module Phaser {
|
||||
*/
|
||||
public gestures: Gestures;
|
||||
|
||||
/**
|
||||
* A Point object representing the x/y screen coordinates of the Pointer.
|
||||
* @property point
|
||||
* @type {Point}
|
||||
**/
|
||||
public point: Point = null;
|
||||
|
||||
/**
|
||||
* A Circle object centered on the x/y screen coordinates of the Input.
|
||||
* Default size of 44px (Apples recommended "finger tip" size) but can be changed to anything
|
||||
* @property circle
|
||||
* @type {Circle}
|
||||
**/
|
||||
public circle: Circle = null;
|
||||
|
||||
/**
|
||||
* X coordinate of the most recent Pointer event
|
||||
* @type {Number}
|
||||
@@ -371,7 +389,12 @@ module Phaser {
|
||||
|
||||
}
|
||||
|
||||
public reset() {
|
||||
/**
|
||||
* Reset all of the Pointers and Input states
|
||||
* @method reset
|
||||
* @param hard {Boolean} A soft reset (hard = false) won't reset any signals that might be bound. A hard reset will.
|
||||
**/
|
||||
public reset(hard?: bool = false) {
|
||||
|
||||
this.keyboard.reset();
|
||||
|
||||
@@ -386,13 +409,17 @@ module Phaser {
|
||||
this.pointer9.reset();
|
||||
this.pointer10.reset();
|
||||
|
||||
this.onDown = new Phaser.Signal();
|
||||
this.onUp = new Phaser.Signal();
|
||||
this.onTap = new Phaser.Signal();
|
||||
this.onHold = new Phaser.Signal();
|
||||
|
||||
this.currentPointers = 0;
|
||||
|
||||
if (hard == true)
|
||||
{
|
||||
this.onDown = new Phaser.Signal();
|
||||
this.onUp = new Phaser.Signal();
|
||||
this.onTap = new Phaser.Signal();
|
||||
this.onHold = new Phaser.Signal();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -370,12 +370,16 @@ module Phaser {
|
||||
this.y = this.pageY - this._game.stage.offset.y;
|
||||
|
||||
this.pointB.setTo(this.x, this.y);
|
||||
this.circle.setTo(this.x, this.y, 44);
|
||||
this.circle.x = this.x;
|
||||
this.circle.y = this.y;
|
||||
|
||||
if (this._game.input.multiInputOverride == Input.MOUSE_OVERRIDES_TOUCH || this._game.input.multiInputOverride == Input.MOUSE_TOUCH_COMBINE || (this._game.input.multiInputOverride == Input.TOUCH_OVERRIDES_MOUSE && this._game.input.currentPointers == 0))
|
||||
{
|
||||
this._game.input.x = this.x * this._game.input.scaleX;
|
||||
this._game.input.y = this.y * this._game.input.scaleY;
|
||||
this._game.input.point.setTo(this._game.input.x, this._game.input.y);
|
||||
this._game.input.circle.x = this._game.input.x;
|
||||
this._game.input.circle.y = this._game.input.y;
|
||||
}
|
||||
|
||||
return this;
|
||||
@@ -507,16 +511,16 @@ module Phaser {
|
||||
}
|
||||
|
||||
this._game.stage.context.beginPath();
|
||||
this._game.stage.context.arc(this.x, this.y, this.circle.radius * 2, 0, Math.PI * 2);
|
||||
this._game.stage.context.arc(this.x, this.y, this.circle.radius, 0, Math.PI * 2);
|
||||
|
||||
if (this.active)
|
||||
{
|
||||
this._game.stage.context.fillStyle = 'rgb(0,255,0)';
|
||||
this._game.stage.context.fillStyle = 'rgba(0,255,0,0.5)';
|
||||
this._game.stage.context.strokeStyle = 'rgb(0,255,0)';
|
||||
}
|
||||
else
|
||||
{
|
||||
this._game.stage.context.fillStyle = 'rgb(100,0,0)';
|
||||
this._game.stage.context.fillStyle = 'rgba(255,0,0,0.5)';
|
||||
this._game.stage.context.strokeStyle = 'rgb(100,0,0)';
|
||||
}
|
||||
|
||||
|
||||
@@ -72,6 +72,16 @@ V0.9.6
|
||||
* Added Basic.ignoreGlobalRender - stops the object being rendered as part of the main game loop, you'll need to call render on it yourself
|
||||
* Added forceUpdate and forceRender parameters to Group.update and Group.render respectively. Combined with ignoreGlobal you can create custom rendering set-ups
|
||||
* Fixed Loader.progress calculation so it now accurate passes a value between 0 and 100% to your loader callback
|
||||
* Added a 'hard reset' parameter to Input.reset. A hard reset clears Input signals (such as on a state swap), a soft (such as on game pause) doesn't
|
||||
* Added Device.isConsoleOpen() to check if the browser console is open. Tested on Firefox with Firebug and Chrome with DevTools
|
||||
* Added delay parameter to Tween.to()
|
||||
* Fixed bug where GeomSprite.renderOutline was being ignored for Circle objects
|
||||
* Fixed bug with GeomSprite circles rendering at twice the size they should have been and offset from actual x/y values
|
||||
* Added Sprite.cacheKey which stores the key of the item from the cache that was used for its texture (if any)
|
||||
* Added GameMath.shuffleArray
|
||||
* Updated Animation.frame to return the index of the currentFrame if set
|
||||
|
||||
|
||||
|
||||
* TODO: Check that tween pausing works with the new performance.now
|
||||
* TODO: Game.Time should monitor pause duration
|
||||
|
||||
@@ -137,6 +137,10 @@
|
||||
<TypeScriptCompile Include="mobile\sprite test 1.ts" />
|
||||
<TypeScriptCompile Include="mobile\bunny mobile.ts" />
|
||||
<TypeScriptCompile Include="misc\time.ts" />
|
||||
<TypeScriptCompile Include="misc\starfield.ts" />
|
||||
<Content Include="misc\starfield.js">
|
||||
<DependentUpon>starfield.ts</DependentUpon>
|
||||
</Content>
|
||||
<Content Include="misc\time.js">
|
||||
<DependentUpon>time.ts</DependentUpon>
|
||||
</Content>
|
||||
@@ -146,6 +150,10 @@
|
||||
<Content Include="mobile\sprite test 1.js">
|
||||
<DependentUpon>sprite test 1.ts</DependentUpon>
|
||||
</Content>
|
||||
<TypeScriptCompile Include="particles\mousetrail.ts" />
|
||||
<Content Include="particles\mousetrail.js">
|
||||
<DependentUpon>mousetrail.ts</DependentUpon>
|
||||
</Content>
|
||||
<Content Include="scrollzones\ballscroller.js">
|
||||
<DependentUpon>ballscroller.ts</DependentUpon>
|
||||
</Content>
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/// <reference path="../../Phaser/Game.ts" />
|
||||
(function () {
|
||||
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update, render);
|
||||
var starfield;
|
||||
var xx = [];
|
||||
var yy = [];
|
||||
var zz = [];
|
||||
var xxx = 0;
|
||||
var yyy = 0;
|
||||
function create() {
|
||||
// the width of the starfield
|
||||
var star_w = 12000;
|
||||
for(var i = 0; i < 800; i++) {
|
||||
xx[i] = Math.floor(Math.random() * star_w * 2) - star_w;
|
||||
yy[i] = Math.floor(Math.random() * star_w * 2) - star_w;
|
||||
zz[i] = Math.floor(Math.random() * 160) + 1;
|
||||
}
|
||||
starfield = myGame.createDynamicTexture(800, 600);
|
||||
}
|
||||
function update() {
|
||||
starfield.clear();
|
||||
for(var i = 0; i < 800; i++) {
|
||||
if(zz[i] == 1) {
|
||||
zz[i] = 100;
|
||||
}
|
||||
xxx = (xx[i]) / (zz[i]);
|
||||
yyy = (yy[i]) / (zz[i])--;
|
||||
var x = xxx + myGame.input.x;
|
||||
var y = yyy + myGame.input.y;
|
||||
var c = '#ffffff';
|
||||
if(zz[i] > 80) {
|
||||
c = '#666666';
|
||||
} else if(zz[i] > 60) {
|
||||
c = '#888888';
|
||||
} else if(zz[i] > 40) {
|
||||
c = '#aaaaaa';
|
||||
}
|
||||
//else if (zz[i] > 20) c = '#ffffff';
|
||||
starfield.setPixel(x, y, c);
|
||||
}
|
||||
}
|
||||
function render() {
|
||||
starfield.render();
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,61 @@
|
||||
/// <reference path="../../Phaser/Game.ts" />
|
||||
|
||||
(function () {
|
||||
|
||||
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update, render);
|
||||
|
||||
var starfield: Phaser.DynamicTexture;
|
||||
|
||||
var xx = [];
|
||||
var yy = [];
|
||||
var zz = [];
|
||||
var xxx = 0;
|
||||
var yyy = 0;
|
||||
|
||||
function create() {
|
||||
|
||||
// the width of the starfield
|
||||
var star_w: number = 12000;
|
||||
|
||||
for (var i: number = 0; i < 800; i++)
|
||||
{
|
||||
xx[i] = Math.floor(Math.random() * star_w * 2) - star_w
|
||||
yy[i] = Math.floor(Math.random() * star_w * 2) - star_w
|
||||
zz[i] = Math.floor(Math.random() * 160) + 1;
|
||||
}
|
||||
|
||||
starfield = myGame.createDynamicTexture(800, 600);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
starfield.clear();
|
||||
|
||||
for (var i: number = 0; i < 800; i++)
|
||||
{
|
||||
if (zz[i] == 1) zz[i] = 100;
|
||||
xxx = (xx[i]) / (zz[i]);
|
||||
yyy = (yy[i]) / (zz[i])--;
|
||||
//var x: number = xxx + myGame.input.x;
|
||||
//var y: number = yyy + myGame.input.y;
|
||||
var x: number = xxx + 400;
|
||||
var y: number = yyy + 300;
|
||||
var c: string = '#ffffff';
|
||||
|
||||
if (zz[i] > 80) c = '#666666';
|
||||
else if (zz[i] > 60) c = '#888888'
|
||||
else if (zz[i] > 40) c = '#aaaaaa';
|
||||
|
||||
starfield.setPixel(x, y, c);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
starfield.render();
|
||||
|
||||
}
|
||||
|
||||
})();
|
||||
@@ -0,0 +1,23 @@
|
||||
/// <reference path="../../Phaser/Game.ts" />
|
||||
(function () {
|
||||
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
|
||||
var emitter;
|
||||
function init() {
|
||||
myGame.loader.addImageFile('jet', 'assets/sprites/particle1.png');
|
||||
myGame.loader.load();
|
||||
}
|
||||
function create() {
|
||||
emitter = myGame.createEmitter(myGame.stage.centerX, myGame.stage.centerY);
|
||||
emitter.makeParticles('jet', 100);
|
||||
emitter.gravity = 200;
|
||||
emitter.setXSpeed(-50, 50);
|
||||
emitter.setYSpeed(-50, -100);
|
||||
emitter.setRotation(0, 0);
|
||||
emitter.start(false, 10, 0.05);
|
||||
}
|
||||
function update() {
|
||||
emitter.x = myGame.input.x;
|
||||
emitter.y = myGame.input.y;
|
||||
//emitter.em
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,38 @@
|
||||
/// <reference path="../../Phaser/Game.ts" />
|
||||
|
||||
(function () {
|
||||
|
||||
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
|
||||
|
||||
var emitter: Phaser.Emitter;
|
||||
|
||||
function init() {
|
||||
|
||||
myGame.loader.addImageFile('jet', 'assets/sprites/particle1.png');
|
||||
|
||||
myGame.loader.load();
|
||||
|
||||
}
|
||||
|
||||
function create() {
|
||||
|
||||
emitter = myGame.createEmitter(myGame.stage.centerX, myGame.stage.centerY);
|
||||
emitter.makeParticles('jet', 100);
|
||||
|
||||
emitter.gravity = 200;
|
||||
emitter.setXSpeed(-50, 50);
|
||||
emitter.setYSpeed(-50, -100);
|
||||
emitter.setRotation(0, 0);
|
||||
emitter.start(false, 10, 0.05);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
emitter.x = myGame.input.x;
|
||||
emitter.y = myGame.input.y;
|
||||
//emitter.em
|
||||
|
||||
}
|
||||
|
||||
})();
|
||||
+85
-28
@@ -1518,13 +1518,14 @@ var Phaser;
|
||||
*/
|
||||
this.renderDebugPointColor = 'rgba(255,255,255,1)';
|
||||
/**
|
||||
* Flip the graphic vertically? (default to false)
|
||||
* Flip the graphic horizontally? (defaults to false)
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.flipped = false;
|
||||
this._texture = null;
|
||||
this.animations = new Phaser.AnimationManager(this._game, this);
|
||||
if(key !== null) {
|
||||
this.cacheKey = key;
|
||||
this.loadGraphic(key);
|
||||
} else {
|
||||
this.bounds.width = 16;
|
||||
@@ -6795,6 +6796,20 @@ var Phaser;
|
||||
function (ax, ay, bx, by) {
|
||||
return ax * bx + ay * by;
|
||||
};
|
||||
GameMath.prototype.shuffleArray = /**
|
||||
* Shuffles the data in the given array into a new order
|
||||
* @param array The array to shuffle
|
||||
* @return The array
|
||||
*/
|
||||
function (array) {
|
||||
for(var i = array.length - 1; i > 0; i--) {
|
||||
var j = Math.floor(Math.random() * (i + 1));
|
||||
var temp = array[i];
|
||||
array[i] = array[j];
|
||||
array[j] = temp;
|
||||
}
|
||||
return array;
|
||||
};
|
||||
return GameMath;
|
||||
})();
|
||||
Phaser.GameMath = GameMath;
|
||||
@@ -7552,7 +7567,6 @@ var Phaser;
|
||||
this._onFileLoad = onFileLoadCallback;
|
||||
if(this._keys.length > 0) {
|
||||
this._progressChunk = 100 / this._keys.length;
|
||||
console.log('prog chunk', this._progressChunk);
|
||||
this.loadFile();
|
||||
} else {
|
||||
this.progress = 1;
|
||||
@@ -7692,8 +7706,6 @@ var Phaser;
|
||||
*/
|
||||
function (previousKey, success) {
|
||||
this.progress = Math.round(this.progress + this._progressChunk);
|
||||
//this.progress = this.progress + this._progressChunk;
|
||||
console.log('progress', this.progress);
|
||||
if(this.progress > 100) {
|
||||
this.progress = 100;
|
||||
}
|
||||
@@ -8759,7 +8771,6 @@ var Phaser;
|
||||
this.disableBootScreen = false;
|
||||
this._game = game;
|
||||
this.canvas = document.createElement('canvas');
|
||||
this.canvas.id = 'bob';
|
||||
this.canvas.width = width;
|
||||
this.canvas.height = height;
|
||||
if(document.getElementById(parent)) {
|
||||
@@ -8834,7 +8845,10 @@ var Phaser;
|
||||
}
|
||||
}
|
||||
};
|
||||
Stage.prototype.getOffset = function (element) {
|
||||
Stage.prototype.getOffset = /**
|
||||
* Get the DOM offset values of the given element
|
||||
*/
|
||||
function (element) {
|
||||
var box = element.getBoundingClientRect();
|
||||
var clientTop = element.clientTop || document.body.clientTop || 0;
|
||||
var clientLeft = element.clientLeft || document.body.clientLeft || 0;
|
||||
@@ -9511,23 +9525,28 @@ var Phaser;
|
||||
this.onComplete = new Phaser.Signal();
|
||||
}
|
||||
Tween.prototype.to = /**
|
||||
* Config the tween result.
|
||||
* Configure the Tween
|
||||
* @param properties {object} Propertis you want to tween.
|
||||
* @param [duration] {number} duration of this tween.
|
||||
* @param ease {any} Easing function.
|
||||
* @param autoStart {boolean} Whether this tween will start automatically or not.
|
||||
* @param [ease] {any} Easing function.
|
||||
* @param [autoStart] {boolean} Whether this tween will start automatically or not.
|
||||
* @param [delay] {number} delay before this tween will start, defaults to 0 (no delay)
|
||||
* @return {Tween} Itself.
|
||||
*/
|
||||
function (properties, duration, ease, autoStart) {
|
||||
function (properties, duration, ease, autoStart, delay) {
|
||||
if (typeof duration === "undefined") { duration = 1000; }
|
||||
if (typeof ease === "undefined") { ease = null; }
|
||||
if (typeof autoStart === "undefined") { autoStart = false; }
|
||||
if (typeof delay === "undefined") { delay = 0; }
|
||||
this._duration = duration;
|
||||
// If properties isn't an object this will fail, sanity check it here somehow?
|
||||
this._valuesEnd = properties;
|
||||
if(ease !== null) {
|
||||
this._easingFunction = ease;
|
||||
}
|
||||
if(delay > 0) {
|
||||
this._delayTime = delay;
|
||||
}
|
||||
if(autoStart === true) {
|
||||
return this.start();
|
||||
} else {
|
||||
@@ -10351,6 +10370,20 @@ var Phaser;
|
||||
document.body.removeChild(el);
|
||||
this.css3D = (has3d !== undefined && has3d.length > 0 && has3d !== "none");
|
||||
};
|
||||
Device.prototype.isConsoleOpen = function () {
|
||||
if(window.console && window.console['firebug']) {
|
||||
return true;
|
||||
}
|
||||
if(window.console) {
|
||||
console.profile();
|
||||
console.profileEnd();
|
||||
if(console.clear) {
|
||||
console.clear();
|
||||
}
|
||||
return console['profiles'].length > 0;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
Device.prototype.getAll = /**
|
||||
* Get all informations of host device.
|
||||
* @return {string} Informations in a string.
|
||||
@@ -11020,10 +11053,14 @@ var Phaser;
|
||||
this.x = this.pageX - this._game.stage.offset.x;
|
||||
this.y = this.pageY - this._game.stage.offset.y;
|
||||
this.pointB.setTo(this.x, this.y);
|
||||
this.circle.setTo(this.x, this.y, 44);
|
||||
this.circle.x = this.x;
|
||||
this.circle.y = this.y;
|
||||
if(this._game.input.multiInputOverride == Phaser.Input.MOUSE_OVERRIDES_TOUCH || this._game.input.multiInputOverride == Phaser.Input.MOUSE_TOUCH_COMBINE || (this._game.input.multiInputOverride == Phaser.Input.TOUCH_OVERRIDES_MOUSE && this._game.input.currentPointers == 0)) {
|
||||
this._game.input.x = this.x * this._game.input.scaleX;
|
||||
this._game.input.y = this.y * this._game.input.scaleY;
|
||||
this._game.input.point.setTo(this._game.input.x, this._game.input.y);
|
||||
this._game.input.circle.x = this._game.input.x;
|
||||
this._game.input.circle.y = this._game.input.y;
|
||||
}
|
||||
return this;
|
||||
};
|
||||
@@ -11118,12 +11155,12 @@ var Phaser;
|
||||
return;
|
||||
}
|
||||
this._game.stage.context.beginPath();
|
||||
this._game.stage.context.arc(this.x, this.y, this.circle.radius * 2, 0, Math.PI * 2);
|
||||
this._game.stage.context.arc(this.x, this.y, this.circle.radius, 0, Math.PI * 2);
|
||||
if(this.active) {
|
||||
this._game.stage.context.fillStyle = 'rgb(0,255,0)';
|
||||
this._game.stage.context.fillStyle = 'rgba(0,255,0,0.5)';
|
||||
this._game.stage.context.strokeStyle = 'rgb(0,255,0)';
|
||||
} else {
|
||||
this._game.stage.context.fillStyle = 'rgb(100,0,0)';
|
||||
this._game.stage.context.fillStyle = 'rgba(255,0,0,0.5)';
|
||||
this._game.stage.context.strokeStyle = 'rgb(100,0,0)';
|
||||
}
|
||||
this._game.stage.context.fill();
|
||||
@@ -11313,6 +11350,19 @@ var Phaser;
|
||||
*/
|
||||
this.multiInputOverride = Input.MOUSE_TOUCH_COMBINE;
|
||||
/**
|
||||
* A Point object representing the x/y screen coordinates of the Pointer.
|
||||
* @property point
|
||||
* @type {Point}
|
||||
**/
|
||||
this.point = null;
|
||||
/**
|
||||
* A Circle object centered on the x/y screen coordinates of the Input.
|
||||
* Default size of 44px (Apples recommended "finger tip" size) but can be changed to anything
|
||||
* @property circle
|
||||
* @type {Circle}
|
||||
**/
|
||||
this.circle = null;
|
||||
/**
|
||||
* X coordinate of the most recent Pointer event
|
||||
* @type {Number}
|
||||
* @private
|
||||
@@ -11417,6 +11467,8 @@ var Phaser;
|
||||
this.onUp = new Phaser.Signal();
|
||||
this.onTap = new Phaser.Signal();
|
||||
this.onHold = new Phaser.Signal();
|
||||
this.point = new Phaser.Point();
|
||||
this.circle = new Phaser.Circle(0, 0, 44);
|
||||
this.currentPointers = 0;
|
||||
}
|
||||
Input.MOUSE_OVERRIDES_TOUCH = 0;
|
||||
@@ -11472,7 +11524,13 @@ var Phaser;
|
||||
this.pointer9.update();
|
||||
this.pointer10.update();
|
||||
};
|
||||
Input.prototype.reset = function () {
|
||||
Input.prototype.reset = /**
|
||||
* Reset all of the Pointers and Input states
|
||||
* @method reset
|
||||
* @param hard {Boolean} A soft reset (hard = false) won't reset any signals that might be bound. A hard reset will.
|
||||
**/
|
||||
function (hard) {
|
||||
if (typeof hard === "undefined") { hard = false; }
|
||||
this.keyboard.reset();
|
||||
this.pointer1.reset();
|
||||
this.pointer2.reset();
|
||||
@@ -11484,11 +11542,13 @@ var Phaser;
|
||||
this.pointer8.reset();
|
||||
this.pointer9.reset();
|
||||
this.pointer10.reset();
|
||||
this.onDown = new Phaser.Signal();
|
||||
this.onUp = new Phaser.Signal();
|
||||
this.onTap = new Phaser.Signal();
|
||||
this.onHold = new Phaser.Signal();
|
||||
this.currentPointers = 0;
|
||||
if(hard == true) {
|
||||
this.onDown = new Phaser.Signal();
|
||||
this.onUp = new Phaser.Signal();
|
||||
this.onTap = new Phaser.Signal();
|
||||
this.onHold = new Phaser.Signal();
|
||||
}
|
||||
};
|
||||
Object.defineProperty(Input.prototype, "totalInactivePointers", {
|
||||
get: /**
|
||||
@@ -12576,8 +12636,8 @@ var Phaser;
|
||||
*/
|
||||
this.lineColor = 'rgb(0,255,0)';
|
||||
/**
|
||||
* Width of outline. (default is 1)
|
||||
* @type {number}
|
||||
* The color of the filled area in rgb or rgba string format
|
||||
* @type {string} Defaults to rgb(0,100,0) - a green color
|
||||
*/
|
||||
this.fillColor = 'rgb(0,100,0)';
|
||||
this.type = GeomSprite.UNASSIGNED;
|
||||
@@ -12752,11 +12812,6 @@ var Phaser;
|
||||
this._dy = cameraOffsetY + (this.bounds.y - camera.worldView.y);
|
||||
this._dw = this.bounds.width * this.scale.x;
|
||||
this._dh = this.bounds.height * this.scale.y;
|
||||
// Circles are drawn center based
|
||||
if(this.type == GeomSprite.CIRCLE) {
|
||||
this._dx += this.circle.radius;
|
||||
this._dy += this.circle.radius;
|
||||
}
|
||||
// Apply camera difference
|
||||
if(this.scrollFactor.x !== 1.0 || this.scrollFactor.y !== 1.0) {
|
||||
this._dx -= (camera.worldView.x * this.scrollFactor.x);
|
||||
@@ -12790,7 +12845,9 @@ var Phaser;
|
||||
if(this.type == GeomSprite.CIRCLE) {
|
||||
this.context.beginPath();
|
||||
this.context.arc(this._dx, this._dy, this.circle.radius, 0, Math.PI * 2);
|
||||
this.context.stroke();
|
||||
if(this.renderOutline) {
|
||||
this.context.stroke();
|
||||
}
|
||||
if(this.renderFill) {
|
||||
this.context.fill();
|
||||
}
|
||||
@@ -14587,7 +14644,7 @@ var Phaser;
|
||||
if(this.onDestroyCallback !== null) {
|
||||
this.onDestroyCallback.call(this.callbackContext);
|
||||
}
|
||||
this.input.reset();
|
||||
this.input.reset(true);
|
||||
// Prototype?
|
||||
if(typeof state === 'function') {
|
||||
this.state = new state(this);
|
||||
|
||||
Vendored
+42
-9
@@ -1057,6 +1057,10 @@ module Phaser {
|
||||
*/
|
||||
public animations: AnimationManager;
|
||||
/**
|
||||
* The cache key that was used for this texture (if any)
|
||||
*/
|
||||
public cacheKey: string;
|
||||
/**
|
||||
* Render bound of this sprite for debugging? (default to false)
|
||||
* @type {boolean}
|
||||
*/
|
||||
@@ -1077,7 +1081,7 @@ module Phaser {
|
||||
*/
|
||||
public renderDebugPointColor: string;
|
||||
/**
|
||||
* Flip the graphic vertically? (default to false)
|
||||
* Flip the graphic horizontally? (defaults to false)
|
||||
* @type {boolean}
|
||||
*/
|
||||
public flipped: bool;
|
||||
@@ -3538,7 +3542,7 @@ module Phaser {
|
||||
* @param y {number} Y position of the target pixel.
|
||||
* @param color {number} Native integer with color value. (format: 0xRRGGBB)
|
||||
*/
|
||||
public setPixel(x: number, y: number, color: number): void;
|
||||
public setPixel(x: number, y: number, color: string): void;
|
||||
/**
|
||||
* Set color (with alpha) of a specific pixel.
|
||||
* @param x {number} X position of the target pixel.
|
||||
@@ -4098,6 +4102,12 @@ module Phaser {
|
||||
* @return Dot product
|
||||
*/
|
||||
public dotProduct(ax: number, ay: number, bx: number, by: number): number;
|
||||
/**
|
||||
* Shuffles the data in the given array into a new order
|
||||
* @param array The array to shuffle
|
||||
* @return The array
|
||||
*/
|
||||
public shuffleArray(array);
|
||||
}
|
||||
}
|
||||
/**
|
||||
@@ -5115,6 +5125,9 @@ module Phaser {
|
||||
* This method is called when the canvas elements visibility is changed.
|
||||
*/
|
||||
private visibilityChange(event);
|
||||
/**
|
||||
* Get the DOM offset values of the given element
|
||||
*/
|
||||
private getOffset(element);
|
||||
/**
|
||||
* Canvas strokeStyle.
|
||||
@@ -5475,14 +5488,15 @@ module Phaser {
|
||||
*/
|
||||
public onComplete: Signal;
|
||||
/**
|
||||
* Config the tween result.
|
||||
* Configure the Tween
|
||||
* @param properties {object} Propertis you want to tween.
|
||||
* @param [duration] {number} duration of this tween.
|
||||
* @param ease {any} Easing function.
|
||||
* @param autoStart {boolean} Whether this tween will start automatically or not.
|
||||
* @param [ease] {any} Easing function.
|
||||
* @param [autoStart] {boolean} Whether this tween will start automatically or not.
|
||||
* @param [delay] {number} delay before this tween will start, defaults to 0 (no delay)
|
||||
* @return {Tween} Itself.
|
||||
*/
|
||||
public to(properties, duration?: number, ease?: any, autoStart?: bool): Tween;
|
||||
public to(properties, duration?: number, ease?: any, autoStart?: bool, delay?: number): Tween;
|
||||
/**
|
||||
* Start to tween.
|
||||
*/
|
||||
@@ -5959,6 +5973,7 @@ module Phaser {
|
||||
* @private
|
||||
*/
|
||||
private _checkCSS3D();
|
||||
public isConsoleOpen(): bool;
|
||||
/**
|
||||
* Get all informations of host device.
|
||||
* @return {string} Informations in a string.
|
||||
@@ -6598,6 +6613,19 @@ module Phaser {
|
||||
*/
|
||||
public gestures: Gestures;
|
||||
/**
|
||||
* A Point object representing the x/y screen coordinates of the Pointer.
|
||||
* @property point
|
||||
* @type {Point}
|
||||
**/
|
||||
public point: Point;
|
||||
/**
|
||||
* A Circle object centered on the x/y screen coordinates of the Input.
|
||||
* Default size of 44px (Apples recommended "finger tip" size) but can be changed to anything
|
||||
* @property circle
|
||||
* @type {Circle}
|
||||
**/
|
||||
public circle: Circle;
|
||||
/**
|
||||
* X coordinate of the most recent Pointer event
|
||||
* @type {Number}
|
||||
* @private
|
||||
@@ -6782,7 +6810,12 @@ module Phaser {
|
||||
public y : number;
|
||||
public start(): void;
|
||||
public update(): void;
|
||||
public reset(): void;
|
||||
/**
|
||||
* Reset all of the Pointers and Input states
|
||||
* @method reset
|
||||
* @param hard {Boolean} A soft reset (hard = false) won't reset any signals that might be bound. A hard reset will.
|
||||
**/
|
||||
public reset(hard?: bool): void;
|
||||
/**
|
||||
* Get the total number of inactive Pointers
|
||||
* @method totalInactivePointers
|
||||
@@ -7403,8 +7436,8 @@ module Phaser {
|
||||
*/
|
||||
public lineColor: string;
|
||||
/**
|
||||
* Width of outline. (default is 1)
|
||||
* @type {number}
|
||||
* The color of the filled area in rgb or rgba string format
|
||||
* @type {string} Defaults to rgb(0,100,0) - a green color
|
||||
*/
|
||||
public fillColor: string;
|
||||
/**
|
||||
|
||||
+85
-28
@@ -1518,13 +1518,14 @@ var Phaser;
|
||||
*/
|
||||
this.renderDebugPointColor = 'rgba(255,255,255,1)';
|
||||
/**
|
||||
* Flip the graphic vertically? (default to false)
|
||||
* Flip the graphic horizontally? (defaults to false)
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.flipped = false;
|
||||
this._texture = null;
|
||||
this.animations = new Phaser.AnimationManager(this._game, this);
|
||||
if(key !== null) {
|
||||
this.cacheKey = key;
|
||||
this.loadGraphic(key);
|
||||
} else {
|
||||
this.bounds.width = 16;
|
||||
@@ -6795,6 +6796,20 @@ var Phaser;
|
||||
function (ax, ay, bx, by) {
|
||||
return ax * bx + ay * by;
|
||||
};
|
||||
GameMath.prototype.shuffleArray = /**
|
||||
* Shuffles the data in the given array into a new order
|
||||
* @param array The array to shuffle
|
||||
* @return The array
|
||||
*/
|
||||
function (array) {
|
||||
for(var i = array.length - 1; i > 0; i--) {
|
||||
var j = Math.floor(Math.random() * (i + 1));
|
||||
var temp = array[i];
|
||||
array[i] = array[j];
|
||||
array[j] = temp;
|
||||
}
|
||||
return array;
|
||||
};
|
||||
return GameMath;
|
||||
})();
|
||||
Phaser.GameMath = GameMath;
|
||||
@@ -7552,7 +7567,6 @@ var Phaser;
|
||||
this._onFileLoad = onFileLoadCallback;
|
||||
if(this._keys.length > 0) {
|
||||
this._progressChunk = 100 / this._keys.length;
|
||||
console.log('prog chunk', this._progressChunk);
|
||||
this.loadFile();
|
||||
} else {
|
||||
this.progress = 1;
|
||||
@@ -7692,8 +7706,6 @@ var Phaser;
|
||||
*/
|
||||
function (previousKey, success) {
|
||||
this.progress = Math.round(this.progress + this._progressChunk);
|
||||
//this.progress = this.progress + this._progressChunk;
|
||||
console.log('progress', this.progress);
|
||||
if(this.progress > 100) {
|
||||
this.progress = 100;
|
||||
}
|
||||
@@ -8759,7 +8771,6 @@ var Phaser;
|
||||
this.disableBootScreen = false;
|
||||
this._game = game;
|
||||
this.canvas = document.createElement('canvas');
|
||||
this.canvas.id = 'bob';
|
||||
this.canvas.width = width;
|
||||
this.canvas.height = height;
|
||||
if(document.getElementById(parent)) {
|
||||
@@ -8834,7 +8845,10 @@ var Phaser;
|
||||
}
|
||||
}
|
||||
};
|
||||
Stage.prototype.getOffset = function (element) {
|
||||
Stage.prototype.getOffset = /**
|
||||
* Get the DOM offset values of the given element
|
||||
*/
|
||||
function (element) {
|
||||
var box = element.getBoundingClientRect();
|
||||
var clientTop = element.clientTop || document.body.clientTop || 0;
|
||||
var clientLeft = element.clientLeft || document.body.clientLeft || 0;
|
||||
@@ -9511,23 +9525,28 @@ var Phaser;
|
||||
this.onComplete = new Phaser.Signal();
|
||||
}
|
||||
Tween.prototype.to = /**
|
||||
* Config the tween result.
|
||||
* Configure the Tween
|
||||
* @param properties {object} Propertis you want to tween.
|
||||
* @param [duration] {number} duration of this tween.
|
||||
* @param ease {any} Easing function.
|
||||
* @param autoStart {boolean} Whether this tween will start automatically or not.
|
||||
* @param [ease] {any} Easing function.
|
||||
* @param [autoStart] {boolean} Whether this tween will start automatically or not.
|
||||
* @param [delay] {number} delay before this tween will start, defaults to 0 (no delay)
|
||||
* @return {Tween} Itself.
|
||||
*/
|
||||
function (properties, duration, ease, autoStart) {
|
||||
function (properties, duration, ease, autoStart, delay) {
|
||||
if (typeof duration === "undefined") { duration = 1000; }
|
||||
if (typeof ease === "undefined") { ease = null; }
|
||||
if (typeof autoStart === "undefined") { autoStart = false; }
|
||||
if (typeof delay === "undefined") { delay = 0; }
|
||||
this._duration = duration;
|
||||
// If properties isn't an object this will fail, sanity check it here somehow?
|
||||
this._valuesEnd = properties;
|
||||
if(ease !== null) {
|
||||
this._easingFunction = ease;
|
||||
}
|
||||
if(delay > 0) {
|
||||
this._delayTime = delay;
|
||||
}
|
||||
if(autoStart === true) {
|
||||
return this.start();
|
||||
} else {
|
||||
@@ -10351,6 +10370,20 @@ var Phaser;
|
||||
document.body.removeChild(el);
|
||||
this.css3D = (has3d !== undefined && has3d.length > 0 && has3d !== "none");
|
||||
};
|
||||
Device.prototype.isConsoleOpen = function () {
|
||||
if(window.console && window.console['firebug']) {
|
||||
return true;
|
||||
}
|
||||
if(window.console) {
|
||||
console.profile();
|
||||
console.profileEnd();
|
||||
if(console.clear) {
|
||||
console.clear();
|
||||
}
|
||||
return console['profiles'].length > 0;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
Device.prototype.getAll = /**
|
||||
* Get all informations of host device.
|
||||
* @return {string} Informations in a string.
|
||||
@@ -11020,10 +11053,14 @@ var Phaser;
|
||||
this.x = this.pageX - this._game.stage.offset.x;
|
||||
this.y = this.pageY - this._game.stage.offset.y;
|
||||
this.pointB.setTo(this.x, this.y);
|
||||
this.circle.setTo(this.x, this.y, 44);
|
||||
this.circle.x = this.x;
|
||||
this.circle.y = this.y;
|
||||
if(this._game.input.multiInputOverride == Phaser.Input.MOUSE_OVERRIDES_TOUCH || this._game.input.multiInputOverride == Phaser.Input.MOUSE_TOUCH_COMBINE || (this._game.input.multiInputOverride == Phaser.Input.TOUCH_OVERRIDES_MOUSE && this._game.input.currentPointers == 0)) {
|
||||
this._game.input.x = this.x * this._game.input.scaleX;
|
||||
this._game.input.y = this.y * this._game.input.scaleY;
|
||||
this._game.input.point.setTo(this._game.input.x, this._game.input.y);
|
||||
this._game.input.circle.x = this._game.input.x;
|
||||
this._game.input.circle.y = this._game.input.y;
|
||||
}
|
||||
return this;
|
||||
};
|
||||
@@ -11118,12 +11155,12 @@ var Phaser;
|
||||
return;
|
||||
}
|
||||
this._game.stage.context.beginPath();
|
||||
this._game.stage.context.arc(this.x, this.y, this.circle.radius * 2, 0, Math.PI * 2);
|
||||
this._game.stage.context.arc(this.x, this.y, this.circle.radius, 0, Math.PI * 2);
|
||||
if(this.active) {
|
||||
this._game.stage.context.fillStyle = 'rgb(0,255,0)';
|
||||
this._game.stage.context.fillStyle = 'rgba(0,255,0,0.5)';
|
||||
this._game.stage.context.strokeStyle = 'rgb(0,255,0)';
|
||||
} else {
|
||||
this._game.stage.context.fillStyle = 'rgb(100,0,0)';
|
||||
this._game.stage.context.fillStyle = 'rgba(255,0,0,0.5)';
|
||||
this._game.stage.context.strokeStyle = 'rgb(100,0,0)';
|
||||
}
|
||||
this._game.stage.context.fill();
|
||||
@@ -11313,6 +11350,19 @@ var Phaser;
|
||||
*/
|
||||
this.multiInputOverride = Input.MOUSE_TOUCH_COMBINE;
|
||||
/**
|
||||
* A Point object representing the x/y screen coordinates of the Pointer.
|
||||
* @property point
|
||||
* @type {Point}
|
||||
**/
|
||||
this.point = null;
|
||||
/**
|
||||
* A Circle object centered on the x/y screen coordinates of the Input.
|
||||
* Default size of 44px (Apples recommended "finger tip" size) but can be changed to anything
|
||||
* @property circle
|
||||
* @type {Circle}
|
||||
**/
|
||||
this.circle = null;
|
||||
/**
|
||||
* X coordinate of the most recent Pointer event
|
||||
* @type {Number}
|
||||
* @private
|
||||
@@ -11417,6 +11467,8 @@ var Phaser;
|
||||
this.onUp = new Phaser.Signal();
|
||||
this.onTap = new Phaser.Signal();
|
||||
this.onHold = new Phaser.Signal();
|
||||
this.point = new Phaser.Point();
|
||||
this.circle = new Phaser.Circle(0, 0, 44);
|
||||
this.currentPointers = 0;
|
||||
}
|
||||
Input.MOUSE_OVERRIDES_TOUCH = 0;
|
||||
@@ -11472,7 +11524,13 @@ var Phaser;
|
||||
this.pointer9.update();
|
||||
this.pointer10.update();
|
||||
};
|
||||
Input.prototype.reset = function () {
|
||||
Input.prototype.reset = /**
|
||||
* Reset all of the Pointers and Input states
|
||||
* @method reset
|
||||
* @param hard {Boolean} A soft reset (hard = false) won't reset any signals that might be bound. A hard reset will.
|
||||
**/
|
||||
function (hard) {
|
||||
if (typeof hard === "undefined") { hard = false; }
|
||||
this.keyboard.reset();
|
||||
this.pointer1.reset();
|
||||
this.pointer2.reset();
|
||||
@@ -11484,11 +11542,13 @@ var Phaser;
|
||||
this.pointer8.reset();
|
||||
this.pointer9.reset();
|
||||
this.pointer10.reset();
|
||||
this.onDown = new Phaser.Signal();
|
||||
this.onUp = new Phaser.Signal();
|
||||
this.onTap = new Phaser.Signal();
|
||||
this.onHold = new Phaser.Signal();
|
||||
this.currentPointers = 0;
|
||||
if(hard == true) {
|
||||
this.onDown = new Phaser.Signal();
|
||||
this.onUp = new Phaser.Signal();
|
||||
this.onTap = new Phaser.Signal();
|
||||
this.onHold = new Phaser.Signal();
|
||||
}
|
||||
};
|
||||
Object.defineProperty(Input.prototype, "totalInactivePointers", {
|
||||
get: /**
|
||||
@@ -12576,8 +12636,8 @@ var Phaser;
|
||||
*/
|
||||
this.lineColor = 'rgb(0,255,0)';
|
||||
/**
|
||||
* Width of outline. (default is 1)
|
||||
* @type {number}
|
||||
* The color of the filled area in rgb or rgba string format
|
||||
* @type {string} Defaults to rgb(0,100,0) - a green color
|
||||
*/
|
||||
this.fillColor = 'rgb(0,100,0)';
|
||||
this.type = GeomSprite.UNASSIGNED;
|
||||
@@ -12752,11 +12812,6 @@ var Phaser;
|
||||
this._dy = cameraOffsetY + (this.bounds.y - camera.worldView.y);
|
||||
this._dw = this.bounds.width * this.scale.x;
|
||||
this._dh = this.bounds.height * this.scale.y;
|
||||
// Circles are drawn center based
|
||||
if(this.type == GeomSprite.CIRCLE) {
|
||||
this._dx += this.circle.radius;
|
||||
this._dy += this.circle.radius;
|
||||
}
|
||||
// Apply camera difference
|
||||
if(this.scrollFactor.x !== 1.0 || this.scrollFactor.y !== 1.0) {
|
||||
this._dx -= (camera.worldView.x * this.scrollFactor.x);
|
||||
@@ -12790,7 +12845,9 @@ var Phaser;
|
||||
if(this.type == GeomSprite.CIRCLE) {
|
||||
this.context.beginPath();
|
||||
this.context.arc(this._dx, this._dy, this.circle.radius, 0, Math.PI * 2);
|
||||
this.context.stroke();
|
||||
if(this.renderOutline) {
|
||||
this.context.stroke();
|
||||
}
|
||||
if(this.renderFill) {
|
||||
this.context.fill();
|
||||
}
|
||||
@@ -14587,7 +14644,7 @@ var Phaser;
|
||||
if(this.onDestroyCallback !== null) {
|
||||
this.onDestroyCallback.call(this.callbackContext);
|
||||
}
|
||||
this.input.reset();
|
||||
this.input.reset(true);
|
||||
// Prototype?
|
||||
if(typeof state === 'function') {
|
||||
this.state = new state(this);
|
||||
|
||||
Reference in New Issue
Block a user