mirror of
https://github.com/photonstorm/phaser
synced 2024-12-02 17:41:06 +00:00
Merge branch 'dev' of https://github.com/photonstorm/phaser into dev
This commit is contained in:
commit
2f3fc22b50
8 changed files with 93 additions and 48 deletions
|
@ -138,6 +138,11 @@ Phaser.AnimationParser = {
|
||||||
frames[i].spriteSourceSize.h
|
frames[i].spriteSourceSize.h
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (frames[i].rotated)
|
||||||
|
{
|
||||||
|
newFrame.rotated = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
@ -251,6 +256,11 @@ Phaser.AnimationParser = {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (frames[key].rotated)
|
||||||
|
{
|
||||||
|
newFrame.rotated = true;
|
||||||
|
}
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ Phaser.Frame = function (index, x, y, width, height, name) {
|
||||||
this.distance = Phaser.Math.distance(0, 0, width, height);
|
this.distance = Phaser.Math.distance(0, 0, width, height);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property {boolean} rotated - Rotated? (not yet implemented)
|
* @property {boolean} rotated - Is the frame rotated in the source texture?
|
||||||
* @default
|
* @default
|
||||||
*/
|
*/
|
||||||
this.rotated = false;
|
this.rotated = false;
|
||||||
|
|
|
@ -190,6 +190,11 @@ Phaser.Component.LoadTexture.prototype = {
|
||||||
this.texture.trim = null;
|
this.texture.trim = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (frame.rotated)
|
||||||
|
{
|
||||||
|
this.texture.rotated = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.cropRect)
|
if (this.cropRect)
|
||||||
{
|
{
|
||||||
this.updateCrop();
|
this.updateCrop();
|
||||||
|
|
|
@ -448,8 +448,22 @@ PIXI.Sprite.prototype._renderCanvas = function(renderSession, matrix)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore null sources
|
// Ignore null sources
|
||||||
if (this.texture.valid)
|
if (!this.texture.valid)
|
||||||
{
|
{
|
||||||
|
// Update the children and leave
|
||||||
|
for (var i = 0; i < this.children.length; i++)
|
||||||
|
{
|
||||||
|
this.children[i]._renderCanvas(renderSession);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._mask)
|
||||||
|
{
|
||||||
|
renderSession.maskManager.popMask(renderSession);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var resolution = this.texture.baseTexture.resolution / renderSession.resolution;
|
var resolution = this.texture.baseTexture.resolution / renderSession.resolution;
|
||||||
|
|
||||||
renderSession.context.globalAlpha = this.worldAlpha;
|
renderSession.context.globalAlpha = this.worldAlpha;
|
||||||
|
@ -483,6 +497,16 @@ PIXI.Sprite.prototype._renderCanvas = function(renderSession, matrix)
|
||||||
var cw = this.texture.crop.width;
|
var cw = this.texture.crop.width;
|
||||||
var ch = this.texture.crop.height;
|
var ch = this.texture.crop.height;
|
||||||
|
|
||||||
|
if (this.texture.rotated)
|
||||||
|
{
|
||||||
|
// 90 degree coordinate rotation
|
||||||
|
cw = ch;
|
||||||
|
ch = this.texture.crop.width;
|
||||||
|
|
||||||
|
renderSession.context.translate(0, cw);
|
||||||
|
renderSession.context.rotate(-1.5707963267948966);
|
||||||
|
}
|
||||||
|
|
||||||
dx /= resolution;
|
dx /= resolution;
|
||||||
dy /= resolution;
|
dy /= resolution;
|
||||||
|
|
||||||
|
@ -502,9 +526,9 @@ PIXI.Sprite.prototype._renderCanvas = function(renderSession, matrix)
|
||||||
{
|
{
|
||||||
var cx = this.texture.crop.x;
|
var cx = this.texture.crop.x;
|
||||||
var cy = this.texture.crop.y;
|
var cy = this.texture.crop.y;
|
||||||
|
|
||||||
renderSession.context.drawImage(this.texture.baseTexture.source, cx, cy, cw, ch, dx, dy, cw / resolution, ch / resolution);
|
renderSession.context.drawImage(this.texture.baseTexture.source, cx, cy, cw, ch, dx, dy, cw / resolution, ch / resolution);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for (var i = 0; i < this.children.length; i++)
|
for (var i = 0; i < this.children.length; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -328,13 +328,13 @@ PIXI.WebGLRenderer.prototype.setTexturePriority = function (textureNameCollectio
|
||||||
if (index + 1 < maxTextures)
|
if (index + 1 < maxTextures)
|
||||||
{
|
{
|
||||||
imageCache[imageName].base.textureIndex = index + 1;
|
imageCache[imageName].base.textureIndex = index + 1;
|
||||||
|
|
||||||
this.currentBatchedTextures.push(imageName);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
imageCache[imageName].base.textureIndex = maxTextures - 1;
|
imageCache[imageName].base.textureIndex = maxTextures - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.currentBatchedTextures.push(imageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.currentBatchedTextures;
|
return this.currentBatchedTextures;
|
||||||
|
|
|
@ -134,6 +134,8 @@ PIXI.Texture = function(baseTexture, frame, crop, trim)
|
||||||
*/
|
*/
|
||||||
this.crop = crop || new PIXI.Rectangle(0, 0, 1, 1);
|
this.crop = crop || new PIXI.Rectangle(0, 0, 1, 1);
|
||||||
|
|
||||||
|
this.rotated = false;
|
||||||
|
|
||||||
if (baseTexture.hasLoaded)
|
if (baseTexture.hasLoaded)
|
||||||
{
|
{
|
||||||
if (this.noFrame) frame = new PIXI.Rectangle(0, 0, baseTexture.width, baseTexture.height);
|
if (this.noFrame) frame = new PIXI.Rectangle(0, 0, baseTexture.width, baseTexture.height);
|
||||||
|
|
4
typescript/phaser.d.ts
vendored
4
typescript/phaser.d.ts
vendored
|
@ -1,7 +1,7 @@
|
||||||
/// <reference path="pixi.d.ts" />
|
/// <reference path="pixi.d.ts" />
|
||||||
/// <reference path="p2.d.ts" />
|
/// <reference path="p2.d.ts" />
|
||||||
|
|
||||||
// Type definitions for Phaser 3.0.0 - 7th September 2016
|
// Type definitions for Phaser 3.0.0
|
||||||
// Project: https://github.com/photonstorm/phaser
|
// Project: https://github.com/photonstorm/phaser
|
||||||
|
|
||||||
declare module "phaser" {
|
declare module "phaser" {
|
||||||
|
@ -18,6 +18,7 @@ declare class Phaser {
|
||||||
static CANVAS: number;
|
static CANVAS: number;
|
||||||
static WEBGL: number;
|
static WEBGL: number;
|
||||||
static HEADLESS: number;
|
static HEADLESS: number;
|
||||||
|
static WEBGL_MULTI: number;
|
||||||
|
|
||||||
static BITMAPDATA: number;
|
static BITMAPDATA: number;
|
||||||
static BITMAPTEXT: number;
|
static BITMAPTEXT: number;
|
||||||
|
@ -1402,6 +1403,7 @@ declare module Phaser {
|
||||||
seed?: string;
|
seed?: string;
|
||||||
state?: Phaser.State;
|
state?: Phaser.State;
|
||||||
forceSetTimeOut: boolean;
|
forceSetTimeOut: boolean;
|
||||||
|
multiTextue: boolean;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
typescript/pixi.d.ts
vendored
2
typescript/pixi.d.ts
vendored
|
@ -1300,6 +1300,7 @@ declare module PIXI {
|
||||||
clearBeforeRender: boolean;
|
clearBeforeRender: boolean;
|
||||||
width: number;
|
width: number;
|
||||||
height: number;
|
height: number;
|
||||||
|
currentBatchedTextures: string[];
|
||||||
view: HTMLCanvasElement;
|
view: HTMLCanvasElement;
|
||||||
projection: Point;
|
projection: Point;
|
||||||
offset: Point;
|
offset: Point;
|
||||||
|
@ -1318,6 +1319,7 @@ declare module PIXI {
|
||||||
updateTexture(texture: Texture): void;
|
updateTexture(texture: Texture): void;
|
||||||
destroy(): void;
|
destroy(): void;
|
||||||
mapBlendModes(): void;
|
mapBlendModes(): void;
|
||||||
|
setTexturePriority(textureNameCollection: string[]): string[];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue