Include the timestamp associated with sprite events in the event.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2020 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Walter Korman
2002-12-04 02:45:09 +00:00
parent c321f7eb33
commit 6552b5bd8b
10 changed files with 39 additions and 24 deletions
@@ -1,5 +1,5 @@
//
// $Id: CollisionEvent.java,v 1.1 2001/09/13 19:36:20 mdb Exp $
// $Id: CollisionEvent.java,v 1.2 2002/12/04 02:45:09 shaper Exp $
package com.threerings.media.sprite;
@@ -12,9 +12,9 @@ public class CollisionEvent extends SpriteEvent
/**
* Constructs a collision event for the specified sprites.
*/
public CollisionEvent (Sprite sprite, Sprite other)
public CollisionEvent (Sprite sprite, long when, Sprite other)
{
super(sprite);
super(sprite, when);
_other = other;
}
@@ -1,5 +1,5 @@
//
// $Id: PathCompletedEvent.java,v 1.2 2002/05/31 03:38:03 mdb Exp $
// $Id: PathCompletedEvent.java,v 1.3 2002/12/04 02:45:09 shaper Exp $
package com.threerings.media.sprite;
@@ -15,9 +15,9 @@ public class PathCompletedEvent extends SpriteEvent
* Constructs a path completed event for the specified sprite and
* path.
*/
public PathCompletedEvent (Sprite sprite, Path path)
public PathCompletedEvent (Sprite sprite, long when, Path path)
{
super(sprite);
super(sprite, when);
_path = path;
}
@@ -1,5 +1,5 @@
//
// $Id: Sprite.java,v 1.54 2002/12/02 20:11:24 mdb Exp $
// $Id: Sprite.java,v 1.55 2002/12/04 02:45:09 shaper Exp $
package com.threerings.media.sprite;
@@ -252,14 +252,14 @@ public abstract class Sprite extends AbstractMedia
/**
* Called by the active path when it has completed.
*/
public void pathCompleted ()
public void pathCompleted (long timestamp)
{
// keep a reference to the path just completed
Path oldpath = _path;
// clear out the path we've now finished
_path = null;
// inform observers that we've finished our path
notifyObservers(new PathCompletedEvent(this, oldpath));
notifyObservers(new PathCompletedEvent(this, timestamp, oldpath));
}
// documentation inherited
@@ -1,5 +1,5 @@
//
// $Id: SpriteEvent.java,v 1.2 2001/09/13 19:36:20 mdb Exp $
// $Id: SpriteEvent.java,v 1.3 2002/12/04 02:45:09 shaper Exp $
package com.threerings.media.sprite;
@@ -13,10 +13,12 @@ public class SpriteEvent
* Create a sprite event.
*
* @param sprite the involved sprite.
* @param when the time at which this event took place.
*/
public SpriteEvent (Sprite sprite)
public SpriteEvent (Sprite sprite, long when)
{
_sprite = sprite;
_when = when;
}
/**
@@ -27,6 +29,17 @@ public class SpriteEvent
return _sprite;
}
/**
* Returns the time associated with this event.
*/
public long getWhen ()
{
return _when;
}
/** The sprite associated with this event. */
protected Sprite _sprite;
/** The time associated with this event. */
protected long _when;
}