Added support for pausing a media panel which pauses all sprites and
animations currently operating therein. (It doesn't pause scrolling which I suppose I'll have to fix at some point if we ever need it.) git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1292 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: Animation.java,v 1.5 2002/04/23 01:16:28 mdb Exp $
|
||||
// $Id: Animation.java,v 1.6 2002/04/25 16:23:30 mdb Exp $
|
||||
|
||||
package com.threerings.media.animation;
|
||||
|
||||
@@ -75,6 +75,16 @@ public abstract class Animation
|
||||
*/
|
||||
public abstract void paint (Graphics2D gfx);
|
||||
|
||||
/**
|
||||
* This is called if the animation manager is paused for some length
|
||||
* of time and then unpaused. Animations should adjust any time stamps
|
||||
* they are maintaining internally by the delta so that time maintains
|
||||
* the illusion of flowing smoothly forward.
|
||||
*/
|
||||
public void fastForward (long timeDelta)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the animation has finished all of its business,
|
||||
* false if not.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: AnimationManager.java,v 1.9 2002/04/23 01:16:28 mdb Exp $
|
||||
// $Id: AnimationManager.java,v 1.10 2002/04/25 16:23:30 mdb Exp $
|
||||
|
||||
package com.threerings.media.animation;
|
||||
|
||||
@@ -102,6 +102,22 @@ public class AnimationManager
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If the animation manager is paused for some length of time, it
|
||||
* should be fast forwarded by the appropriate number of milliseconds.
|
||||
* This allows animations to smoothly pick up where they left off
|
||||
* rather than abruptly jumping into the future, thinking that some
|
||||
* outrageous amount of time passed since their last tick.
|
||||
*/
|
||||
public void fastForward (long timeDelta)
|
||||
{
|
||||
// fast forward all of our animations
|
||||
int size = _anims.size();
|
||||
for (int ii = 0; ii < size; ii++) {
|
||||
((Animation)_anims.get(ii)).fastForward(timeDelta);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders all registered animations in the given layer that intersect
|
||||
* the supplied clipping rectangle to the given graphics context.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: BobbleAnimation.java,v 1.3 2002/04/15 18:18:20 mdb Exp $
|
||||
// $Id: BobbleAnimation.java,v 1.4 2002/04/25 16:23:30 mdb Exp $
|
||||
|
||||
package com.threerings.media.animation;
|
||||
|
||||
@@ -58,6 +58,12 @@ public class BobbleAnimation extends Animation
|
||||
_y = (_sy + dy) * ((RandomUtil.getInt(2) == 0) ? -1 : 1);
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public void fastForward (long timeDelta)
|
||||
{
|
||||
_end += timeDelta;
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public void paint (Graphics2D gfx)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: ExplodeAnimation.java,v 1.7 2002/04/15 18:18:20 mdb Exp $
|
||||
// $Id: ExplodeAnimation.java,v 1.8 2002/04/25 16:23:30 mdb Exp $
|
||||
|
||||
package com.threerings.media.animation;
|
||||
|
||||
@@ -134,6 +134,12 @@ public class ExplodeAnimation extends Animation
|
||||
_start = timestamp;
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public void fastForward (long timeDelta)
|
||||
{
|
||||
_start += timeDelta;
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public void tick (long timestamp)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: FadeAnimation.java,v 1.3 2002/01/31 17:35:41 shaper Exp $
|
||||
// $Id: FadeAnimation.java,v 1.4 2002/04/25 16:23:30 mdb Exp $
|
||||
|
||||
package com.threerings.media.animation;
|
||||
|
||||
@@ -76,6 +76,12 @@ public class FadeAnimation extends Animation
|
||||
invalidate();
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public void fastForward (long timeDelta)
|
||||
{
|
||||
_start += timeDelta;
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public void paint (Graphics2D gfx)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: RainAnimation.java,v 1.3 2002/04/23 01:16:28 mdb Exp $
|
||||
// $Id: RainAnimation.java,v 1.4 2002/04/25 16:23:30 mdb Exp $
|
||||
|
||||
package com.threerings.media.animation;
|
||||
|
||||
@@ -73,6 +73,12 @@ public class RainAnimation extends Animation
|
||||
invalidate();
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public void fastForward (long timeDelta)
|
||||
{
|
||||
_end += timeDelta;
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public void paint (Graphics2D gfx)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user