|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.gljava.opengl.Sprite
public class Sprite
A simple sprite which has a texture and knows how to draw itself given a context and co-ordinates
| Field Summary | |
|---|---|
protected int |
height
|
protected Texture |
texture
|
protected int |
width
|
| Constructor Summary | |
|---|---|
Sprite()
|
|
Sprite(GL gl,
java.lang.String texturePath)
Create a new sprite from the image given at texturePath |
|
Sprite(GL gl,
java.lang.String resourceName,
boolean resource)
Create a new sprite from the image found at the given resourceName |
|
Sprite(GL gl,
java.net.URL url)
Create a new sprite from the image given at url |
|
Sprite(Texture t)
Create a new sprite from given Texture |
|
| Method Summary | |
|---|---|
void |
draw(GL gl,
float x,
float y)
Draw the sprite at the specified location |
int |
getHeight()
Get the height of this sprite in pixels |
int |
getWidth()
Get the width of this sprite in pixels |
void |
setHeight(int h)
|
void |
setWidth(int w)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Texture texture
protected int width
protected int height
| Constructor Detail |
|---|
public Sprite()
public Sprite(Texture t)
t - a Texture value
public Sprite(GL gl,
java.lang.String texturePath)
throws java.io.IOException
gl - a GL valuetexturePath - a String value
java.io.IOException - if an error occurs
public Sprite(GL gl,
java.net.URL url)
throws java.io.IOException
gl - a GL valueurl - an URL value
java.io.IOException - if an error occurs
public Sprite(GL gl,
java.lang.String resourceName,
boolean resource)
throws java.io.IOException
gl - a GL valueresourceName - a String valueresource - a boolean value
java.io.IOException - if an error occurs| Method Detail |
|---|
public int getWidth()
public void setWidth(int w)
public int getHeight()
public void setHeight(int h)
public void draw(GL gl,
float x,
float y)
x - The x location at which to draw this spritey - The y location at which to draw this sprite
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||