Added clearSprites() for clearing all sprites in one fell swoop.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1542 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-06-25 17:31:17 +00:00
parent 9bffbc0b18
commit a930ae0f0c
2 changed files with 26 additions and 2 deletions
@@ -1,5 +1,5 @@
//
// $Id: MediaPanel.java,v 1.16 2002/06/25 01:00:22 mdb Exp $
// $Id: MediaPanel.java,v 1.17 2002/06/25 17:31:16 mdb Exp $
package com.threerings.media;
@@ -132,6 +132,14 @@ public class MediaPanel extends JComponent
_spritemgr.removeSprite(sprite);
}
/**
* Removes all sprites from this panel.
*/
public void clearSprites ()
{
_spritemgr.clearSprites();
}
/**
* Adds an animation to this panel.
*/
@@ -1,5 +1,5 @@
//
// $Id: SpriteManager.java,v 1.32 2002/06/20 00:54:53 mdb Exp $
// $Id: SpriteManager.java,v 1.33 2002/06/25 17:31:17 mdb Exp $
package com.threerings.media.sprite;
@@ -114,6 +114,22 @@ public class SpriteManager
sprite.shutdown();
}
/**
* Clears all sprites from the sprite manager. This does not
* invalidate their vacated bounds because it is assumed that either
* the whole view will be repainted after this or it is going away
* entirely. The sprites will be {@link Sprite#shutdown}, however.
*/
public void clearSprites ()
{
int size = _sprites.size();
for (int ii = 0; ii < size; ii++) {
Sprite sprite = (Sprite)_sprites.get(ii);
sprite.shutdown();
}
_sprites.clear();
}
/**
* Provides access to the region manager that the sprite manager is
* using to collect invalid regions every frame. This should generally