Skip to content

Commit

Permalink
Merge pull request #6 from Coffelius/master
Browse files Browse the repository at this point in the history
PIXI 3.0
  • Loading branch information
Andrew Start committed Apr 19, 2015
2 parents e204612 + 04d50a7 commit 0f41c51
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 17 deletions.
26 changes: 18 additions & 8 deletions dist/pixi-particles.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,13 @@
*/
ParticleUtils.getBlendMode = function(name)
{
if(!name) return PIXI.blendModes.NORMAL;
name = name.toUpperCase();
while(name.indexOf(" ") >= 0)
name = name.replace(" ", "_");
return PIXI.blendModes[name] || PIXI.blendModes.NORMAL;
if (!name) return PIXI.blendModes ? PIXI.blendModes.NORMAL : PIXI.BLEND_MODES.NORMAL;
name = name.toUpperCase();
while (name.indexOf(" ") >= 0)
name = name.replace(" ", "_");
return PIXI.blendModes ?
(PIXI.blendModes[name] || PIXI.blendModes.NORMAL) :
(PIXI.BLEND_MODES[name] || PIXI.BLEND_MODES.NORMAL);
};

cloudkid.ParticleUtils = ParticleUtils;
Expand Down Expand Up @@ -235,7 +237,10 @@
var art = emitter.particleImages[0] instanceof PIXI.Texture ?
[emitter.particleImages[0]] :
emitter.particleImages[0];
PIXI.MovieClip.call(this, art);


if(PIXI.MovieClip) PIXI.MovieClip.call(this, art);
else PIXI.extras.MovieClip.call(this, art);

/**
* The emitter that controls this particle.
Expand Down Expand Up @@ -405,7 +410,7 @@
};

// Reference to the prototype
var p = Particle.prototype = Object.create(PIXI.MovieClip.prototype);
var p = Particle.prototype = Object.create(PIXI.extras.MovieClip.prototype);

/**
* Initializes the particle for use, based on the properties that have to
Expand Down Expand Up @@ -467,7 +472,12 @@
*/
p.applyArt = function(art)
{
this.setTexture(art);
if (PIXI.MovieClip) {
this.setTexture(art);
} else {
//remove warning on PIXI 3
this.texture = art;
}
};

/**
Expand Down
2 changes: 1 addition & 1 deletion dist/pixi-particles.min.js

Large diffs are not rendered by default.

14 changes: 11 additions & 3 deletions src/Particle.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
var art = emitter.particleImages[0] instanceof PIXI.Texture ?
[emitter.particleImages[0]] :
emitter.particleImages[0];
PIXI.MovieClip.call(this, art);


if(PIXI.MovieClip) PIXI.MovieClip.call(this, art);
else PIXI.extras.MovieClip.call(this, art);

/**
* The emitter that controls this particle.
Expand Down Expand Up @@ -188,7 +191,7 @@
};

// Reference to the prototype
var p = Particle.prototype = Object.create(PIXI.MovieClip.prototype);
var p = Particle.prototype = Object.create(PIXI.extras.MovieClip.prototype);

/**
* Initializes the particle for use, based on the properties that have to
Expand Down Expand Up @@ -250,7 +253,12 @@
*/
p.applyArt = function(art)
{
this.setTexture(art);
if (PIXI.MovieClip) {
this.setTexture(art);
} else {
//remove warning on PIXI 3
this.texture = art;
}
};

/**
Expand Down
12 changes: 7 additions & 5 deletions src/ParticleUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,13 @@
*/
ParticleUtils.getBlendMode = function(name)
{
if(!name) return PIXI.blendModes.NORMAL;
name = name.toUpperCase();
while(name.indexOf(" ") >= 0)
name = name.replace(" ", "_");
return PIXI.blendModes[name] || PIXI.blendModes.NORMAL;
if (!name) return PIXI.blendModes ? PIXI.blendModes.NORMAL : PIXI.BLEND_MODES.NORMAL;
name = name.toUpperCase();
while (name.indexOf(" ") >= 0)
name = name.replace(" ", "_");
return PIXI.blendModes ?
(PIXI.blendModes[name] || PIXI.blendModes.NORMAL) :
(PIXI.BLEND_MODES[name] || PIXI.BLEND_MODES.NORMAL);
};

cloudkid.ParticleUtils = ParticleUtils;
Expand Down

0 comments on commit 0f41c51

Please sign in to comment.