public class SpriteGroup
extends java.lang.Object
Constructor and Description |
---|
SpriteGroup(int itype)
Creates a new SpriteGroup, specifying the type of sprites this will hold.
|
Modifier and Type | Method and Description |
---|---|
void |
addAllSprites(java.util.Collection<VGDLSprite> spritesToAdd)
Adds a collection of sprites to this collection.
|
void |
addSprite(int spriteId,
VGDLSprite sprite)
Adds an sprite to the collection.
|
void |
clear()
Clears the collection of sprites.
|
VGDLSprite |
getFirstSprite()
Gets the first sprite of this collection, or null if it is empty
|
int |
getItype()
Gets the type of this SpriteGroup.
|
java.lang.Integer[] |
getKeys()
Gets the set of KEYs in an array.
|
VGDLSprite |
getSprite(int spriteId)
Retrieves a sprite given its unique ID.
|
java.util.Iterator<VGDLSprite> |
getSpriteIterator()
Gets an ordered iterator through all sprites.
|
java.util.TreeMap<java.lang.Integer,VGDLSprite> |
getSprites()
Gets the collection of sprites, as a TreeMap [KEY => VALUE].
|
int |
numSprites()
Gets the number of sprites in the collection.
|
void |
removeSprite(int spriteId)
Removes an sprite indicated with its ID.
|
public SpriteGroup(int itype)
itype
- type of sprite for the SpriteGroup.public void addSprite(int spriteId, VGDLSprite sprite)
spriteId
- Unique ID of the sprite to addsprite
- Sprite to add.public void addAllSprites(java.util.Collection<VGDLSprite> spritesToAdd)
spritesToAdd
- Sprites to add.public java.util.TreeMap<java.lang.Integer,VGDLSprite> getSprites()
public java.lang.Integer[] getKeys()
public java.util.Iterator<VGDLSprite> getSpriteIterator()
public void removeSprite(int spriteId)
spriteId
- the id of the sprite to remove.public int getItype()
public VGDLSprite getSprite(int spriteId)
spriteId
- ID of the sprite to retrieve.public void clear()
public int numSprites()
public VGDLSprite getFirstSprite()