data
Class Sprite

java.lang.Object
  extended by data.Sprite
All Implemented Interfaces:
Drawable
Direct Known Subclasses:
Node

public class Sprite
extends java.lang.Object
implements Drawable


Constructor Summary
Sprite(Vector2 pos, Vector2 size, java.lang.String filePath)
           
 
Method Summary
 boolean draw(javax.media.opengl.GL gl)
          draws an object in OpenGL context
 Vector2 getPosition()
          returns the position of the Sprite (middle)
 boolean init(javax.media.opengl.GL gl)
          initializes the Drawable in OpenGL context
static void loadTexture(java.lang.String textureFilePath)
          loads a texture using.
 void setImageFile(java.lang.String filePath)
          sets the image file an inits the sprite new
 void setPosition(float x, float y)
          sets the position of the Sprite (middle)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sprite

public Sprite(Vector2 pos,
              Vector2 size,
              java.lang.String filePath)
Method Detail

draw

public boolean draw(javax.media.opengl.GL gl)
Description copied from interface: Drawable
draws an object in OpenGL context

Specified by:
draw in interface Drawable
Parameters:
gl - GL-context
Returns:
false if fails ton draaw and shall be deleted

loadTexture

public static void loadTexture(java.lang.String textureFilePath)
loads a texture using. if the path was loaded before, the image is not loaded again.

Parameters:
textureFilePath -

setPosition

public void setPosition(float x,
                        float y)
sets the position of the Sprite (middle)

Parameters:
x -
y -

getPosition

public Vector2 getPosition()
returns the position of the Sprite (middle)

Returns:
position

setImageFile

public void setImageFile(java.lang.String filePath)
sets the image file an inits the sprite new

Parameters:
filePath -

init

public boolean init(javax.media.opengl.GL gl)
Description copied from interface: Drawable
initializes the Drawable in OpenGL context

Specified by:
init in interface Drawable
Parameters:
gl - gl context
Returns:
false if fails to initialize