Modified sprites not to take a sprite manager reference upon construction

but to have it set by the sprite manager when it is requested to manage
them.

Modified sprite manager to invalidate the view when sprites are added and
removed.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@295 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2001-08-21 19:40:30 +00:00
parent 043cb46a4d
commit bbd1eb9ced
3 changed files with 56 additions and 20 deletions
@@ -1,5 +1,5 @@
//
// $Id: SpriteManager.java,v 1.8 2001/08/21 00:58:36 mdb Exp $
// $Id: SpriteManager.java,v 1.9 2001/08/21 19:40:30 mdb Exp $
package com.threerings.media.sprite;
@@ -39,7 +39,12 @@ public class SpriteManager
*/
public void addSprite (Sprite sprite)
{
// let the sprite know about us
sprite.setSpriteManager(this);
// add the sprite to our list
_sprites.add(sprite);
// and invalidate the sprite's original position
sprite.invalidate();
}
/**
@@ -50,7 +55,12 @@ public class SpriteManager
*/
public void removeSprite (Sprite sprite)
{
// invalidate the current sprite position
sprite.invalidate();
// remove the sprite from our list
_sprites.remove(sprite);
// clear out our manager reference
sprite.setSpriteManager(null);
}
/**