Archived
0

Init project

This commit is contained in:
2013-10-09 09:17:49 +04:00
commit c8ce51596e
12 changed files with 465 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
package ru.dmitriymx.game;
import org.lwjgl.opengl.GL11;
public class Foxy {
private Sprite texture;
private int x, y;
public Foxy(){
texture = new Sprite(Foxy.class.getResourceAsStream("/ru/dmitriymx/game/foxy2.png"), 38, 33);
x = y = 0;
}
public void render(){
Sprite.Coords frame = texture.getFrame();
final int K = 2;
GL11.glColor3f(1f, 1f, 1f);
texture.bind();
GL11.glBegin(GL11.GL_QUADS);
GL11.glTexCoord2f(texture.floatX(frame.x1),texture.floatY(frame.y1));
GL11.glVertex2f(0, 0);
GL11.glTexCoord2f(texture.floatX(frame.x2),texture.floatY(frame.y1));
GL11.glVertex2f(texture.getWidthSprite()*K, 0);
GL11.glTexCoord2f(texture.floatX(frame.x2),texture.floatY(frame.y2));
GL11.glVertex2f(texture.getWidthSprite()*K, texture.getHeightSprite()*K);
GL11.glTexCoord2f(texture.floatX(frame.x1),texture.floatY(frame.y2));
GL11.glVertex2f(0, texture.getHeightSprite()*K);
GL11.glEnd();
texture.nextFrame();
}
}