Separated path code from sprite code so that we can have other things
follow a path (specifically, I want to allow the media panel to be "scrolled" along a path). git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1409 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: ImageSprite.java,v 1.5 2002/05/04 19:35:31 mdb Exp $
|
||||
// $Id: ImageSprite.java,v 1.6 2002/05/31 03:38:03 mdb Exp $
|
||||
|
||||
package com.threerings.media.sprite;
|
||||
|
||||
@@ -145,6 +145,12 @@ public class ImageSprite extends Sprite
|
||||
return;
|
||||
}
|
||||
|
||||
// if these are the same frames we already had, no need to do a
|
||||
// bunch of pointless business
|
||||
if (frames == _frames) {
|
||||
return;
|
||||
}
|
||||
|
||||
// start with our old bounds
|
||||
Rectangle dirty = new Rectangle(_bounds);
|
||||
|
||||
@@ -203,7 +209,7 @@ public class ImageSprite extends Sprite
|
||||
|
||||
// move the sprite along toward its destination, if any
|
||||
if (_path != null) {
|
||||
moved = _path.updatePosition(this, timestamp);
|
||||
moved = _path.tick(this, timestamp);
|
||||
}
|
||||
|
||||
// increment the display image if performing image animation
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
//
|
||||
// $Id: PathCompletedEvent.java,v 1.1 2001/09/13 19:36:20 mdb Exp $
|
||||
// $Id: PathCompletedEvent.java,v 1.2 2002/05/31 03:38:03 mdb Exp $
|
||||
|
||||
package com.threerings.media.sprite;
|
||||
|
||||
import com.threerings.media.util.Path;
|
||||
|
||||
/**
|
||||
* A path completed event is dispatched when a sprite completes a path
|
||||
* along which it has been requested to move.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: Sprite.java,v 1.44 2002/05/29 23:27:14 mdb Exp $
|
||||
// $Id: Sprite.java,v 1.45 2002/05/31 03:38:03 mdb Exp $
|
||||
|
||||
package com.threerings.media.sprite;
|
||||
|
||||
@@ -12,6 +12,8 @@ import java.util.ArrayList;
|
||||
import com.threerings.util.DirectionCodes;
|
||||
|
||||
import com.threerings.media.Log;
|
||||
import com.threerings.media.util.Path;
|
||||
import com.threerings.media.util.Pathable;
|
||||
|
||||
/**
|
||||
* The sprite class represents a single moveable object in an animated
|
||||
@@ -19,7 +21,7 @@ import com.threerings.media.Log;
|
||||
* be moved along a path.
|
||||
*/
|
||||
public abstract class Sprite
|
||||
implements DirectionCodes
|
||||
implements DirectionCodes, Pathable
|
||||
{
|
||||
/**
|
||||
* Constructs a sprite with a default initial location of <code>(0,
|
||||
@@ -332,7 +334,7 @@ public abstract class Sprite
|
||||
{
|
||||
// if we've a path, move the sprite along toward its destination
|
||||
if (_path != null) {
|
||||
_path.updatePosition(this, tickStamp);
|
||||
_path.tick(this, tickStamp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user