Added convenience constructor for simple single frame image sprite.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1693 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-09-17 19:14:59 +00:00
parent 380fa50610
commit c08067ac1f
@@ -1,5 +1,5 @@
//
// $Id: ImageSprite.java,v 1.12 2002/09/17 19:11:13 mdb Exp $
// $Id: ImageSprite.java,v 1.13 2002/09/17 19:14:59 mdb Exp $
package com.threerings.media.sprite;
@@ -17,6 +17,7 @@ import java.util.Iterator;
import com.threerings.media.Log;
import com.threerings.media.util.MultiFrameImage;
import com.threerings.media.util.SingleFrameImageImpl;
/**
* Extends the sprite class to support rendering the sprite with one or
@@ -53,14 +54,12 @@ public class ImageSprite extends Sprite
*/
public ImageSprite ()
{
this(null);
this((MultiFrameImage)null);
}
/**
* Constructs an image sprite.
*
* @param x the sprite x-position in pixels.
* @param y the sprite y-position in pixels.
* @param frames the multi-frame image used to display the sprite.
*/
public ImageSprite (MultiFrameImage frames)
@@ -72,6 +71,15 @@ public class ImageSprite extends Sprite
_frameDelay = 1000L/DEFAULT_FRAME_RATE;
}
/**
* Constructs an image sprite that will display the supplied single
* image when rendering itself.
*/
public ImageSprite (Image image)
{
this(new SingleFrameImageImpl(image));
}
// documentation inherited
protected void init (SpriteManager spritemgr)
{