Don't require a SpriteManager for gleamed sprites that aren't used as sprites otherwise
git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@470 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -29,7 +29,6 @@ import java.awt.Image;
|
|||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import java.awt.Transparency;
|
import java.awt.Transparency;
|
||||||
|
|
||||||
import com.threerings.media.animation.Animation.AnimCompletedOp;
|
|
||||||
import com.threerings.media.sprite.Sprite;
|
import com.threerings.media.sprite.Sprite;
|
||||||
import com.threerings.media.sprite.SpriteManager;
|
import com.threerings.media.sprite.SpriteManager;
|
||||||
import com.threerings.media.util.LinearTimeFunction;
|
import com.threerings.media.util.LinearTimeFunction;
|
||||||
@@ -44,14 +43,25 @@ public class GleamAnimation extends Animation
|
|||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a gleam animation with the supplied sprite. The sprite will
|
* Creates a gleam animation with the supplied sprite. The sprite will be faded to the
|
||||||
* be faded to the specified color and then back again. The sprite may
|
* specified color and then back again.
|
||||||
* be already added to the supplied sprite manager or not, but when
|
*
|
||||||
* the animation is complete, it will have been added.
|
* @param fadeIn if true, the sprite itself will be faded in as we fade up to the gleam color
|
||||||
*
|
* and the gleam color will fade out, leaving just the sprite imagery.
|
||||||
* @param fadeIn if true, the sprite itself will be faded in as we
|
*/
|
||||||
* fade up to the gleam color and the gleam color will fade out,
|
public GleamAnimation (Sprite sprite, Color color, int upmillis,
|
||||||
* leaving just the sprite imagery.
|
int downmillis, boolean fadeIn)
|
||||||
|
{
|
||||||
|
this(null, sprite, color, upmillis, downmillis, fadeIn, 750, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a gleam animation with the supplied sprite. The sprite will be faded to the
|
||||||
|
* specified color and then back again. The sprite may be already added to the supplied sprite
|
||||||
|
* manager or not, but when the animation is complete, it will have been added.
|
||||||
|
*
|
||||||
|
* @param fadeIn if true, the sprite itself will be faded in as we fade up to the gleam color
|
||||||
|
* and the gleam color will fade out, leaving just the sprite imagery.
|
||||||
*/
|
*/
|
||||||
public GleamAnimation (SpriteManager spmgr, Sprite sprite, Color color, int upmillis,
|
public GleamAnimation (SpriteManager spmgr, Sprite sprite, Color color, int upmillis,
|
||||||
int downmillis, boolean fadeIn)
|
int downmillis, boolean fadeIn)
|
||||||
@@ -60,16 +70,14 @@ public class GleamAnimation extends Animation
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a gleam animation with the supplied sprite. The sprite will
|
* Creates a gleam animation with the supplied sprite. The sprite will be faded to the
|
||||||
* be faded to the specified color and then back again. The sprite may
|
* specified color and then back again. The sprite may be already added to the supplied sprite
|
||||||
* be already added to the supplied sprite manager or not, but when
|
* manager or not, but when the animation is complete, it will have been added.
|
||||||
* the animation is complete, it will have been added.
|
*
|
||||||
*
|
* @param fadeIn if true, the sprite itself will be faded in as we fade up to the gleam color
|
||||||
* @param fadeIn if true, the sprite itself will be faded in as we
|
* and the gleam color will fade out, leaving just the sprite imagery.
|
||||||
* fade up to the gleam color and the gleam color will fade out,
|
|
||||||
* leaving just the sprite imagery.
|
|
||||||
* @param maxAlpha the maximum alpha value to scale the color to.
|
* @param maxAlpha the maximum alpha value to scale the color to.
|
||||||
* @param millisBetweenUpdates millisecons to wait between actually updating the alpha and
|
* @param millisBetweenUpdates milliseconds to wait between actually updating the alpha and
|
||||||
* redrawing
|
* redrawing
|
||||||
*/
|
*/
|
||||||
public GleamAnimation (SpriteManager spmgr, Sprite sprite, Color color, int upmillis,
|
public GleamAnimation (SpriteManager spmgr, Sprite sprite, Color color, int upmillis,
|
||||||
@@ -187,7 +195,7 @@ public class GleamAnimation extends Animation
|
|||||||
|
|
||||||
// remove the sprite we're fiddling with from the manager; we'll
|
// remove the sprite we're fiddling with from the manager; we'll
|
||||||
// add it back when we're done
|
// add it back when we're done
|
||||||
if (_spmgr.isManaged(_sprite)) {
|
if (_spmgr != null && _spmgr.isManaged(_sprite)) {
|
||||||
_spmgr.removeSprite(_sprite);
|
_spmgr.removeSprite(_sprite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -196,7 +204,7 @@ public class GleamAnimation extends Animation
|
|||||||
protected void shutdown ()
|
protected void shutdown ()
|
||||||
{
|
{
|
||||||
super.shutdown();
|
super.shutdown();
|
||||||
if (!_spmgr.isManaged(_sprite)) {
|
if (_spmgr != null && !_spmgr.isManaged(_sprite)) {
|
||||||
_spmgr.addSprite(_sprite);
|
_spmgr.addSprite(_sprite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user