Skip to content
Permalink
5d348e1b9a
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
58 lines (47 sloc) 1.14 KB
package game.level;
import game.graphics.Shader;
import game.graphics.Texture;
import game.graphics.VertexArray;
public class Level {
private int width, height;
// private VertexArray[][] tiles;
// private Texture[][] tileTextures;
private VertexArray tile;
private Texture tileTexture;
public Level() {
float[] vertices = new float[] {
-10.0f, -10.0f * 9.0f / 16.0f, 0.0f,
-10.0f, 10.0f * 9.0f / 16.0f, 0.0f,
0.0f, 10.0f * 9.0f / 16.0f, 0.0f,
0.0f, -10.0f * 9.0f / 16.0f, 0.0f,
};
byte[] indices = new byte[] {
0, 1, 2,
2, 3, 0
};
float[] tcs = new float[] {
0, 1,
0, 0,
1, 0,
1, 1
};
// width = 20;
// height = 20;
// tiles = new VertexArray[width][height];
// tileTextures = new Texture[width][height];
tile = new VertexArray(vertices, indices, tcs);
tileTexture = new Texture("res/SmoothFloor.png");
}
public void update() {
// player update
// tile update
}
public void render() {
tileTexture.bind();
Shader.SMOOTH_FLOOR.enable();
Shader.SMOOTH_FLOOR.setUniform2f("player", 0, 0);
tile.bind();
Shader.SMOOTH_FLOOR.disable();
tileTexture.unbind();
}
}