Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class GrassBlock extends Block {
- public GrassBlock(int xx, int yy) {
- x = xx;
- y = yy;
- System.out.println("rendering grass at "+x+","+y);
- try {
- blockTexture = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/grass.png"));
- } catch (IOException ex) {
- }
- }
- }
- public class Block {
- protected int blockWidth = 30;
- protected int blockHeight = 30;
- public int x = 0;
- public int y = 0;
- public Texture blockTexture;
- public void draw() {
- blockTexture.bind();
- GL11.glBegin(GL11.GL_QUADS);
- GL11.glVertex2f(x, y);
- GL11.glVertex2f(x + blockWidth, y);
- GL11.glVertex2f(x + blockWidth, y + blockHeight);
- GL11.glVertex2f(x, y + blockHeight);
- GL11.glVertex2f(x, y);
- GL11.glEnd();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment