mirror of
https://github.com/wassname/phaser.git
synced 2026-10-04 12:50:39 +08:00
Group now extends PIXI.DisplayObjectContainer, rather than owning a _container property, which makes life a whole lot easier re: nesting.
This commit is contained in:
1 parent
9737710200
commit
4cfce8b4d2
89 files changed
+1176
-1521
No files matched your search
@@ -62,6 +62,8 @@ Version 1.2 - "Shienar" - -in development-
|
||||
Significant API changes:
|
||||
|
||||
* Upgraded to Pixi.js 1.4.4
|
||||
* Group now extends PIXI.DisplayObjectContainer, rather than owning a _container property, which makes life a whole lot easier re: nesting.
|
||||
|
||||
|
||||
New features:
|
||||
|
||||
|
||||
+58
-31
@@ -13,47 +13,76 @@
|
||||
<script src="$path/src/Phaser.js"></script>
|
||||
<script src="$path/src/utils/Utils.js"></script>
|
||||
|
||||
<script src="$path/src/pixi/core/Matrix.js"></script>
|
||||
<script src="$path/src/pixi/Pixi.js"></script>
|
||||
<script src="$path/src/pixi/core/Point.js"></script>
|
||||
<script src="$path/src/pixi/core/Rectangle.js"></script>
|
||||
<script src="$path/src/pixi/core/Polygon.js"></script>
|
||||
|
||||
<script src="$path/src/pixi/core/Circle.js"></script>
|
||||
<script src="$path/src/pixi/core/Ellipse.js"></script>
|
||||
<script src="$path/src/pixi/core/Matrix.js"></script>
|
||||
<script src="$path/src/pixi/display/DisplayObject.js"></script>
|
||||
<script src="$path/src/pixi/display/DisplayObjectContainer.js"></script>
|
||||
<script src="$path/src/pixi/display/Sprite.js"></script>
|
||||
<script src="$path/src/pixi/display/SpriteBatch.js"></script>
|
||||
<script src="$path/src/pixi/display/MovieClip.js"></script>
|
||||
<script src="$path/src/pixi/filters/FilterBlock.js"></script>
|
||||
<script src="$path/src/pixi/text/Text.js"></script>
|
||||
<script src="$path/src/pixi/text/BitmapText.js"></script>
|
||||
<script src="$path/src/pixi/InteractionData.js"></script>
|
||||
<script src="$path/src/pixi/InteractionManager.js"></script>
|
||||
<script src="$path/src/pixi/display/Stage.js"></script>
|
||||
|
||||
<script src="$path/src/pixi/extras/CustomRenderable.js"></script>
|
||||
<script src="$path/src/pixi/utils/Utils.js"></script>
|
||||
<script src="$path/src/pixi/utils/EventTarget.js"></script>
|
||||
<script src="$path/src/pixi/utils/Detector.js"></script>
|
||||
<script src="$path/src/pixi/utils/Polyk.js"></script>
|
||||
<script src="$path/src/pixi/renderers/webgl/utils/WebGLShaderUtils.js"></script>
|
||||
<script src="$path/src/pixi/renderers/webgl/shaders/PixiShader.js"></script>
|
||||
<script src="$path/src/pixi/renderers/webgl/shaders/PixiFastShader.js"></script>
|
||||
<script src="$path/src/pixi/renderers/webgl/shaders/StripShader.js"></script>
|
||||
<script src="$path/src/pixi/renderers/webgl/shaders/PrimitiveShader.js"></script>
|
||||
<script src="$path/src/pixi/renderers/webgl/utils/WebGLGraphics.js"></script>
|
||||
<script src="$path/src/pixi/renderers/webgl/WebGLRenderer.js"></script>
|
||||
<script src="$path/src/pixi/renderers/webgl/utils/WebGLMaskManager.js"></script>
|
||||
<script src="$path/src/pixi/renderers/webgl/utils/WebGLShaderManager.js"></script>
|
||||
<script src="$path/src/pixi/renderers/webgl/utils/WebGLSpriteBatch.js"></script>
|
||||
<script src="$path/src/pixi/renderers/webgl/utils/WebGLFastSpriteBatch.js"></script>
|
||||
<script src="$path/src/pixi/renderers/webgl/utils/WebGLFilterManager.js"></script>
|
||||
<script src="$path/src/pixi/renderers/webgl/utils/FilterTexture.js"></script>
|
||||
<script src="$path/src/pixi/renderers/canvas/utils/CanvasMaskManager.js"></script>
|
||||
<script src="$path/src/pixi/renderers/canvas/utils/CanvasTinter.js"></script>
|
||||
<script src="$path/src/pixi/renderers/canvas/CanvasRenderer.js"></script>
|
||||
<script src="$path/src/pixi/renderers/canvas/CanvasGraphics.js"></script>
|
||||
<script src="$path/src/pixi/primitives/Graphics.js"></script>
|
||||
<script src="$path/src/pixi/extras/Strip.js"></script>
|
||||
<script src="$path/src/pixi/extras/Rope.js"></script>
|
||||
<script src="$path/src/pixi/extras/TilingSprite.js"></script>
|
||||
|
||||
<script src="$path/src/pixi/filters/AbstractFilter.js"></script>
|
||||
<script src="$path/src/pixi/filters/FilterBlock.js"></script>
|
||||
|
||||
<script src="$path/src/pixi/primitives/Graphics.js"></script>
|
||||
|
||||
<script src="$path/src/pixi/renderers/canvas/CanvasGraphics.js"></script>
|
||||
<script src="$path/src/pixi/renderers/canvas/CanvasRenderer.js"></script>
|
||||
|
||||
<script src="$path/src/pixi/renderers/webgl/PixiShader.js"></script>
|
||||
<script src="$path/src/pixi/renderers/webgl/PrimitiveShader.js"></script>
|
||||
<script src="$path/src/pixi/renderers/webgl/StripShader.js"></script>
|
||||
<script src="$path/src/pixi/renderers/webgl/WebGLBatch.js"></script>
|
||||
<script src="$path/src/pixi/renderers/webgl/WebGLFilterManager.js"></script>
|
||||
<script src="$path/src/pixi/renderers/webgl/WebGLGraphics.js"></script>
|
||||
<script src="$path/src/pixi/renderers/webgl/WebGLRenderer.js"></script>
|
||||
<script src="$path/src/pixi/renderers/webgl/WebGLRenderGroup.js"></script>
|
||||
<script src="$path/src/pixi/renderers/webgl/WebGLShaders.js"></script>
|
||||
|
||||
<script src="$path/src/pixi/text/BitmapText.js"></script>
|
||||
<script src="$path/src/pixi/text/Text.js"></script>
|
||||
|
||||
<script src="$path/src/pixi/extras/Spine.js"></script>
|
||||
<script src="$path/src/pixi/textures/BaseTexture.js"></script>
|
||||
<script src="$path/src/pixi/textures/Texture.js"></script>
|
||||
|
||||
<script src="$path/src/pixi/utils/EventTarget.js"></script>
|
||||
<script src="$path/src/pixi/utils/Polyk.js"></script>
|
||||
<script src="$path/src/pixi/textures/RenderTexture.js"></script>
|
||||
<script src="$path/src/pixi/loaders/AssetLoader.js"></script>
|
||||
<script src="$path/src/pixi/loaders/JsonLoader.js"></script>
|
||||
<script src="$path/src/pixi/loaders/AtlasLoader.js"></script>
|
||||
<script src="$path/src/pixi/loaders/SpriteSheetLoader.js"></script>
|
||||
<script src="$path/src/pixi/loaders/ImageLoader.js"></script>
|
||||
<script src="$path/src/pixi/loaders/BitmapFontLoader.js"></script>
|
||||
<script src="$path/src/pixi/loaders/SpineLoader.js"></script>
|
||||
<script src="$path/src/pixi/filters/AbstractFilter.js"></script>
|
||||
<script src="$path/src/pixi/filters/AlphaMaskFilter.js"></script>
|
||||
<script src="$path/src/pixi/filters/ColorMatrixFilter.js"></script>
|
||||
<script src="$path/src/pixi/filters/GrayFilter.js"></script>
|
||||
<script src="$path/src/pixi/filters/DisplacementFilter.js"></script>
|
||||
<script src="$path/src/pixi/filters/PixelateFilter.js"></script>
|
||||
<script src="$path/src/pixi/filters/BlurXFilter.js"></script>
|
||||
<script src="$path/src/pixi/filters/BlurYFilter.js"></script>
|
||||
<script src="$path/src/pixi/filters/BlurFilter.js"></script>
|
||||
<script src="$path/src/pixi/filters/InvertFilter.js"></script>
|
||||
<script src="$path/src/pixi/filters/SepiaFilter.js"></script>
|
||||
<script src="$path/src/pixi/filters/TwistFilter.js"></script>
|
||||
<script src="$path/src/pixi/filters/ColorStepFilter.js"></script>
|
||||
<script src="$path/src/pixi/filters/DotScreenFilter.js"></script>
|
||||
<script src="$path/src/pixi/filters/CrossHatchFilter.js"></script>
|
||||
<script src="$path/src/pixi/filters/RGBSplitFilter.js"></script>
|
||||
|
||||
<script src="$path/src/core/Camera.js"></script>
|
||||
<script src="$path/src/core/State.js"></script>
|
||||
@@ -145,7 +174,5 @@
|
||||
<script src="$path/src/tilemap/TilemapLayer.js"></script>
|
||||
<script src="$path/src/tilemap/TilemapParser.js"></script>
|
||||
<script src="$path/src/tilemap/Tileset.js"></script>
|
||||
|
||||
<script src="$path/src/PixiPatch.js"></script>
|
||||
EOL;
|
||||
?>
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
function dirToArray($dir) {
|
||||
|
||||
$ignore = array('.', '..', '_site', 'assets', 'states', 'book', 'filters');
|
||||
$ignore = array('.', '..', '_site', 'assets', 'states', 'book', 'filters', 'misc');
|
||||
$result = array();
|
||||
$root = scandir($dir);
|
||||
$dirs = array_diff($root, $ignore);
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,45 @@
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('pic', 'assets/pics/backscroll.png');
|
||||
|
||||
}
|
||||
|
||||
var sprite;
|
||||
var sprite2;
|
||||
var g;
|
||||
|
||||
function create() {
|
||||
|
||||
sprite = game.add.sprite(0, 0, 'pic');
|
||||
|
||||
g = game.add.group();
|
||||
|
||||
g.create(0, 0, 'pic');
|
||||
|
||||
g.y = 200;
|
||||
g.rotation = 0.1;
|
||||
|
||||
// sprite2 = game.add.sprite(0, 300, 'pic');
|
||||
|
||||
game.input.onDown.add(tint, this);
|
||||
|
||||
}
|
||||
|
||||
function tint() {
|
||||
|
||||
sprite.tint = Math.random() * 0xFFFFFF;
|
||||
// sprite2.tint = Math.random() * 0xFFFFFF;
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
}
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
var Phaser = Phaser || {
|
||||
|
||||
VERSION: '<%= version %>',
|
||||
DEV_VERSION: '1.1.5',
|
||||
DEV_VERSION: '1.2',
|
||||
GAMES: [],
|
||||
|
||||
AUTO: 0,
|
||||
|
||||
+1042
-1387
File diff suppressed because it is too large.
Load diff
+16
-71
@@ -54,38 +54,28 @@ Phaser.World.prototype.boot = function () {
|
||||
|
||||
this.camera = new Phaser.Camera(this.game, 0, 0, 0, this.game.width, this.game.height);
|
||||
|
||||
this.camera.displayObject = this._container;
|
||||
this.camera.displayObject = this;
|
||||
|
||||
this.game.camera = this.camera;
|
||||
|
||||
this.game.stage._stage.addChild(this);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This is called automatically after the plugins preUpdate and before the State.update.
|
||||
* Most objects have preUpdate methods and it's where initial movement, drawing and calculations are done.
|
||||
*
|
||||
* @method Phaser.World#update
|
||||
* @method Phaser.World#preUpdate
|
||||
*/
|
||||
Phaser.World.prototype.preUpdate = function () {
|
||||
|
||||
if (this.game.stage._stage.first._iNext)
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
var currentNode = this.game.stage._stage.first._iNext;
|
||||
|
||||
do
|
||||
if (this.children[i]['preUpdate'])
|
||||
{
|
||||
// If preUpdate exists, and it returns false, skip PIXI child objects
|
||||
if (currentNode['preUpdate'] && !currentNode.preUpdate())
|
||||
{
|
||||
currentNode = currentNode.last._iNext;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentNode = currentNode._iNext;
|
||||
}
|
||||
|
||||
this.children[i].preUpdate();
|
||||
}
|
||||
while (currentNode != this.game.stage._stage.last._iNext)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -98,26 +88,12 @@ Phaser.World.prototype.preUpdate = function () {
|
||||
*/
|
||||
Phaser.World.prototype.update = function () {
|
||||
|
||||
this.currentRenderOrderID = 0;
|
||||
|
||||
if (this.game.stage._stage.first._iNext)
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
var currentNode = this.game.stage._stage.first._iNext;
|
||||
|
||||
do
|
||||
if (this.children[i]['update'])
|
||||
{
|
||||
// If update exists, and it returns false, skip PIXI child objects
|
||||
if (currentNode['update'] && !currentNode.update())
|
||||
{
|
||||
currentNode = currentNode.last._iNext;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentNode = currentNode._iNext;
|
||||
}
|
||||
|
||||
this.children[i].update();
|
||||
}
|
||||
while (currentNode != this.game.stage._stage.last._iNext)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -138,40 +114,24 @@ Phaser.World.prototype.postUpdate = function () {
|
||||
|
||||
this.camera.update();
|
||||
|
||||
if (this.game.stage._stage.first._iNext)
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
var currentNode = this.game.stage._stage.first._iNext;
|
||||
|
||||
do
|
||||
if (this.children[i]['postUpdate'])
|
||||
{
|
||||
if (currentNode['postUpdate'] && currentNode !== this.camera.target)
|
||||
{
|
||||
currentNode.postUpdate();
|
||||
}
|
||||
|
||||
currentNode = currentNode._iNext;
|
||||
this.children[i].postUpdate();
|
||||
}
|
||||
while (currentNode != this.game.stage._stage.last._iNext)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.camera.update();
|
||||
|
||||
if (this.game.stage._stage.first._iNext)
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
var currentNode = this.game.stage._stage.first._iNext;
|
||||
|
||||
do
|
||||
if (this.children[i]['postUpdate'])
|
||||
{
|
||||
if (currentNode['postUpdate'])
|
||||
{
|
||||
currentNode.postUpdate();
|
||||
}
|
||||
|
||||
currentNode = currentNode._iNext;
|
||||
this.children[i].postUpdate();
|
||||
}
|
||||
while (currentNode != this.game.stage._stage.last._iNext)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -327,18 +287,3 @@ Object.defineProperty(Phaser.World.prototype, "randomY", {
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* @name Phaser.World#visible
|
||||
* @property {boolean} visible - Gets or sets the visible state of the World.
|
||||
*/
|
||||
Object.defineProperty(Phaser.World.prototype, "visible", {
|
||||
|
||||
get: function () {
|
||||
return this._container.visible;
|
||||
},
|
||||
|
||||
set: function (value) {
|
||||
this._container.visible = value;
|
||||
}
|
||||
|
||||
});
|
||||
@@ -85,11 +85,6 @@ Phaser.RenderTexture.prototype.render = function(displayObject, position, clear,
|
||||
if (typeof clear === 'undefined') { clear = false; }
|
||||
if (typeof renderHidden === 'undefined') { renderHidden = false; }
|
||||
|
||||
if (displayObject instanceof Phaser.Group)
|
||||
{
|
||||
displayObject = displayObject._container;
|
||||
}
|
||||
|
||||
if (PIXI.gl)
|
||||
{
|
||||
this.renderWebGL(displayObject, position, clear, renderHidden);
|
||||
|
||||
@@ -519,7 +519,6 @@ Phaser.Particles.Arcade.Emitter.prototype.at = function (object) {
|
||||
* The emitters alpha value.
|
||||
* @name Phaser.Particles.Arcade.Emitter#alpha
|
||||
* @property {number} alpha - Gets or sets the alpha value of the Emitter.
|
||||
*/
|
||||
Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype, "alpha", {
|
||||
|
||||
get: function () {
|
||||
@@ -531,12 +530,12 @@ Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype, "alpha", {
|
||||
}
|
||||
|
||||
});
|
||||
*/
|
||||
|
||||
/**
|
||||
* The emitter visible state.
|
||||
* @name Phaser.Particles.Arcade.Emitter#visible
|
||||
* @property {boolean} visible - Gets or sets the Emitter visible state.
|
||||
*/
|
||||
Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype, "visible", {
|
||||
|
||||
get: function () {
|
||||
@@ -548,6 +547,7 @@ Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype, "visible", {
|
||||
}
|
||||
|
||||
});
|
||||
*/
|
||||
|
||||
/**
|
||||
* @name Phaser.Particles.Arcade.Emitter#x
|
||||
|
||||
@@ -636,15 +636,15 @@ Phaser.Physics.Arcade.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
var len = group._container.children.length;
|
||||
var len = group.children.length;
|
||||
|
||||
for (var i = 0; i < len; i++)
|
||||
{
|
||||
for (var j = i + 1; j <= len; j++)
|
||||
{
|
||||
if (group._container.children[i] && group._container.children[j] && group._container.children[i].exists && group._container.children[j].exists)
|
||||
if (group.children[i] && group.children[j] && group.children[i].exists && group.children[j].exists)
|
||||
{
|
||||
this.collideSpriteVsSprite(group._container.children[i], group._container.children[j], collideCallback, processCallback, callbackContext, overlapOnly);
|
||||
this.collideSpriteVsSprite(group.children[i], group.children[j], collideCallback, processCallback, callbackContext, overlapOnly);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -664,19 +664,12 @@ Phaser.Physics.Arcade.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
if (group1._container.first._iNext)
|
||||
for (var i = 0, len = group1.children.length; i < len; i++)
|
||||
{
|
||||
var currentNode = group1._container.first._iNext;
|
||||
|
||||
do
|
||||
if (group1.children[i].exists)
|
||||
{
|
||||
if (currentNode.exists)
|
||||
{
|
||||
this.collideSpriteVsGroup(currentNode, group2, collideCallback, processCallback, callbackContext, overlapOnly);
|
||||
}
|
||||
currentNode = currentNode._iNext;
|
||||
this.collideSpriteVsGroup(group1.children[i], group2, collideCallback, processCallback, callbackContext, overlapOnly);
|
||||
}
|
||||
while (currentNode != group1._container.last._iNext);
|
||||
}
|
||||
|
||||
},
|
||||
@@ -746,19 +739,12 @@ Phaser.Physics.Arcade.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
if (group._container.first._iNext)
|
||||
for (var i = 0, len = group.children.length; i < len; i++)
|
||||
{
|
||||
var currentNode = group._container.first._iNext;
|
||||
|
||||
do
|
||||
if (group.children[i].exists)
|
||||
{
|
||||
if (currentNode.exists)
|
||||
{
|
||||
this.collideSpriteVsTilemapLayer(currentNode, tilemapLayer, collideCallback, processCallback, callbackContext);
|
||||
}
|
||||
currentNode = currentNode._iNext;
|
||||
this.collideSpriteVsTilemapLayer(group.children[i], tilemapLayer, collideCallback, processCallback, callbackContext);
|
||||
}
|
||||
while (currentNode != group._container.last._iNext);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user