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:
Michael Bayne
2002-04-25 16:23:31 +00:00
parent 1ba123de96
commit 23d170c83e
11 changed files with 143 additions and 11 deletions
@@ -1,5 +1,5 @@
//
// $Id: Sprite.java,v 1.42 2002/04/23 01:16:28 mdb Exp $
// $Id: Sprite.java,v 1.43 2002/04/25 16:23:30 mdb Exp $
package com.threerings.media.sprite;
@@ -336,6 +336,20 @@ public abstract class Sprite
}
}
/**
* This is called if the sprite manager is paused for some length of
* time and then unpaused. Sprites 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)
{
// fast forward any path we're following
if (_path != null) {
_path.fastForward(timeDelta);
}
}
/**
* Updates the sprite's render offset which is used to determine
* where to place the top-left corner of the render bounds.
@@ -1,5 +1,5 @@
//
// $Id: SpriteManager.java,v 1.29 2002/04/23 01:16:28 mdb Exp $
// $Id: SpriteManager.java,v 1.30 2002/04/25 16:23:31 mdb Exp $
package com.threerings.media.sprite;
@@ -209,6 +209,22 @@ public class SpriteManager
handleSpriteEvents();
}
/**
* If the sprite manager is paused for some length of time, it should
* be fast forwarded by the appropriate number of milliseconds. This
* allows sprites 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)
{
int size = _sprites.size();
for (int ii = 0; ii < size; ii++) {
Sprite sprite = (Sprite)_sprites.get(ii);
sprite.fastForward(timeDelta);
}
}
/**
* Call {@link Sprite#tick} on all sprite objects to give them a
* chance to move themselves about, change their display image,