org.jrabbit.standard.game.objects.specialized
Class ImageSprite

java.lang.Object
  extended by org.jrabbit.standard.game.objects.base.Spatial
      extended by org.jrabbit.standard.game.objects.base.BaseSprite
          extended by org.jrabbit.standard.game.objects.specialized.ImageSprite
All Implemented Interfaces:
Renderable, Skin, GLTransform, Colored, Dimensioned, GLGroupTransformed, Located, Rotated, Scaled, ScreenObject, Visible

public class ImageSprite
extends BaseSprite

An ImageSprite is a BaseSprite that exclusively uses ImageSkins to render itself and handles its dimensions.

Author:
Chris Molini

Field Summary
protected  ImageSkin imageSkin
          The currently active ImageSkin.
 
Fields inherited from class org.jrabbit.standard.game.objects.base.BaseSprite
color, screenCoords, transforms, visible
 
Fields inherited from class org.jrabbit.standard.game.objects.base.Spatial
location, rotation, scalar
 
Constructor Summary
ImageSprite(ImageSkin imageSkin)
          Creates an ImageSprite that uses the indicated ImageSkin.
ImageSprite(java.lang.String reference)
          Creates an ImageSprite that uses an ImageSkin set to the indicated reference.
 
Method Summary
 void draw()
          Renders the active ImageSkin.
 float height()
          Accesses the dimensions of the ImageSkin.
 ImageSkin imageSkin()
          Accesses the active ImageSkin.
 void setImageSkin(ImageSkin imageSkin)
          Redefines the active ImageSkin.
 void setImageSkin(java.lang.String reference)
          Redefines the Image the ImageSkin should retrieve from the ImageCache..
 float width()
          Accesses the dimensions of the ImageSkin.
 
Methods inherited from class org.jrabbit.standard.game.objects.base.BaseSprite
bind, color, onscreen, release, render, screenCoords, setVisible, shouldRender, transforms, visible
 
Methods inherited from class org.jrabbit.standard.game.objects.base.Spatial
location, rotation, scalar, scaledDiameter, scaledHeight, scaledWidth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

imageSkin

protected ImageSkin imageSkin
The currently active ImageSkin.

Constructor Detail

ImageSprite

public ImageSprite(java.lang.String reference)
Creates an ImageSprite that uses an ImageSkin set to the indicated reference.

Parameters:
reference - The reference of the Image in the ImageCache to retrieve.

ImageSprite

public ImageSprite(ImageSkin imageSkin)
Creates an ImageSprite that uses the indicated ImageSkin.

Parameters:
imageSkin -
Method Detail

imageSkin

public ImageSkin imageSkin()
Accesses the active ImageSkin.

Returns:
The ImageSkin currently being used.

setImageSkin

public void setImageSkin(ImageSkin imageSkin)
Redefines the active ImageSkin.

Parameters:
imageSkin - The new ImageSkin to use for rendering and dimension checks.

setImageSkin

public void setImageSkin(java.lang.String reference)
Redefines the Image the ImageSkin should retrieve from the ImageCache..

Parameters:
reference - The reference of the Image to use.

width

public float width()
Accesses the dimensions of the ImageSkin.

Returns:
The width of the active ImageSkin.

height

public float height()
Accesses the dimensions of the ImageSkin.

Returns:
The height of the active ImageSkin.

draw

public void draw()
Renders the active ImageSkin.

Specified by:
draw in class BaseSprite