added so it can be used as empty

This commit is contained in:
Ziver Koc 2007-04-04 16:26:26 +00:00
parent 98c96ed24d
commit 69adb14553

View file

@ -88,40 +88,42 @@ public class Sprite extends Entity {
* Draw the sprite
*/
public void render() {
// store the current model matrix
GL11.glPushMatrix();
if(texture != null){
// store the current model matrix
GL11.glPushMatrix();
//Sets the location
super.setTranslationGL();
//the rotation
super.setRotationGL(texture.getImageWidth()/2,texture.getImageHeight()/2);
//Sets the scale of the sprite
super.setScaleGL();
//Sets the location
super.setTranslationGL();
//the rotation
super.setRotationGL(texture.getImageWidth()/2,texture.getImageHeight()/2);
//Sets the scale of the sprite
super.setScaleGL();
// bind to the appropriate texture for this sprite
texture.bindGL();
GL11.glColor3f(1,1,1);
// bind to the appropriate texture for this sprite
texture.bindGL();
GL11.glColor3f(1,1,1);
// draw a quad textured to match the sprite
GL11.glBegin(GL11.GL_QUADS);
{
//Vertex at the upper left
GL11.glTexCoord2f(0, 0);
GL11.glVertex2f(0, 0);
//Vertex at the down left
GL11.glTexCoord2f(0, texture.getHeight());
GL11.glVertex2f(0, texture.getImageHeight());
//Vertex at the upper right
GL11.glTexCoord2f(texture.getWidth(), texture.getHeight());
GL11.glVertex2f(texture.getImageWidth(),texture.getImageHeight());
//Vertex at the down right
GL11.glTexCoord2f(texture.getWidth(), 0);
GL11.glVertex2f(texture.getImageWidth(),0);
// draw a quad textured to match the sprite
GL11.glBegin(GL11.GL_QUADS);
{
//Vertex at the upper left
GL11.glTexCoord2f(0, 0);
GL11.glVertex2f(0, 0);
//Vertex at the down left
GL11.glTexCoord2f(0, texture.getHeight());
GL11.glVertex2f(0, texture.getImageHeight());
//Vertex at the upper right
GL11.glTexCoord2f(texture.getWidth(), texture.getHeight());
GL11.glVertex2f(texture.getImageWidth(),texture.getImageHeight());
//Vertex at the down right
GL11.glTexCoord2f(texture.getWidth(), 0);
GL11.glVertex2f(texture.getImageWidth(),0);
}
GL11.glEnd();
// restore the model view matrix to prevent contamination
GL11.glPopMatrix();
}
GL11.glEnd();
// restore the model view matrix to prevent contamination
GL11.glPopMatrix();
}
/**