org.jtgl.gaming
Class SpriteGroup

java.lang.Object
  extended by org.jtgl.gaming.SpriteGroup

public final class SpriteGroup
extends java.lang.Object

Represents a group of independent Sprites that can be managed as one. This class is an optimized vector of Sprites that manages group drawing,animation,action,visibility,etc. The api used is similar to java.util.Vector *

Author:
Manuel Polo (manuel_polo at yahoo dot es)

Constructor Summary
SpriteGroup()
          Creates a new instance of IntVector
SpriteGroup(int initialSize)
          Creates a new instance of IntVector
 
Method Summary
 void action(long currentTime)
           
 void add(Sprite sprite)
           
 void animate(long currentTime)
           
 void clear()
           
 void draw(JTGLGraphics gc)
           
 void drawFB(JTGLGraphics gc)
          Draw from Front to Background
 int getCapacity()
           
 int getSize()
           
 Sprite getSprite(int index)
           
 int indexOf(Sprite sprite)
           
 int indexOf(Sprite sprite, int index)
           
 void insertSpriteAt(Sprite sprite, int index)
           
 boolean isEmpty()
           
 void move()
           
 void move(int dx, int dy)
           
 void moveRefTo(int x, int y, boolean doValidate)
           
 boolean remove(Sprite sprite)
           
 void removeSpriteAt(int index)
           
 void setMove(int moveX, int moveY)
           
 void setSize(int newSize)
           
 void setSprite(int index, Sprite sprite)
           
 void setVisible(boolean visible)
           
 java.lang.String toString()
           
 void trimToSize()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SpriteGroup

public SpriteGroup()
Creates a new instance of IntVector


SpriteGroup

public SpriteGroup(int initialSize)
Creates a new instance of IntVector

Method Detail

action

public void action(long currentTime)

animate

public void animate(long currentTime)

setVisible

public void setVisible(boolean visible)

setMove

public void setMove(int moveX,
                    int moveY)

move

public void move()

move

public void move(int dx,
                 int dy)

moveRefTo

public void moveRefTo(int x,
                      int y,
                      boolean doValidate)

draw

public void draw(JTGLGraphics gc)

drawFB

public void drawFB(JTGLGraphics gc)
Draw from Front to Background


getCapacity

public int getCapacity()

getSize

public int getSize()

getSprite

public Sprite getSprite(int index)

setSprite

public void setSprite(int index,
                      Sprite sprite)

add

public void add(Sprite sprite)

insertSpriteAt

public void insertSpriteAt(Sprite sprite,
                           int index)

removeSpriteAt

public void removeSpriteAt(int index)

remove

public boolean remove(Sprite sprite)

clear

public void clear()

trimToSize

public void trimToSize()

setSize

public void setSize(int newSize)

isEmpty

public boolean isEmpty()

indexOf

public int indexOf(Sprite sprite,
                   int index)

indexOf

public int indexOf(Sprite sprite)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object