Started changing the graphics from old opengl to opengl core profile
This commit is contained in:
parent
400746b88a
commit
9e6ef227cc
44
.classpath
44
.classpath
|
|
@ -3,10 +3,44 @@
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/mainloop.jar"/>
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/mainloop.jar"/>
|
||||||
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2/joml-1.9.16.jar"/>
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/binary-data-format-v1.9.jar"/>
|
||||||
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2/joml-1.9.16-javadoc.jar"/>
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/GlEngine.jar"/>
|
||||||
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2/joml-1.9.16-sources.jar"/>
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl.jar"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/LWJGL"/>
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-glfw.jar"/>
|
||||||
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/binary-data-format-v1.8.jar"/>
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-glfw-javadoc.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-glfw-natives-linux.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-glfw-natives-macos.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-glfw-natives-windows.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-glfw-sources.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-natives-linux.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-natives-macos.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-natives-windows.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-openal.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-openal-javadoc.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-openal-natives-linux.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-openal-natives-macos.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-openal-natives-windows.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-openal-sources.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-opencl.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-opencl-javadoc.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-opencl-sources.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-opengl.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-opengles.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-opengles-javadoc.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-opengles-natives-linux.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-opengles-natives-macos.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-opengles-natives-windows.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-opengles-sources.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-opengl-javadoc.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-opengl-natives-linux.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-opengl-natives-macos.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-opengl-natives-windows.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-opengl-sources.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-stb.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-stb-javadoc.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-stb-natives-linux.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-stb-natives-macos.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-stb-natives-windows.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-stb-sources.jar"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ import projectzombie.init.LayerGenerators;
|
||||||
import projectzombie.init.Layers;
|
import projectzombie.init.Layers;
|
||||||
import projectzombie.init.Resources;
|
import projectzombie.init.Resources;
|
||||||
import projectzombie.init.Sounds;
|
import projectzombie.init.Sounds;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.init.Tiles;
|
import projectzombie.init.Tiles;
|
||||||
import projectzombie.input.JoystickCallback;
|
import projectzombie.input.JoystickCallback;
|
||||||
import projectzombie.input.KeyCallback;
|
import projectzombie.input.KeyCallback;
|
||||||
|
|
@ -98,9 +98,6 @@ public class Main
|
||||||
window = new DisplayWindow("Project Zombie");
|
window = new DisplayWindow("Project Zombie");
|
||||||
window.init();
|
window.init();
|
||||||
|
|
||||||
// Initialise the textures
|
|
||||||
Textures.initTextures(window);
|
|
||||||
|
|
||||||
// Initialize the gamepad
|
// Initialize the gamepad
|
||||||
JoystickCallback.JOYSTICK_CALLBACK.init();
|
JoystickCallback.JOYSTICK_CALLBACK.init();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,9 @@ import org.lwjgl.system.MemoryStack;
|
||||||
|
|
||||||
import projectzombie.Main;
|
import projectzombie.Main;
|
||||||
import projectzombie.resources.Resource;
|
import projectzombie.resources.Resource;
|
||||||
import projectzombie.util.math.MathHelpers;
|
import gl_engine.MathHelpers;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.util.math.vec.Vec3d;
|
import gl_engine.vec.Vec3d;
|
||||||
|
|
||||||
public class AudioObject
|
public class AudioObject
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package projectzombie.audio;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import projectzombie.util.math.vec.Vec3d;
|
import gl_engine.vec.Vec3d;
|
||||||
|
|
||||||
public class AudioRandom extends AudioObject
|
public class AudioRandom extends AudioObject
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,27 @@
|
||||||
package projectzombie.display;
|
package projectzombie.display;
|
||||||
|
|
||||||
import projectzombie.util.math.MathHelpers;
|
import gl_engine.matrix.Matrix4;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec3d;
|
||||||
import projectzombie.util.math.vec.Vec3d;
|
|
||||||
|
|
||||||
public class Camera
|
public class Camera
|
||||||
{
|
{
|
||||||
public Vec3d pos;
|
public double angle = 45;
|
||||||
public Vec2d angle;
|
|
||||||
public int renderDistance;
|
public int renderDistance;
|
||||||
public double cameraDistance;
|
private Matrix4 matrix;
|
||||||
public double distanceFromPlayer;
|
|
||||||
|
|
||||||
public static Camera camera;
|
public static Camera camera;
|
||||||
|
|
||||||
public Camera(Vec3d pos, Vec2d angle, double cameraDistance, int renderDistance)
|
public Camera(Vec3d pos)
|
||||||
{
|
{
|
||||||
this.angle = new Vec2d(angle.x, -angle.y);
|
Matrix4 identity = Matrix4.identity();
|
||||||
this.pos = pos.subtract(MathHelpers.moveTowards3(
|
|
||||||
cameraDistance, new Vec2d(Math.toRadians(angle.x), Math.toRadians(-angle.y))));
|
|
||||||
this.cameraDistance = cameraDistance;
|
|
||||||
this.renderDistance = renderDistance;
|
|
||||||
|
|
||||||
this.distanceFromPlayer = 10;
|
identity = Matrix4.multiply(identity, Matrix4.translate(pos.x, 0, pos.y));
|
||||||
|
identity = Matrix4.multiply(identity, Matrix4.rotate(angle, 0, 1, 0));
|
||||||
|
identity = Matrix4.multiply(identity, Matrix4.rotate(-50, 1, 0, 0));
|
||||||
|
identity = Matrix4.multiply(identity, Matrix4.translate(0, 0, -8));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Matrix4 getMatrix() {
|
||||||
|
return matrix;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,18 +11,17 @@ import static org.lwjgl.opengl.GL11.glLoadMatrixf;
|
||||||
import static org.lwjgl.opengl.GL11.glMatrixMode;
|
import static org.lwjgl.opengl.GL11.glMatrixMode;
|
||||||
import static org.lwjgl.opengl.GL11.glViewport;
|
import static org.lwjgl.opengl.GL11.glViewport;
|
||||||
|
|
||||||
import org.joml.Matrix4f;
|
|
||||||
import org.lwjgl.opengl.GL;
|
import org.lwjgl.opengl.GL;
|
||||||
import org.lwjgl.system.MemoryStack;
|
import org.lwjgl.system.MemoryStack;
|
||||||
|
|
||||||
|
import gl_engine.matrix.Matrix4;
|
||||||
import projectzombie.Main;
|
import projectzombie.Main;
|
||||||
import projectzombie.display.lighting.DynamicLighting;
|
import projectzombie.display.lighting.DynamicLighting;
|
||||||
import projectzombie.display.transparent.TransparentObjects;
|
|
||||||
import projectzombie.entity.player.EntityPlayer;
|
import projectzombie.entity.player.EntityPlayer;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.util.math.vec.Vec3d;
|
import gl_engine.vec.Vec3d;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.chunk.ChunkEventHandler;
|
import projectzombie.world.chunk.ChunkEventHandler;
|
||||||
|
|
||||||
|
|
@ -35,67 +34,20 @@ public class DisplayRender
|
||||||
Main.window.setHeight(h);
|
Main.window.setHeight(h);
|
||||||
|
|
||||||
// Setup GL and clear the colour
|
// Setup GL and clear the colour
|
||||||
GL.createCapabilities();
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
glViewport(0, 0, w, h);
|
glViewport(0, 0, w, h);
|
||||||
|
|
||||||
// Push the matrix
|
|
||||||
GlHelpers.pushMatrix();
|
|
||||||
|
|
||||||
// Enable some stuff
|
|
||||||
GlHelpers.enableTexture2d();
|
|
||||||
GlHelpers.enableDepthTest();
|
|
||||||
GlHelpers.enableBlend();
|
|
||||||
GlHelpers.enableAlpha();
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
|
|
||||||
// Set the colour to white
|
|
||||||
GlHelpers.color4(1, 1, 1, 1);
|
|
||||||
|
|
||||||
// Bind the texmap
|
|
||||||
Textures.texmap.bindTexture();
|
|
||||||
|
|
||||||
if(Main.menu.doGameRender)
|
if(Main.menu.doGameRender)
|
||||||
{
|
{
|
||||||
// Push the matrix
|
|
||||||
GlHelpers.pushMatrix();
|
|
||||||
|
|
||||||
if(ChunkEventHandler.loaded)
|
if(ChunkEventHandler.loaded)
|
||||||
{
|
{
|
||||||
// Set matrix mode
|
// Create the projection matrix
|
||||||
glMatrixMode(GL_MODELVIEW);
|
Matrix4 projection = Matrix4.projection((double)w / (double)h, 45, 1, 32);
|
||||||
|
|
||||||
TransparentObjects.clear();
|
|
||||||
|
|
||||||
// Set the colour to white
|
|
||||||
GlHelpers.color4(1, 1, 1, 1);
|
|
||||||
|
|
||||||
// Create a matrix
|
|
||||||
Matrix4f m = new Matrix4f();
|
|
||||||
|
|
||||||
// Set the perspective
|
|
||||||
m.setPerspective((float) Math.toRadians(45.0f), ((float)w)/((float)h), 0.01f, 100.0f);
|
|
||||||
try (MemoryStack stack = MemoryStack.stackPush()) {
|
|
||||||
glLoadMatrixf(m.get(stack.mallocFloat(16)));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the camera angle
|
|
||||||
m.setLookAt(0.0f, 0.0f, 10.0f,
|
|
||||||
0.0f, 0.0f, 0.0f,
|
|
||||||
0.0f, 1.0f, 0.0f);
|
|
||||||
|
|
||||||
EntityPlayer player = Main.player;
|
EntityPlayer player = Main.player;
|
||||||
Camera camera = new Camera(
|
Camera camera = new Camera(new Vec3d(player.pos.x, 0, player.pos.y));
|
||||||
new Vec3d(player.pos.x, player.pos.y, 0),
|
|
||||||
new Vec2d(player.angle, 45),
|
|
||||||
10, Chunk.RENDER_DISTANCE);
|
|
||||||
Camera.camera = camera;
|
Camera.camera = camera;
|
||||||
|
|
||||||
//GlHelpers.translate(0, 0, -5);
|
|
||||||
GlHelpers.rotate(camera.angle.y, 1, 0, 0);
|
|
||||||
GlHelpers.rotate(camera.angle.x, 0, 0, 1);
|
|
||||||
GlHelpers.translate3(-camera.pos.x, -camera.pos.y, -camera.pos.z);
|
|
||||||
|
|
||||||
// Process all the light sources
|
// Process all the light sources
|
||||||
DynamicLighting.update();
|
DynamicLighting.update();
|
||||||
|
|
||||||
|
|
@ -103,21 +55,10 @@ public class DisplayRender
|
||||||
Main.world.render(camera);
|
Main.world.render(camera);
|
||||||
player.chunk = Main.world.getLayer().getChunk(player.pos);
|
player.chunk = Main.world.getLayer().getChunk(player.pos);
|
||||||
player.doRender(player.pos, camera);
|
player.doRender(player.pos, camera);
|
||||||
|
|
||||||
// Render the sorted transparent objects
|
|
||||||
TransparentObjects.render(camera);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GlHelpers.popMatrix();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render the user interface
|
// Render the user interface
|
||||||
DisplayRenderUI.render();
|
DisplayRenderUI.render();
|
||||||
|
|
||||||
// Unbind the texmap
|
|
||||||
Textures.texmap.unbindTexture();
|
|
||||||
|
|
||||||
// Pop the matrix
|
|
||||||
GlHelpers.popMatrix();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,13 @@ package projectzombie.display;
|
||||||
import projectzombie.Main;
|
import projectzombie.Main;
|
||||||
import projectzombie.display.bossbar.BossBars;
|
import projectzombie.display.bossbar.BossBars;
|
||||||
import projectzombie.entity.player.EntityPlayer;
|
import projectzombie.entity.player.EntityPlayer;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.inventory.Inventory;
|
import projectzombie.inventory.Inventory;
|
||||||
import projectzombie.text.Text;
|
import projectzombie.text.Text;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.gl.texture.TextureReference;
|
import projectzombie.util.gl.texture.TextureReference;
|
||||||
import projectzombie.util.math.ItemStack;
|
import projectzombie.util.math.ItemStack;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
|
|
||||||
public class DisplayRenderUI
|
public class DisplayRenderUI
|
||||||
{
|
{
|
||||||
|
|
@ -60,8 +60,8 @@ public class DisplayRenderUI
|
||||||
// Render the healthbar
|
// Render the healthbar
|
||||||
double max_health = player.maxHealth();
|
double max_health = player.maxHealth();
|
||||||
double a = 1 - (player.getHealth() / max_health);
|
double a = 1 - (player.getHealth() / max_health);
|
||||||
TextureReference health_fg = Textures.UI_HEALTH_FG;
|
TextureReference health_fg = Models.UI_HEALTH_FG;
|
||||||
TextureReference health_bg = Textures.UI_HEALTH_BG;
|
TextureReference health_bg = Models.UI_HEALTH_BG;
|
||||||
|
|
||||||
GlHelpers.pushMatrix();
|
GlHelpers.pushMatrix();
|
||||||
GlHelpers.translate2(-2*s, -9*s);
|
GlHelpers.translate2(-2*s, -9*s);
|
||||||
|
|
@ -82,9 +82,9 @@ public class DisplayRenderUI
|
||||||
|
|
||||||
// Display the amount of ammo left, and the defence and gun level
|
// Display the amount of ammo left, and the defence and gun level
|
||||||
GlHelpers.pushMatrix();
|
GlHelpers.pushMatrix();
|
||||||
TextureReference ammo_tex = Textures.ITEM_AMMO_BOX;
|
TextureReference ammo_tex = Models.ITEM_AMMO_BOX;
|
||||||
TextureReference gunlevel_tex = Textures.UI_GUN_LEVEL;
|
TextureReference gunlevel_tex = Models.UI_GUN_LEVEL;
|
||||||
TextureReference deflevel_tex = Textures.UI_DEFENCE_LEVEL;
|
TextureReference deflevel_tex = Models.UI_DEFENCE_LEVEL;
|
||||||
|
|
||||||
GlHelpers.translate2(-9.5*s, -9*s);
|
GlHelpers.translate2(-9.5*s, -9*s);
|
||||||
GlHelpers.begin();
|
GlHelpers.begin();
|
||||||
|
|
@ -121,7 +121,7 @@ public class DisplayRenderUI
|
||||||
GlHelpers.popMatrix();
|
GlHelpers.popMatrix();
|
||||||
|
|
||||||
// Display all the items in the players inventory
|
// Display all the items in the players inventory
|
||||||
TextureReference slots_tex = Textures.UI_ITEM_SLOTS;
|
TextureReference slots_tex = Models.UI_ITEM_SLOTS;
|
||||||
|
|
||||||
GlHelpers.pushMatrix();
|
GlHelpers.pushMatrix();
|
||||||
GlHelpers.translate2(3*s, -9.5*s);
|
GlHelpers.translate2(3*s, -9.5*s);
|
||||||
|
|
@ -134,7 +134,7 @@ public class DisplayRenderUI
|
||||||
GlHelpers.end();
|
GlHelpers.end();
|
||||||
|
|
||||||
// Render the players active slot
|
// Render the players active slot
|
||||||
TextureReference hotbar_slot_tex = Textures.UI_ACTIVE_SLOT;
|
TextureReference hotbar_slot_tex = Models.UI_ACTIVE_SLOT;
|
||||||
GlHelpers.begin();
|
GlHelpers.begin();
|
||||||
|
|
||||||
hotbar_slot_tex.texCoord(0, 1); GlHelpers.vertex2(2.1 + player.inventory_hand*2, 2.1);
|
hotbar_slot_tex.texCoord(0, 1); GlHelpers.vertex2(2.1 + player.inventory_hand*2, 2.1);
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,9 @@ import java.nio.IntBuffer;
|
||||||
|
|
||||||
import org.lwjgl.BufferUtils;
|
import org.lwjgl.BufferUtils;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
import org.lwjgl.opengl.GL;
|
||||||
|
|
||||||
|
import gl_engine.graphics.GraphicsHelpers;
|
||||||
import mainloop.task.IMainloopTask;
|
import mainloop.task.IMainloopTask;
|
||||||
import projectzombie.Main;
|
import projectzombie.Main;
|
||||||
import projectzombie.input.CursorEnterCallback;
|
import projectzombie.input.CursorEnterCallback;
|
||||||
|
|
@ -64,23 +66,14 @@ public class DisplayWindow implements IMainloopTask
|
||||||
IntBuffer h = BufferUtils.createIntBuffer(1);
|
IntBuffer h = BufferUtils.createIntBuffer(1);
|
||||||
monitor = GLFW.glfwGetPrimaryMonitor();
|
monitor = GLFW.glfwGetPrimaryMonitor();
|
||||||
GLFW.glfwGetMonitorPhysicalSize(monitor, w, h);
|
GLFW.glfwGetMonitorPhysicalSize(monitor, w, h);
|
||||||
this.width = w.get()*4;
|
width = w.get()*4;
|
||||||
this.height = h.get()*4;
|
height = h.get()*4;
|
||||||
|
|
||||||
// Set the window hint
|
|
||||||
GLFW.glfwWindowHint(GLFW.GLFW_SAMPLES, 0);
|
|
||||||
GLFW.glfwWindowHint(GLFW.GLFW_SCALE_TO_MONITOR, 1);
|
|
||||||
GLFW.glfwWindowHint(GLFW.GLFW_VISIBLE, 0);
|
|
||||||
GLFW.glfwWindowHint(GLFW.GLFW_VERSION_MAJOR, 3);
|
|
||||||
GLFW.glfwWindowHint(GLFW.GLFW_VERSION_MINOR, 3);
|
|
||||||
|
|
||||||
// Create the window
|
// Create the window
|
||||||
this.window = GLFW.glfwCreateWindow(this.width, this.height, this.name, monitor, 0);
|
window = GraphicsHelpers.initWindow("Project Zombie", width, height, monitor);
|
||||||
|
|
||||||
// Has the window been created
|
// Make the context current
|
||||||
if(this.window == 0) {
|
GLFW.glfwMakeContextCurrent(this.window);
|
||||||
System.err.println("Failed to create the window");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the key handlers
|
// Set the key handlers
|
||||||
GLFW.glfwSetCursorPosCallback(this.window, new CursorPosCallback());
|
GLFW.glfwSetCursorPosCallback(this.window, new CursorPosCallback());
|
||||||
|
|
@ -104,9 +97,6 @@ public class DisplayWindow implements IMainloopTask
|
||||||
|
|
||||||
public void render()
|
public void render()
|
||||||
{
|
{
|
||||||
// Make the context current
|
|
||||||
this.makeContextCurrent();
|
|
||||||
|
|
||||||
// Set the framebuffer size
|
// Set the framebuffer size
|
||||||
int w[] = {0};
|
int w[] = {0};
|
||||||
int h[] = {0};
|
int h[] = {0};
|
||||||
|
|
@ -152,10 +142,6 @@ public class DisplayWindow implements IMainloopTask
|
||||||
GLFW.glfwPollEvents();
|
GLFW.glfwPollEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void makeContextCurrent() {
|
|
||||||
GLFW.glfwMakeContextCurrent(this.window);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean shouldClose() {
|
public boolean shouldClose() {
|
||||||
return GLFW.glfwWindowShouldClose(this.window);
|
return GLFW.glfwWindowShouldClose(this.window);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package projectzombie.display.bossbar;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.gl.texture.TextureReference;
|
import projectzombie.util.gl.texture.TextureReference;
|
||||||
|
|
||||||
|
|
@ -20,8 +20,8 @@ public class BossBars
|
||||||
|
|
||||||
public static void render()
|
public static void render()
|
||||||
{
|
{
|
||||||
TextureReference health_fg = Textures.UI_HEALTH_FG;
|
TextureReference health_fg = Models.UI_HEALTH_FG;
|
||||||
TextureReference health_bg = Textures.UI_HEALTH_BG;
|
TextureReference health_bg = Models.UI_HEALTH_BG;
|
||||||
ArrayList<IBossBar> toRemove = new ArrayList<IBossBar>();
|
ArrayList<IBossBar> toRemove = new ArrayList<IBossBar>();
|
||||||
|
|
||||||
double s = GlHelpers.getScale() / 10.0;
|
double s = GlHelpers.getScale() / 10.0;
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
package projectzombie.display.lighting;
|
package projectzombie.display.lighting;
|
||||||
|
|
||||||
import projectzombie.util.math.MathHelpers;
|
import gl_engine.MathHelpers;
|
||||||
import projectzombie.util.math.map.IMap2D;
|
import projectzombie.util.math.map.IMap2D;
|
||||||
import projectzombie.util.math.map.Map2D;
|
import projectzombie.util.math.map.Map2D;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.util.math.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
|
|
||||||
public class ChunkLightingCollection implements IMap2D<ChunkLightingTemp>
|
public class ChunkLightingCollection implements IMap2D<ChunkLightingTemp>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package projectzombie.display.lighting;
|
package projectzombie.display.lighting;
|
||||||
|
|
||||||
import projectzombie.util.math.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
|
|
||||||
public class ChunkLightingTemp
|
public class ChunkLightingTemp
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,9 @@ import projectzombie.Main;
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.entity.Entity;
|
import projectzombie.entity.Entity;
|
||||||
import projectzombie.entity.player.EntityPlayer;
|
import projectzombie.entity.player.EntityPlayer;
|
||||||
import projectzombie.util.math.MathHelpers;
|
import gl_engine.MathHelpers;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import projectzombie.util.math.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.chunk.ChunkEventHandler;
|
import projectzombie.world.chunk.ChunkEventHandler;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,11 @@ import projectzombie.Main;
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.entity.player.EntityPlayer;
|
import projectzombie.entity.player.EntityPlayer;
|
||||||
import projectzombie.mainloop.MainloopHelpers;
|
import projectzombie.mainloop.MainloopHelpers;
|
||||||
import projectzombie.util.math.MathHelpers;
|
import gl_engine.MathHelpers;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import projectzombie.util.math.range.Range4i;
|
import gl_engine.range.Range4i;
|
||||||
import projectzombie.util.math.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.util.math.vec.Vec4i;
|
import gl_engine.vec.Vec4i;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.chunk.ChunkEventHandler;
|
import projectzombie.world.chunk.ChunkEventHandler;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
package projectzombie.display.transparent;
|
|
||||||
|
|
||||||
import projectzombie.display.Camera;
|
|
||||||
import projectzombie.util.math.TileState;
|
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
|
||||||
|
|
||||||
public interface ITransparentObject
|
|
||||||
{
|
|
||||||
public boolean isOpaqueTile();
|
|
||||||
public Vec2d getRenderOffset(TileState state);
|
|
||||||
public void render(Vec2d pos, Camera camera, TileState state);
|
|
||||||
}
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
package projectzombie.display.transparent;
|
|
||||||
|
|
||||||
import projectzombie.display.Camera;
|
|
||||||
import projectzombie.util.math.TileState;
|
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
|
||||||
import projectzombie.util.math.vec.Vec3d;
|
|
||||||
|
|
||||||
class TransparentObject
|
|
||||||
{
|
|
||||||
double distance;
|
|
||||||
ITransparentObject object;
|
|
||||||
Vec2d pos;
|
|
||||||
TileState state;
|
|
||||||
|
|
||||||
TransparentObject(ITransparentObject object, Camera camera, Vec2d pos, TileState state) {
|
|
||||||
Vec2d offset = object.getRenderOffset(state);
|
|
||||||
this.distance = camera.pos.distance(new Vec3d(offset.x + pos.x, offset.y + pos.y, 0));
|
|
||||||
this.object = object;
|
|
||||||
this.pos = pos;
|
|
||||||
this.state = state;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,56 +0,0 @@
|
||||||
package projectzombie.display.transparent;
|
|
||||||
|
|
||||||
import projectzombie.display.Camera;
|
|
||||||
import projectzombie.util.math.TileState;
|
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
|
||||||
|
|
||||||
public class TransparentObjects
|
|
||||||
{
|
|
||||||
private static TransparentObject[] objects = new TransparentObject[0];
|
|
||||||
|
|
||||||
public static void clear() {
|
|
||||||
objects = new TransparentObject[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void register(ITransparentObject object, Camera camera, Vec2d pos, TileState state)
|
|
||||||
{
|
|
||||||
TransparentObject r_to = new TransparentObject(object, camera, pos, state);
|
|
||||||
TransparentObject[] objects_n = new TransparentObject[objects.length + 1];
|
|
||||||
boolean added = false;
|
|
||||||
int upto = 0;
|
|
||||||
|
|
||||||
|
|
||||||
//System.out.println("objects length: "+objects.length);
|
|
||||||
//System.out.println("objects_n length: "+objects_n.length);
|
|
||||||
|
|
||||||
// Loop over the transparent object items
|
|
||||||
for(int i=0;i<objects.length;i++)
|
|
||||||
{
|
|
||||||
TransparentObject to = objects[i];
|
|
||||||
//System.out.println("UPTO: "+upto+", to: "+to);
|
|
||||||
|
|
||||||
if(r_to.distance > to.distance && !added) {
|
|
||||||
added = true;
|
|
||||||
objects_n[upto] = r_to;
|
|
||||||
upto += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
objects_n[upto] = to;
|
|
||||||
upto += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!added) {
|
|
||||||
objects_n[upto] = r_to;
|
|
||||||
}
|
|
||||||
|
|
||||||
objects = objects_n;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void render(Camera camera)
|
|
||||||
{
|
|
||||||
// Loop over the objects and render all of them
|
|
||||||
for(TransparentObject to : objects) {
|
|
||||||
to.object.render(to.pos, camera, to.state);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -11,19 +11,18 @@ import bdf.types.BdfObject;
|
||||||
import mainloop.task.IMainloopTask;
|
import mainloop.task.IMainloopTask;
|
||||||
import projectzombie.Main;
|
import projectzombie.Main;
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.display.transparent.ITransparentObject;
|
|
||||||
import projectzombie.display.transparent.TransparentObjects;
|
|
||||||
import projectzombie.init.Entities;
|
import projectzombie.init.Entities;
|
||||||
import projectzombie.tiles.Tile;
|
import projectzombie.tiles.Tile;
|
||||||
import projectzombie.util.math.MathHelpers;
|
import gl_engine.MathHelpers;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.util.math.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
|
import gl_engine.vec.Vec3d;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.chunk.ChunkEventHandler;
|
import projectzombie.world.chunk.ChunkEventHandler;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
public class Entity implements ITransparentObject, IBdfClassManager
|
public class Entity implements IBdfClassManager
|
||||||
{
|
{
|
||||||
public Vec2d pos;
|
public Vec2d pos;
|
||||||
public boolean opaqueTile = true;
|
public boolean opaqueTile = true;
|
||||||
|
|
@ -188,23 +187,14 @@ public class Entity implements ITransparentObject, IBdfClassManager
|
||||||
public void render(Vec2d pos, Camera camera) {
|
public void render(Vec2d pos, Camera camera) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void render(Vec2d pos, Camera camera, TileState state) {
|
public void render(Vec2d pos, Camera camera, TileState state) {
|
||||||
this.render(pos, camera);
|
this.render(pos, camera);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doRender(Vec2d pos, Camera camera)
|
public void doRender(Vec2d pos, Camera camera) {
|
||||||
{
|
|
||||||
if(this.opaqueTile) {
|
|
||||||
TransparentObjects.register(this, camera, pos, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
|
||||||
this.render(pos, camera);
|
this.render(pos, camera);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOpaqueTile() {
|
public boolean isOpaqueTile() {
|
||||||
return this.opaqueTile;
|
return this.opaqueTile;
|
||||||
}
|
}
|
||||||
|
|
@ -338,7 +328,6 @@ public class Entity implements ITransparentObject, IBdfClassManager
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Vec2d getRenderOffset(TileState state) {
|
public Vec2d getRenderOffset(TileState state) {
|
||||||
return new Vec2d(0, 0);
|
return new Vec2d(0, 0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,17 +9,17 @@ import projectzombie.display.Camera;
|
||||||
import projectzombie.display.bossbar.BossBars;
|
import projectzombie.display.bossbar.BossBars;
|
||||||
import projectzombie.display.bossbar.IBossBar;
|
import projectzombie.display.bossbar.IBossBar;
|
||||||
import projectzombie.init.Items;
|
import projectzombie.init.Items;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.init.Tiles;
|
import projectzombie.init.Tiles;
|
||||||
import projectzombie.time.GameTimer;
|
import projectzombie.time.GameTimer;
|
||||||
import projectzombie.util.gl.texture.TextureReference;
|
import projectzombie.util.gl.texture.TextureReference;
|
||||||
import projectzombie.util.math.ItemStack;
|
import projectzombie.util.math.ItemStack;
|
||||||
import projectzombie.util.math.MathHelpers;
|
import gl_engine.MathHelpers;
|
||||||
import projectzombie.util.math.random.OpenSimplexNoise;
|
import projectzombie.util.math.random.OpenSimplexNoise;
|
||||||
import projectzombie.util.math.random.RandomHelpers;
|
import projectzombie.util.math.random.RandomHelpers;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.util.math.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.util.math.vec.Vec3d;
|
import gl_engine.vec.Vec3d;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
|
|
@ -183,13 +183,13 @@ public class EntityBoss extends EntityVertical implements IBossBar, EntityKillWi
|
||||||
{
|
{
|
||||||
// Get the boss texture
|
// Get the boss texture
|
||||||
if(moving && firing) {
|
if(moving && firing) {
|
||||||
tex = Textures.ENTITY_BOSS_WALKING_AND_FIRING;
|
tex = Models.ENTITY_BOSS_WALKING_AND_FIRING;
|
||||||
} else if(moving) {
|
} else if(moving) {
|
||||||
tex = Textures.ENTITY_BOSS_WALKING;
|
tex = Models.ENTITY_BOSS_WALKING;
|
||||||
} else if(firing) {
|
} else if(firing) {
|
||||||
tex = Textures.ENTITY_BOSS_FIRING;
|
tex = Models.ENTITY_BOSS_FIRING;
|
||||||
} else {
|
} else {
|
||||||
tex = Textures.ENTITY_BOSS_IDLE;
|
tex = Models.ENTITY_BOSS_IDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call render
|
// Call render
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,11 @@ import projectzombie.settings.SettingQuality;
|
||||||
import projectzombie.tiles.Tile;
|
import projectzombie.tiles.Tile;
|
||||||
import projectzombie.tiles.TileBulletBreakable;
|
import projectzombie.tiles.TileBulletBreakable;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.math.MathHelpers;
|
import gl_engine.MathHelpers;
|
||||||
import projectzombie.util.math.random.RandomHelpers;
|
import projectzombie.util.math.random.RandomHelpers;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.util.math.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.util.math.vec.Vec3d;
|
import gl_engine.vec.Vec3d;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,17 @@
|
||||||
package projectzombie.entity;
|
package projectzombie.entity;
|
||||||
|
|
||||||
import bdf.types.BdfObject;
|
import bdf.types.BdfObject;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
|
|
||||||
public class EntityDummy extends EntityVertical implements EntityAlive
|
public class EntityDummy extends EntityVertical implements EntityAlive
|
||||||
{
|
{
|
||||||
public EntityDummy(BdfObject bdf) {
|
public EntityDummy(BdfObject bdf) {
|
||||||
super(bdf, Textures.ENTITY_DUMMY, new Vec2d(1, 1));
|
super(bdf, Models.ENTITY_DUMMY, new Vec2d(1, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityDummy(Vec2d pos) {
|
public EntityDummy(Vec2d pos) {
|
||||||
super(pos, Textures.ENTITY_DUMMY, new Vec2d(1, 1));
|
super(pos, Models.ENTITY_DUMMY, new Vec2d(1, 1));
|
||||||
|
|
||||||
this.hitbox = 0.5;
|
this.hitbox = 0.5;
|
||||||
this.isSolid = true;
|
this.isSolid = true;
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,11 @@ import projectzombie.entity.particle.ParticleSmoke;
|
||||||
import projectzombie.init.Sounds;
|
import projectzombie.init.Sounds;
|
||||||
import projectzombie.init.Tiles;
|
import projectzombie.init.Tiles;
|
||||||
import projectzombie.util.gl.texture.IHasTexture;
|
import projectzombie.util.gl.texture.IHasTexture;
|
||||||
import projectzombie.util.math.MathHelpers;
|
import gl_engine.MathHelpers;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.util.math.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.util.math.vec.Vec3d;
|
import gl_engine.vec.Vec3d;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@ package projectzombie.entity;
|
||||||
|
|
||||||
import bdf.types.BdfObject;
|
import bdf.types.BdfObject;
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.util.gl.texture.TextureReference;
|
import projectzombie.util.gl.texture.TextureReference;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
public class EntityFlare extends EntityTnt
|
public class EntityFlare extends EntityTnt
|
||||||
|
|
@ -26,7 +26,7 @@ public class EntityFlare extends EntityTnt
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(Vec2d pos, Camera camera, TextureReference tex, Vec2d size) {
|
public void render(Vec2d pos, Camera camera, TextureReference tex, Vec2d size) {
|
||||||
super.render(pos, camera, Textures.ENTITY_FLARE, size);
|
super.render(pos, camera, Models.ENTITY_FLARE, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@ import bdf.types.BdfObject;
|
||||||
import projectzombie.Main;
|
import projectzombie.Main;
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.entity.player.EntityPlayer;
|
import projectzombie.entity.player.EntityPlayer;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
import projectzombie.world.layer.layergen.LayerGenRememberPlayerPos;
|
import projectzombie.world.layer.layergen.LayerGenRememberPlayerPos;
|
||||||
|
|
@ -19,7 +19,7 @@ public class EntityGrapplingHook extends EntityVertical
|
||||||
private Entity entity;
|
private Entity entity;
|
||||||
|
|
||||||
public EntityGrapplingHook(BdfObject bdf) {
|
public EntityGrapplingHook(BdfObject bdf) {
|
||||||
super(bdf, Textures.ENTITY_GRAPPLING_HOOK, new Vec2d(1, 16));
|
super(bdf, Models.ENTITY_GRAPPLING_HOOK, new Vec2d(1, 16));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -41,7 +41,7 @@ public class EntityGrapplingHook extends EntityVertical
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityGrapplingHook(Vec2d pos, int layerId, Entity entity) {
|
public EntityGrapplingHook(Vec2d pos, int layerId, Entity entity) {
|
||||||
super(pos, Textures.ENTITY_GRAPPLING_HOOK, new Vec2d(1, 16));
|
super(pos, Models.ENTITY_GRAPPLING_HOOK, new Vec2d(1, 16));
|
||||||
|
|
||||||
this.layerId = layerId;
|
this.layerId = layerId;
|
||||||
this.height = -16;
|
this.height = -16;
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,12 @@ package projectzombie.entity;
|
||||||
import bdf.types.BdfNamedList;
|
import bdf.types.BdfNamedList;
|
||||||
import bdf.types.BdfObject;
|
import bdf.types.BdfObject;
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.gl.texture.TextureReference;
|
import projectzombie.util.gl.texture.TextureReference;
|
||||||
import projectzombie.util.math.ItemStack;
|
import projectzombie.util.math.ItemStack;
|
||||||
import projectzombie.util.math.random.RandomHelpers;
|
import projectzombie.util.math.random.RandomHelpers;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import projectzombie.Main;
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.settings.SettingQuality;
|
import projectzombie.settings.SettingQuality;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
|
|
@ -56,7 +56,7 @@ public class EntityParticle extends Entity
|
||||||
GlHelpers.disableTexture2d();
|
GlHelpers.disableTexture2d();
|
||||||
|
|
||||||
// Get the angle between the camera and the bullet
|
// Get the angle between the camera and the bullet
|
||||||
double angle_r = camera.angle.x;
|
double angle_r = camera.angle;
|
||||||
|
|
||||||
// Make the bullet upright
|
// Make the bullet upright
|
||||||
GlHelpers.translate3(size/2, 0, 0);
|
GlHelpers.translate3(size/2, 0, 0);
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,11 @@ import bdf.types.BdfNamedList;
|
||||||
import bdf.types.BdfObject;
|
import bdf.types.BdfObject;
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.entity.particle.ParticleSpark;
|
import projectzombie.entity.particle.ParticleSpark;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.math.MathHelpers;
|
import gl_engine.MathHelpers;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.util.math.vec.Vec3d;
|
import gl_engine.vec.Vec3d;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
|
|
@ -21,7 +21,7 @@ public class EntityTnt extends EntityVertical
|
||||||
private double explode_damage;
|
private double explode_damage;
|
||||||
|
|
||||||
public EntityTnt(BdfObject bdf) {
|
public EntityTnt(BdfObject bdf) {
|
||||||
super(bdf, Textures.ENTITY_TNT, new Vec2d(0.5, 0.5));
|
super(bdf, Models.ENTITY_TNT, new Vec2d(0.5, 0.5));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -53,7 +53,7 @@ public class EntityTnt extends EntityVertical
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityTnt(Vec2d pos, double angle, int explode_radius, double explode_damage) {
|
public EntityTnt(Vec2d pos, double angle, int explode_radius, double explode_damage) {
|
||||||
super(pos, Textures.ENTITY_TNT, new Vec2d(0.5, 0.5));
|
super(pos, Models.ENTITY_TNT, new Vec2d(0.5, 0.5));
|
||||||
|
|
||||||
Vec2d v = MathHelpers.moveTowards2(0.05, Math.toRadians(angle));
|
Vec2d v = MathHelpers.moveTowards2(0.05, Math.toRadians(angle));
|
||||||
velocity = new Vec3d(v.x, v.y, 0.01);
|
velocity = new Vec3d(v.x, v.y, 0.01);
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,10 @@ import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.gl.VerticalRender;
|
import projectzombie.util.gl.VerticalRender;
|
||||||
import projectzombie.util.gl.texture.IHasTexture;
|
import projectzombie.util.gl.texture.IHasTexture;
|
||||||
import projectzombie.util.gl.texture.TextureReference;
|
import projectzombie.util.gl.texture.TextureReference;
|
||||||
import projectzombie.util.math.MathHelpers;
|
import gl_engine.MathHelpers;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.util.math.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.util.math.vec.Vec3d;
|
import gl_engine.vec.Vec3d;
|
||||||
|
|
||||||
public class EntityVertical extends Entity implements IHasTexture
|
public class EntityVertical extends Entity implements IHasTexture
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@ import java.util.Random;
|
||||||
import bdf.types.BdfNamedList;
|
import bdf.types.BdfNamedList;
|
||||||
import bdf.types.BdfObject;
|
import bdf.types.BdfObject;
|
||||||
import projectzombie.Main;
|
import projectzombie.Main;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.util.gl.texture.TextureReference;
|
import projectzombie.util.gl.texture.TextureReference;
|
||||||
import projectzombie.util.math.astar.AStar;
|
import projectzombie.util.math.astar.AStar;
|
||||||
import projectzombie.util.math.astar.AStarSearcher;
|
import projectzombie.util.math.astar.AStarSearcher;
|
||||||
import projectzombie.util.math.random.OpenSimplexNoise;
|
import projectzombie.util.math.random.OpenSimplexNoise;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.util.math.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
|
|
@ -39,7 +39,7 @@ public class EntityZombie extends EntityVertical implements EntityAlive, EntityK
|
||||||
private static final Vec2d size = new Vec2d(1, 1);
|
private static final Vec2d size = new Vec2d(1, 1);
|
||||||
|
|
||||||
public EntityZombie(BdfObject bdf) {
|
public EntityZombie(BdfObject bdf) {
|
||||||
super(bdf, Textures.ENTITY_ZOMBIE_F, size);
|
super(bdf, Models.ENTITY_ZOMBIE_F, size);
|
||||||
|
|
||||||
// Set some settings
|
// Set some settings
|
||||||
hitbox = 0.5;
|
hitbox = 0.5;
|
||||||
|
|
@ -84,7 +84,7 @@ public class EntityZombie extends EntityVertical implements EntityAlive, EntityK
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityZombie(Vec2d pos) {
|
public EntityZombie(Vec2d pos) {
|
||||||
super(pos, Textures.ENTITY_ZOMBIE_F, size);
|
super(pos, Models.ENTITY_ZOMBIE_F, size);
|
||||||
|
|
||||||
seed = rand.nextLong();
|
seed = rand.nextLong();
|
||||||
Random rand = new Random(seed);
|
Random rand = new Random(seed);
|
||||||
|
|
@ -170,7 +170,7 @@ public class EntityZombie extends EntityVertical implements EntityAlive, EntityK
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TextureReference getTexture() {
|
public TextureReference getTexture() {
|
||||||
return Textures.ENTITY_ZOMBIE_F;
|
return Models.ENTITY_ZOMBIE_F;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void moveInVector(Vec2d vec) {
|
public void moveInVector(Vec2d vec) {
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@ package projectzombie.entity;
|
||||||
|
|
||||||
import bdf.types.BdfObject;
|
import bdf.types.BdfObject;
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.util.gl.texture.TextureReference;
|
import projectzombie.util.gl.texture.TextureReference;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
|
|
||||||
public class EntityZombieArmored extends EntityZombie
|
public class EntityZombieArmored extends EntityZombie
|
||||||
{
|
{
|
||||||
|
|
@ -23,7 +23,7 @@ public class EntityZombieArmored extends EntityZombie
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(Vec2d pos, Camera camera, TextureReference tex, Vec2d size) {
|
public void render(Vec2d pos, Camera camera, TextureReference tex, Vec2d size) {
|
||||||
super.render(pos, camera, Textures.ENTITY_ZOMBIE_F_ARMORED, size);
|
super.render(pos, camera, Models.ENTITY_ZOMBIE_F_ARMORED, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,11 @@ import projectzombie.display.Camera;
|
||||||
import projectzombie.entity.EntityParticle;
|
import projectzombie.entity.EntityParticle;
|
||||||
import projectzombie.settings.SettingQuality;
|
import projectzombie.settings.SettingQuality;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.math.MathHelpers;
|
import gl_engine.MathHelpers;
|
||||||
import projectzombie.util.math.random.RandomHelpers;
|
import projectzombie.util.math.random.RandomHelpers;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.util.math.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.util.math.vec.Vec3d;
|
import gl_engine.vec.Vec3d;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,12 @@ import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.gl.texture.AnimationReference;
|
import projectzombie.util.gl.texture.AnimationReference;
|
||||||
import projectzombie.util.gl.texture.IHasTexture;
|
import projectzombie.util.gl.texture.IHasTexture;
|
||||||
import projectzombie.util.gl.texture.TextureReference;
|
import projectzombie.util.gl.texture.TextureReference;
|
||||||
import projectzombie.util.math.MathHelpers;
|
import gl_engine.MathHelpers;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import projectzombie.util.math.random.RandomHelpers;
|
import projectzombie.util.math.random.RandomHelpers;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.util.math.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.util.math.vec.Vec3d;
|
import gl_engine.vec.Vec3d;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@ import projectzombie.display.Camera;
|
||||||
import projectzombie.entity.EntityParticle;
|
import projectzombie.entity.EntityParticle;
|
||||||
import projectzombie.settings.SettingQuality;
|
import projectzombie.settings.SettingQuality;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.math.MathHelpers;
|
import gl_engine.MathHelpers;
|
||||||
import projectzombie.util.math.random.RandomHelpers;
|
import projectzombie.util.math.random.RandomHelpers;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.util.math.vec.Vec3d;
|
import gl_engine.vec.Vec3d;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,11 @@ import projectzombie.Main;
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.entity.EntityParticle;
|
import projectzombie.entity.EntityParticle;
|
||||||
import projectzombie.entity.EntityVertical;
|
import projectzombie.entity.EntityVertical;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.settings.SettingQuality;
|
import projectzombie.settings.SettingQuality;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.math.random.RandomHelpers;
|
import projectzombie.util.math.random.RandomHelpers;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
|
|
@ -20,7 +20,7 @@ public class ParticleSmoke extends EntityVertical
|
||||||
double disappear_speed;
|
double disappear_speed;
|
||||||
|
|
||||||
public ParticleSmoke(Vec2d pos) {
|
public ParticleSmoke(Vec2d pos) {
|
||||||
super(new Vec2d(0, 0), Textures.PARTICLE_SMOKE_RANDOM.getTexture(), new Vec2d(1, 1));
|
super(new Vec2d(0, 0), Models.PARTICLE_SMOKE_RANDOM.getTexture(), new Vec2d(1, 1));
|
||||||
|
|
||||||
this.pos = new Vec2d(
|
this.pos = new Vec2d(
|
||||||
RandomHelpers.randrange(rand, 1000)/1000.0 - 0.5 + pos.x,
|
RandomHelpers.randrange(rand, 1000)/1000.0 - 0.5 + pos.x,
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import projectzombie.display.Camera;
|
||||||
import projectzombie.entity.EntityParticle;
|
import projectzombie.entity.EntityParticle;
|
||||||
import projectzombie.settings.SettingQuality;
|
import projectzombie.settings.SettingQuality;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,11 @@ import projectzombie.display.Camera;
|
||||||
import projectzombie.entity.EntityParticle;
|
import projectzombie.entity.EntityParticle;
|
||||||
import projectzombie.settings.SettingQuality;
|
import projectzombie.settings.SettingQuality;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.math.MathHelpers;
|
import gl_engine.MathHelpers;
|
||||||
import projectzombie.util.math.random.RandomHelpers;
|
import projectzombie.util.math.random.RandomHelpers;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.util.math.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.util.math.vec.Vec3d;
|
import gl_engine.vec.Vec3d;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,17 +17,17 @@ import projectzombie.entity.EntityItem;
|
||||||
import projectzombie.entity.EntityVertical;
|
import projectzombie.entity.EntityVertical;
|
||||||
import projectzombie.entity.particle.ParticleBreak;
|
import projectzombie.entity.particle.ParticleBreak;
|
||||||
import projectzombie.init.Items;
|
import projectzombie.init.Items;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.inventory.Inventory;
|
import projectzombie.inventory.Inventory;
|
||||||
import projectzombie.menu.MenuDeath;
|
import projectzombie.menu.MenuDeath;
|
||||||
import projectzombie.settings.Cheats;
|
import projectzombie.settings.Cheats;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.gl.texture.TextureReference;
|
import projectzombie.util.gl.texture.TextureReference;
|
||||||
import projectzombie.util.math.ItemStack;
|
import projectzombie.util.math.ItemStack;
|
||||||
import projectzombie.util.math.MathHelpers;
|
import gl_engine.MathHelpers;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.util.math.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.util.math.vec.Vec3d;
|
import gl_engine.vec.Vec3d;
|
||||||
import projectzombie.world.World;
|
import projectzombie.world.World;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.chunk.ChunkEventHandler;
|
import projectzombie.world.chunk.ChunkEventHandler;
|
||||||
|
|
@ -42,8 +42,8 @@ public class EntityPlayer extends EntityVertical implements EntityAlive, EntityI
|
||||||
public boolean GUN = false;
|
public boolean GUN = false;
|
||||||
public boolean moving = false;
|
public boolean moving = false;
|
||||||
|
|
||||||
public TextureReference PLAYER_MOVING = Textures.ENTITY_PLAYER_B_W_MOVING;
|
public TextureReference PLAYER_MOVING = Models.ENTITY_PLAYER_B_W_MOVING;
|
||||||
public TextureReference PLAYER_STILL = Textures.ENTITY_PLAYER_B_W_STILL;
|
public TextureReference PLAYER_STILL = Models.ENTITY_PLAYER_B_W_STILL;
|
||||||
|
|
||||||
public double height = 0;
|
public double height = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,22 +10,8 @@ import projectzombie.util.gl.texture.TextureMap;
|
||||||
import projectzombie.util.gl.texture.TextureReference;
|
import projectzombie.util.gl.texture.TextureReference;
|
||||||
import projectzombie.util.gl.texture.TextureReferenceRandom;
|
import projectzombie.util.gl.texture.TextureReferenceRandom;
|
||||||
|
|
||||||
public class Textures
|
public class Models
|
||||||
{
|
{
|
||||||
public static void initTextures(DisplayWindow window)
|
|
||||||
{
|
|
||||||
// Make the context current
|
|
||||||
window.makeContextCurrent();
|
|
||||||
GL.createCapabilities();
|
|
||||||
|
|
||||||
// Initiaize all the textures
|
|
||||||
texmap.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final ArrayList<AnimationReference> animations = new ArrayList<AnimationReference>();
|
|
||||||
|
|
||||||
public static final TextureMap texmap = new TextureMap(16, Resources.TEXMAP_PNG);
|
|
||||||
|
|
||||||
public static final TextureReference TILE_GRASS = texmap.getTextureReference(0, 1, 0, 1);
|
public static final TextureReference TILE_GRASS = texmap.getTextureReference(0, 1, 0, 1);
|
||||||
public static final TextureReference TILE_SAND = texmap.getTextureReference(1, 2, 0, 1);
|
public static final TextureReference TILE_SAND = texmap.getTextureReference(1, 2, 0, 1);
|
||||||
public static final TextureReference TILE_STONE = texmap.getTextureReference(2, 3, 0, 1);
|
public static final TextureReference TILE_STONE = texmap.getTextureReference(2, 3, 0, 1);
|
||||||
|
|
@ -1,12 +1,14 @@
|
||||||
package projectzombie.init;
|
package projectzombie.init;
|
||||||
|
|
||||||
|
import gl_engine.texture.TextureAtlas3D;
|
||||||
import projectzombie.resources.Resource;
|
import projectzombie.resources.Resource;
|
||||||
|
|
||||||
public class Resources
|
public class Resources
|
||||||
{
|
{
|
||||||
public static void loadResources()
|
public static void loadResources()
|
||||||
{
|
{
|
||||||
TEXMAP_PNG.load();
|
ATLAS = TextureAtlas3D.loadAll("/resources/texture/list.txt");
|
||||||
|
ATLAS.generate();
|
||||||
|
|
||||||
GUN_OGG_0.load();
|
GUN_OGG_0.load();
|
||||||
GUN_OGG_1.load();
|
GUN_OGG_1.load();
|
||||||
|
|
@ -26,7 +28,7 @@ public class Resources
|
||||||
EXPLOSION_OGG.load();
|
EXPLOSION_OGG.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Resource TEXMAP_PNG = new Resource("texmap.png");
|
public static TextureAtlas3D ATLAS;
|
||||||
|
|
||||||
public static final Resource GUN_OGG_0 = new Resource("sound/gun0.ogg");
|
public static final Resource GUN_OGG_0 = new Resource("sound/gun0.ogg");
|
||||||
public static final Resource GUN_OGG_1 = new Resource("sound/gun1.ogg");
|
public static final Resource GUN_OGG_1 = new Resource("sound/gun1.ogg");
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import org.lwjgl.glfw.GLFW;
|
||||||
import org.lwjgl.glfw.GLFWCursorPosCallbackI;
|
import org.lwjgl.glfw.GLFWCursorPosCallbackI;
|
||||||
|
|
||||||
import projectzombie.Main;
|
import projectzombie.Main;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
|
|
||||||
public class CursorPosCallback implements GLFWCursorPosCallbackI
|
public class CursorPosCallback implements GLFWCursorPosCallbackI
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ import org.lwjgl.glfw.GLFWKeyCallbackI;
|
||||||
import mainloop.task.IMainloopTask;
|
import mainloop.task.IMainloopTask;
|
||||||
import projectzombie.Main;
|
import projectzombie.Main;
|
||||||
import projectzombie.input.types.Input;
|
import projectzombie.input.types.Input;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
|
|
||||||
public class KeyCallback implements GLFWKeyCallbackI, IMainloopTask
|
public class KeyCallback implements GLFWKeyCallbackI, IMainloopTask
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package projectzombie.input.types;
|
package projectzombie.input.types;
|
||||||
|
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
|
|
||||||
public interface Input
|
public interface Input
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package projectzombie.input.types;
|
package projectzombie.input.types;
|
||||||
|
|
||||||
import projectzombie.menu.gui.GUI;
|
import projectzombie.menu.gui.GUI;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
|
|
||||||
public class InputGUI implements Input
|
public class InputGUI implements Input
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ package projectzombie.input.types;
|
||||||
|
|
||||||
import projectzombie.Main;
|
import projectzombie.Main;
|
||||||
import projectzombie.menu.MenuGamePause;
|
import projectzombie.menu.MenuGamePause;
|
||||||
import projectzombie.util.math.MathHelpers;
|
import gl_engine.MathHelpers;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.world.chunk.ChunkEventHandler;
|
import projectzombie.world.chunk.ChunkEventHandler;
|
||||||
|
|
||||||
public class InputGame implements Input
|
public class InputGame implements Input
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import projectzombie.inventory.Inventory;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.gl.texture.TextureReference;
|
import projectzombie.util.gl.texture.TextureReference;
|
||||||
import projectzombie.util.math.ItemStack;
|
import projectzombie.util.math.ItemStack;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package projectzombie.items;
|
||||||
|
|
||||||
import projectzombie.entity.Entity;
|
import projectzombie.entity.Entity;
|
||||||
import projectzombie.entity.player.EntityPlayer;
|
import projectzombie.entity.player.EntityPlayer;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.util.math.ItemStack;
|
import projectzombie.util.math.ItemStack;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
@ -12,7 +12,7 @@ public class ItemAmmo extends Item
|
||||||
|
|
||||||
public ItemAmmo() {
|
public ItemAmmo() {
|
||||||
|
|
||||||
this.texture = Textures.ITEM_AMMO_BOX;
|
this.texture = Models.ITEM_AMMO_BOX;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package projectzombie.items;
|
||||||
|
|
||||||
import projectzombie.Main;
|
import projectzombie.Main;
|
||||||
import projectzombie.entity.player.EntityPlayer;
|
import projectzombie.entity.player.EntityPlayer;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.util.math.ItemStack;
|
import projectzombie.util.math.ItemStack;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
@ -12,7 +12,7 @@ public class ItemDefenceUpgrade extends Item
|
||||||
|
|
||||||
public ItemDefenceUpgrade() {
|
public ItemDefenceUpgrade() {
|
||||||
|
|
||||||
this.texture = Textures.ITEM_DEFENCE_UPGRADE;
|
this.texture = Models.ITEM_DEFENCE_UPGRADE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package projectzombie.items;
|
||||||
import projectzombie.entity.Entity;
|
import projectzombie.entity.Entity;
|
||||||
import projectzombie.entity.player.EntityPlayer;
|
import projectzombie.entity.player.EntityPlayer;
|
||||||
import projectzombie.util.math.ItemStack;
|
import projectzombie.util.math.ItemStack;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package projectzombie.items;
|
||||||
|
|
||||||
import projectzombie.entity.EntityFlare;
|
import projectzombie.entity.EntityFlare;
|
||||||
import projectzombie.entity.player.EntityPlayer;
|
import projectzombie.entity.player.EntityPlayer;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.util.math.ItemStack;
|
import projectzombie.util.math.ItemStack;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
@ -12,7 +12,7 @@ public class ItemFlare extends Item
|
||||||
|
|
||||||
public ItemFlare() {
|
public ItemFlare() {
|
||||||
|
|
||||||
this.texture = Textures.ENTITY_FLARE;
|
this.texture = Models.ENTITY_FLARE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,10 @@ package projectzombie.items;
|
||||||
|
|
||||||
import projectzombie.entity.EntityGrapplingHook;
|
import projectzombie.entity.EntityGrapplingHook;
|
||||||
import projectzombie.entity.player.EntityPlayer;
|
import projectzombie.entity.player.EntityPlayer;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.util.math.ItemStack;
|
import projectzombie.util.math.ItemStack;
|
||||||
import projectzombie.util.math.MathHelpers;
|
import gl_engine.MathHelpers;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
|
|
@ -14,7 +14,7 @@ public class ItemGrapplingHook extends Item
|
||||||
|
|
||||||
public ItemGrapplingHook() {
|
public ItemGrapplingHook() {
|
||||||
|
|
||||||
this.texture = Textures.ITEM_GRAPPLING_HOOK;
|
this.texture = Models.ITEM_GRAPPLING_HOOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package projectzombie.items;
|
||||||
|
|
||||||
import projectzombie.Main;
|
import projectzombie.Main;
|
||||||
import projectzombie.entity.player.EntityPlayer;
|
import projectzombie.entity.player.EntityPlayer;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.util.math.ItemStack;
|
import projectzombie.util.math.ItemStack;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
@ -12,7 +12,7 @@ public class ItemGunUpgrade extends Item
|
||||||
|
|
||||||
public ItemGunUpgrade() {
|
public ItemGunUpgrade() {
|
||||||
|
|
||||||
this.texture = Textures.ITEM_GUN_UPGRADE;
|
this.texture = Models.ITEM_GUN_UPGRADE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package projectzombie.items;
|
package projectzombie.items;
|
||||||
|
|
||||||
import projectzombie.entity.player.EntityPlayer;
|
import projectzombie.entity.player.EntityPlayer;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.util.math.ItemStack;
|
import projectzombie.util.math.ItemStack;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
@ -11,7 +11,7 @@ public class ItemHealthPotion extends Item
|
||||||
|
|
||||||
public ItemHealthPotion() {
|
public ItemHealthPotion() {
|
||||||
|
|
||||||
this.texture = Textures.ITEM_HEALTH_POTION;
|
this.texture = Models.ITEM_HEALTH_POTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
package projectzombie.items;
|
package projectzombie.items;
|
||||||
|
|
||||||
import projectzombie.entity.player.EntityPlayer;
|
import projectzombie.entity.player.EntityPlayer;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.init.Tiles;
|
import projectzombie.init.Tiles;
|
||||||
import projectzombie.util.math.ItemStack;
|
import projectzombie.util.math.ItemStack;
|
||||||
import projectzombie.util.math.MathHelpers;
|
import gl_engine.MathHelpers;
|
||||||
import projectzombie.util.math.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
|
|
@ -14,7 +14,7 @@ public class ItemLantern extends Item
|
||||||
|
|
||||||
public ItemLantern() {
|
public ItemLantern() {
|
||||||
|
|
||||||
this.texture = Textures.TILE_LANTERN;
|
this.texture = Models.TILE_LANTERN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package projectzombie.items;
|
package projectzombie.items;
|
||||||
|
|
||||||
import projectzombie.entity.player.EntityPlayer;
|
import projectzombie.entity.player.EntityPlayer;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.util.math.ItemStack;
|
import projectzombie.util.math.ItemStack;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
@ -11,7 +11,7 @@ public class ItemRock extends Item
|
||||||
|
|
||||||
public ItemRock() {
|
public ItemRock() {
|
||||||
|
|
||||||
this.texture = Textures.TILE_ROCK;
|
this.texture = Models.TILE_ROCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package projectzombie.items;
|
||||||
|
|
||||||
import projectzombie.entity.player.EntityPlayer;
|
import projectzombie.entity.player.EntityPlayer;
|
||||||
import projectzombie.util.math.ItemStack;
|
import projectzombie.util.math.ItemStack;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package projectzombie.items;
|
||||||
|
|
||||||
import projectzombie.entity.EntityTnt;
|
import projectzombie.entity.EntityTnt;
|
||||||
import projectzombie.entity.player.EntityPlayer;
|
import projectzombie.entity.player.EntityPlayer;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.util.math.ItemStack;
|
import projectzombie.util.math.ItemStack;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
@ -12,7 +12,7 @@ public class ItemTnt extends Item
|
||||||
|
|
||||||
public ItemTnt() {
|
public ItemTnt() {
|
||||||
|
|
||||||
this.texture = Textures.ENTITY_TNT;
|
this.texture = Models.ENTITY_TNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
package projectzombie.items.spawner;
|
package projectzombie.items.spawner;
|
||||||
|
|
||||||
import projectzombie.entity.EntityZombie;
|
import projectzombie.entity.EntityZombie;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.items.ItemSpawn;
|
import projectzombie.items.ItemSpawn;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
|
|
@ -12,7 +12,7 @@ public class ItemSpawnZombie extends ItemSpawn
|
||||||
|
|
||||||
public ItemSpawnZombie() {
|
public ItemSpawnZombie() {
|
||||||
|
|
||||||
this.texture = Textures.ENTITY_ZOMBIE_B;
|
this.texture = Models.ENTITY_ZOMBIE_B;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ import projectzombie.menu.gui.components.ButtonSetting;
|
||||||
import projectzombie.menu.gui.components.GUIBackToMenu;
|
import projectzombie.menu.gui.components.GUIBackToMenu;
|
||||||
import projectzombie.menu.gui.components.OverlayBackground;
|
import projectzombie.menu.gui.components.OverlayBackground;
|
||||||
import projectzombie.settings.SettingQuality;
|
import projectzombie.settings.SettingQuality;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
|
|
||||||
public class MenuSettings extends Menu
|
public class MenuSettings extends Menu
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
package projectzombie.menu.gui;
|
package projectzombie.menu.gui;
|
||||||
|
|
||||||
import projectzombie.Main;
|
import projectzombie.Main;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.input.InputMode;
|
import projectzombie.input.InputMode;
|
||||||
import projectzombie.text.Text;
|
import projectzombie.text.Text;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.gl.texture.TextureReference;
|
import projectzombie.util.gl.texture.TextureReference;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
|
|
||||||
public class Button implements GUIComponent, GUISelectable
|
public class Button implements GUIComponent, GUISelectable
|
||||||
{
|
{
|
||||||
|
|
@ -66,9 +66,9 @@ public class Button implements GUIComponent, GUISelectable
|
||||||
TextureReference tex;
|
TextureReference tex;
|
||||||
boolean mouseHover = InputMode.Controller ? this.selected : this.checkMouseHover(mousePos);
|
boolean mouseHover = InputMode.Controller ? this.selected : this.checkMouseHover(mousePos);
|
||||||
if(mouseHover) {
|
if(mouseHover) {
|
||||||
tex = Textures.BUTTON_HOVER;
|
tex = Models.BUTTON_HOVER;
|
||||||
} else {
|
} else {
|
||||||
tex = Textures.BUTTON;
|
tex = Models.BUTTON;
|
||||||
}
|
}
|
||||||
|
|
||||||
GlHelpers.color4(1, 1, 1, 1);
|
GlHelpers.color4(1, 1, 1, 1);
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package projectzombie.menu.gui;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
|
|
||||||
public class ButtonGroup implements GUIContainer
|
public class ButtonGroup implements GUIContainer
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package projectzombie.menu.gui;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
|
|
||||||
public class GUI implements GUIContainer
|
public class GUI implements GUIContainer
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package projectzombie.menu.gui;
|
package projectzombie.menu.gui;
|
||||||
|
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
|
|
||||||
public interface GUIComponent
|
public interface GUIComponent
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ package projectzombie.menu.gui;
|
||||||
|
|
||||||
import projectzombie.text.Text;
|
import projectzombie.text.Text;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.util.math.vec.Vec3d;
|
import gl_engine.vec.Vec3d;
|
||||||
|
|
||||||
public class Label implements GUIComponent
|
public class Label implements GUIComponent
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
package projectzombie.menu.gui;
|
package projectzombie.menu.gui;
|
||||||
|
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.util.math.vec.Vec3d;
|
import gl_engine.vec.Vec3d;
|
||||||
import projectzombie.util.math.vec.Vec4d;
|
import gl_engine.vec.Vec4d;
|
||||||
|
|
||||||
public class Overlay implements GUIComponent
|
public class Overlay implements GUIComponent
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package projectzombie.menu.gui.components;
|
package projectzombie.menu.gui.components;
|
||||||
|
|
||||||
import projectzombie.menu.gui.Button;
|
import projectzombie.menu.gui.Button;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
|
|
||||||
public class ButtonBasic extends Button {
|
public class ButtonBasic extends Button {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import projectzombie.Main;
|
||||||
import projectzombie.menu.MenuMain;
|
import projectzombie.menu.MenuMain;
|
||||||
import projectzombie.menu.MenuSettings;
|
import projectzombie.menu.MenuSettings;
|
||||||
import projectzombie.menu.gui.ButtonGroup;
|
import projectzombie.menu.gui.ButtonGroup;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
|
|
||||||
public class ButtonGroupPause extends ButtonGroup
|
public class ButtonGroupPause extends ButtonGroup
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package projectzombie.menu.gui.components;
|
||||||
|
|
||||||
import projectzombie.menu.gui.Alignment;
|
import projectzombie.menu.gui.Alignment;
|
||||||
import projectzombie.settings.Settings;
|
import projectzombie.settings.Settings;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
|
|
||||||
public class ButtonSetting extends ButtonBasic
|
public class ButtonSetting extends ButtonBasic
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package projectzombie.menu.gui.components;
|
package projectzombie.menu.gui.components;
|
||||||
|
|
||||||
import projectzombie.menu.gui.Label;
|
import projectzombie.menu.gui.Label;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
|
|
||||||
public class LabelMain extends Label
|
public class LabelMain extends Label
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package projectzombie.menu.gui.components;
|
package projectzombie.menu.gui.components;
|
||||||
|
|
||||||
import projectzombie.menu.gui.Label;
|
import projectzombie.menu.gui.Label;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
|
|
||||||
public class LabelPause extends Label
|
public class LabelPause extends Label
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package projectzombie.menu.gui.components;
|
package projectzombie.menu.gui.components;
|
||||||
|
|
||||||
import projectzombie.menu.gui.Overlay;
|
import projectzombie.menu.gui.Overlay;
|
||||||
import projectzombie.util.math.vec.Vec4d;
|
import gl_engine.vec.Vec4d;
|
||||||
|
|
||||||
public class OverlayBackground extends Overlay
|
public class OverlayBackground extends Overlay
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
package projectzombie.model;
|
||||||
|
|
||||||
|
import gl_engine.MathHelpers;
|
||||||
|
import gl_engine.texture.TextureRef3D;
|
||||||
|
|
||||||
|
import static org.lwjgl.opengl.GL33.*;
|
||||||
|
|
||||||
|
public abstract class Model
|
||||||
|
{
|
||||||
|
int vao, size;
|
||||||
|
boolean loaded = false;
|
||||||
|
private static final int SIZE = 7;
|
||||||
|
|
||||||
|
public int getSize() {
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
// px, py, pz, tx, ty
|
||||||
|
protected abstract float[] getVerticies();
|
||||||
|
protected abstract TextureRef3D[] getTextures();
|
||||||
|
|
||||||
|
public void bind()
|
||||||
|
{
|
||||||
|
if(loaded) {
|
||||||
|
glBindVertexArray(vao);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float[] verticies = this.getVerticies();
|
||||||
|
TextureRef3D[] refs = this.getTextures();
|
||||||
|
|
||||||
|
if(verticies.length % SIZE != 0 || refs.length * 3 != verticies.length / SIZE) {
|
||||||
|
System.err.println("Invalid model");
|
||||||
|
System.exit(1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
size = verticies.length/SIZE;
|
||||||
|
double k = 0.001;
|
||||||
|
|
||||||
|
for(int i=0;i<size;i++) {
|
||||||
|
TextureRef3D ref = refs[i / 3];
|
||||||
|
verticies[i*SIZE + 3] = (float)MathHelpers.map(verticies[i*SIZE + 3], 0-k, 1+k, ref.sx, ref.ex);
|
||||||
|
verticies[i*SIZE + 4] = (float)MathHelpers.map(verticies[i*SIZE + 4], 0-k, 1+k, ref.sy, ref.ey);
|
||||||
|
verticies[i*SIZE + 5] = ref.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
vao = glGenVertexArrays();
|
||||||
|
glBindVertexArray(vao);
|
||||||
|
|
||||||
|
int vbo = glGenBuffers();
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
||||||
|
glBufferData(GL_ARRAY_BUFFER, verticies, GL_STATIC_DRAW);
|
||||||
|
|
||||||
|
glVertexAttribPointer(0, 3, GL_FLOAT, false, Float.BYTES * SIZE, 0);
|
||||||
|
glEnableVertexAttribArray(0);
|
||||||
|
|
||||||
|
glVertexAttribPointer(1, 4, GL_FLOAT, false, Float.BYTES * SIZE, Float.BYTES * 3);
|
||||||
|
glEnableVertexAttribArray(1);
|
||||||
|
|
||||||
|
loaded = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
package projectzombie.model;
|
||||||
|
|
||||||
|
import gl_engine.texture.TextureRef3D;
|
||||||
|
|
||||||
|
public class ModelChar extends Model
|
||||||
|
{
|
||||||
|
private TextureRef3D ref;
|
||||||
|
|
||||||
|
public ModelChar(TextureRef3D ref) {
|
||||||
|
this.ref = ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected float[] getVerticies() {
|
||||||
|
return new float[] {
|
||||||
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
|
1, 0, 0, 1, 0, 0, 0,
|
||||||
|
1, 1, 0, 1, 1, 0, 0,
|
||||||
|
|
||||||
|
1, 1, 0, 1, 1, 0, 0,
|
||||||
|
0, 1, 0, 0, 1, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected TextureRef3D[] getTextures() {
|
||||||
|
return new TextureRef3D[] {ref, ref};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
package projectzombie.model;
|
||||||
|
|
||||||
|
import gl_engine.texture.TextureRef3D;
|
||||||
|
|
||||||
|
public abstract class ModelTile extends Model
|
||||||
|
{
|
||||||
|
private TextureRef3D tex;
|
||||||
|
|
||||||
|
public ModelTile(TextureRef3D tex) {
|
||||||
|
this.tex = tex;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected float[] getVerticies()
|
||||||
|
{
|
||||||
|
return new float[] {
|
||||||
|
1, 0, 1, 1, 1, 0, 0,
|
||||||
|
1, 0, 0, 1, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
|
|
||||||
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 1, 0, 1, 0, 0,
|
||||||
|
1, 0, 1, 1, 1, 0, 0,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected TextureRef3D[] getTextures()
|
||||||
|
{
|
||||||
|
return new TextureRef3D[] {
|
||||||
|
tex, tex
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
package projectzombie.model;
|
||||||
|
|
||||||
|
import gl_engine.texture.TextureRef3D;
|
||||||
|
import gl_engine.vec.Vec2d;
|
||||||
|
|
||||||
|
public abstract class ModelVertical extends Model
|
||||||
|
{
|
||||||
|
private TextureRef3D tex;
|
||||||
|
private Vec2d size;
|
||||||
|
|
||||||
|
public ModelVertical(TextureRef3D tex, Vec2d size) {
|
||||||
|
this.tex = tex;
|
||||||
|
this.size = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ModelVertical(TextureRef3D tex) {
|
||||||
|
this(tex, new Vec2d(1, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected float[] getVerticies()
|
||||||
|
{
|
||||||
|
float x = (float)size.x / 2;
|
||||||
|
float y = (float)size.y;
|
||||||
|
|
||||||
|
return new float[] {
|
||||||
|
0.5f-x, 0, 0.5f, 0, 0, 0, 1,
|
||||||
|
0.5f+x, 0, 0.5f, 1, 0, 0, 1,
|
||||||
|
0.5f+x, y, 0.5f, 1, 1, 0, 1,
|
||||||
|
|
||||||
|
0.5f+x, y, 0.5f, 1, 1, 0, 1,
|
||||||
|
0.5f-x, y, 0.5f, 0, 1, 0, 1,
|
||||||
|
0.5f-x, 0, 0.5f, 0, 0, 0, 1,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected TextureRef3D[] getTextures()
|
||||||
|
{
|
||||||
|
return new TextureRef3D[] {
|
||||||
|
tex, tex
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,95 +1,98 @@
|
||||||
package projectzombie.text;
|
package projectzombie.text;
|
||||||
|
|
||||||
import projectzombie.Main;
|
import projectzombie.Main;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.init.Resources;
|
||||||
|
import projectzombie.model.Model;
|
||||||
|
import projectzombie.model.ModelChar;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.gl.texture.TextureReference;
|
import projectzombie.util.gl.texture.TextureReference;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
|
|
||||||
public class Text
|
public class Text
|
||||||
{
|
{
|
||||||
public static final TextureReference CHAR_A = Textures.texmap.getTextureReference(5, 6, 0, 1);
|
public static final Model CHAR_A = new ModelChar(Resources.ATLAS.get("/char/char_u_a.png"));
|
||||||
public static final TextureReference CHAR_B = Textures.texmap.getTextureReference(6, 7, 0, 1);
|
public static final Model CHAR_B = new ModelChar(Resources.ATLAS.get("/char/char_u_b.png"));
|
||||||
public static final TextureReference CHAR_C = Textures.texmap.getTextureReference(7, 8, 0, 1);
|
public static final Model CHAR_C = new ModelChar(Resources.ATLAS.get("/char/char_u_c.png"));
|
||||||
public static final TextureReference CHAR_D = Textures.texmap.getTextureReference(8, 9, 0, 1);
|
public static final Model CHAR_D = new ModelChar(Resources.ATLAS.get("/char/char_u_d.png"));
|
||||||
public static final TextureReference CHAR_E = Textures.texmap.getTextureReference(9, 10, 0, 1);
|
public static final Model CHAR_E = new ModelChar(Resources.ATLAS.get("/char/char_u_e.png"));
|
||||||
public static final TextureReference CHAR_F = Textures.texmap.getTextureReference(10, 11, 0, 1);
|
public static final Model CHAR_F = new ModelChar(Resources.ATLAS.get("/char/char_u_f.png"));
|
||||||
public static final TextureReference CHAR_G = Textures.texmap.getTextureReference(11, 12, 0, 1);
|
public static final Model CHAR_G = new ModelChar(Resources.ATLAS.get("/char/char_u_g.png"));
|
||||||
public static final TextureReference CHAR_H = Textures.texmap.getTextureReference(12, 13, 0, 1);
|
public static final Model CHAR_H = new ModelChar(Resources.ATLAS.get("/char/char_u_h.png"));
|
||||||
public static final TextureReference CHAR_I = Textures.texmap.getTextureReference(13, 14, 0, 1);
|
public static final Model CHAR_I = new ModelChar(Resources.ATLAS.get("/char/char_u_i.png"));
|
||||||
public static final TextureReference CHAR_J = Textures.texmap.getTextureReference(14, 15, 0, 1);
|
public static final Model CHAR_J = new ModelChar(Resources.ATLAS.get("/char/char_u_j.png"));
|
||||||
public static final TextureReference CHAR_K = Textures.texmap.getTextureReference(15, 16, 0, 1);
|
public static final Model CHAR_K = new ModelChar(Resources.ATLAS.get("/char/char_u_k.png"));
|
||||||
public static final TextureReference CHAR_L = Textures.texmap.getTextureReference(5, 6, 1, 2);
|
public static final Model CHAR_L = new ModelChar(Resources.ATLAS.get("/char/char_u_l.png"));
|
||||||
public static final TextureReference CHAR_M = Textures.texmap.getTextureReference(6, 7, 1, 2);
|
public static final Model CHAR_M = new ModelChar(Resources.ATLAS.get("/char/char_u_m.png"));
|
||||||
public static final TextureReference CHAR_N = Textures.texmap.getTextureReference(7, 8, 1, 2);
|
public static final Model CHAR_N = new ModelChar(Resources.ATLAS.get("/char/char_u_n.png"));
|
||||||
public static final TextureReference CHAR_O = Textures.texmap.getTextureReference(8, 9, 1, 2);
|
public static final Model CHAR_O = new ModelChar(Resources.ATLAS.get("/char/char_u_o.png"));
|
||||||
public static final TextureReference CHAR_P = Textures.texmap.getTextureReference(9, 10, 1, 2);
|
public static final Model CHAR_P = new ModelChar(Resources.ATLAS.get("/char/char_u_p.png"));
|
||||||
public static final TextureReference CHAR_Q = Textures.texmap.getTextureReference(10, 11, 1, 2);
|
public static final Model CHAR_Q = new ModelChar(Resources.ATLAS.get("/char/char_u_q.png"));
|
||||||
public static final TextureReference CHAR_R = Textures.texmap.getTextureReference(11, 12, 1, 2);
|
public static final Model CHAR_R = new ModelChar(Resources.ATLAS.get("/char/char_u_r.png"));
|
||||||
public static final TextureReference CHAR_S = Textures.texmap.getTextureReference(12, 13, 1, 2);
|
public static final Model CHAR_S = new ModelChar(Resources.ATLAS.get("/char/char_u_s.png"));
|
||||||
public static final TextureReference CHAR_T = Textures.texmap.getTextureReference(13, 14, 1, 2);
|
public static final Model CHAR_T = new ModelChar(Resources.ATLAS.get("/char/char_u_t.png"));
|
||||||
public static final TextureReference CHAR_U = Textures.texmap.getTextureReference(14, 15, 1, 2);
|
public static final Model CHAR_U = new ModelChar(Resources.ATLAS.get("/char/char_u_u.png"));
|
||||||
public static final TextureReference CHAR_V = Textures.texmap.getTextureReference(15, 16, 1, 2);
|
public static final Model CHAR_V = new ModelChar(Resources.ATLAS.get("/char/char_u_v.png"));
|
||||||
public static final TextureReference CHAR_W = Textures.texmap.getTextureReference(5, 6, 2, 3);
|
public static final Model CHAR_W = new ModelChar(Resources.ATLAS.get("/char/char_u_w.png"));
|
||||||
public static final TextureReference CHAR_X = Textures.texmap.getTextureReference(6, 7, 2, 3);
|
public static final Model CHAR_X = new ModelChar(Resources.ATLAS.get("/char/char_u_x.png"));
|
||||||
public static final TextureReference CHAR_Y = Textures.texmap.getTextureReference(7, 8, 2, 3);
|
public static final Model CHAR_Y = new ModelChar(Resources.ATLAS.get("/char/char_u_y.png"));
|
||||||
public static final TextureReference CHAR_Z = Textures.texmap.getTextureReference(8, 9, 2, 3);
|
public static final Model CHAR_Z = new ModelChar(Resources.ATLAS.get("/char/char_u_z.png"));
|
||||||
public static final TextureReference CHAR_a = Textures.texmap.getTextureReference(9, 10, 2, 3);
|
public static final Model CHAR_a = new ModelChar(Resources.ATLAS.get("/char/char_l_a.png"));
|
||||||
public static final TextureReference CHAR_b = Textures.texmap.getTextureReference(10, 11, 2, 3);
|
public static final Model CHAR_b = new ModelChar(Resources.ATLAS.get("/char/char_l_b.png"));
|
||||||
public static final TextureReference CHAR_c = Textures.texmap.getTextureReference(11, 12, 2, 3);
|
public static final Model CHAR_c = new ModelChar(Resources.ATLAS.get("/char/char_l_c.png"));
|
||||||
public static final TextureReference CHAR_d = Textures.texmap.getTextureReference(12, 13, 2, 3);
|
public static final Model CHAR_d = new ModelChar(Resources.ATLAS.get("/char/char_l_d.png"));
|
||||||
public static final TextureReference CHAR_e = Textures.texmap.getTextureReference(13, 14, 2, 3);
|
public static final Model CHAR_e = new ModelChar(Resources.ATLAS.get("/char/char_l_e.png"));
|
||||||
public static final TextureReference CHAR_f = Textures.texmap.getTextureReference(14, 15, 2, 3);
|
public static final Model CHAR_f = new ModelChar(Resources.ATLAS.get("/char/char_l_f.png"));
|
||||||
public static final TextureReference CHAR_g = Textures.texmap.getTextureReference(15, 16, 2, 3);
|
public static final Model CHAR_g = new ModelChar(Resources.ATLAS.get("/char/char_l_g.png"));
|
||||||
public static final TextureReference CHAR_h = Textures.texmap.getTextureReference(5, 6, 3, 4);
|
public static final Model CHAR_i = new ModelChar(Resources.ATLAS.get("/char/char_l_h.png"));
|
||||||
public static final TextureReference CHAR_i = Textures.texmap.getTextureReference(6, 7, 3, 4);
|
public static final Model CHAR_h = new ModelChar(Resources.ATLAS.get("/char/char_l_i.png"));
|
||||||
public static final TextureReference CHAR_j = Textures.texmap.getTextureReference(7, 8, 3, 4);
|
public static final Model CHAR_j = new ModelChar(Resources.ATLAS.get("/char/char_l_j.png"));
|
||||||
public static final TextureReference CHAR_k = Textures.texmap.getTextureReference(8, 9, 3, 4);
|
public static final Model CHAR_k = new ModelChar(Resources.ATLAS.get("/char/char_l_k.png"));
|
||||||
public static final TextureReference CHAR_l = Textures.texmap.getTextureReference(9, 10, 3, 4);
|
public static final Model CHAR_l = new ModelChar(Resources.ATLAS.get("/char/char_l_l.png"));
|
||||||
public static final TextureReference CHAR_m = Textures.texmap.getTextureReference(10, 11, 3, 4);
|
public static final Model CHAR_m = new ModelChar(Resources.ATLAS.get("/char/char_l_m.png"));
|
||||||
public static final TextureReference CHAR_n = Textures.texmap.getTextureReference(11, 12, 3, 4);
|
public static final Model CHAR_n = new ModelChar(Resources.ATLAS.get("/char/char_l_n.png"));
|
||||||
public static final TextureReference CHAR_o = Textures.texmap.getTextureReference(12, 13, 3, 4);
|
public static final Model CHAR_o = new ModelChar(Resources.ATLAS.get("/char/char_l_o.png"));
|
||||||
public static final TextureReference CHAR_p = Textures.texmap.getTextureReference(13, 14, 3, 4);
|
public static final Model CHAR_p = new ModelChar(Resources.ATLAS.get("/char/char_l_p.png"));
|
||||||
public static final TextureReference CHAR_q = Textures.texmap.getTextureReference(14, 15, 3, 4);
|
public static final Model CHAR_q = new ModelChar(Resources.ATLAS.get("/char/char_l_q.png"));
|
||||||
public static final TextureReference CHAR_r = Textures.texmap.getTextureReference(15, 16, 3, 4);
|
public static final Model CHAR_r = new ModelChar(Resources.ATLAS.get("/char/char_l_r.png"));
|
||||||
public static final TextureReference CHAR_s = Textures.texmap.getTextureReference(5, 6, 4, 5);
|
public static final Model CHAR_s = new ModelChar(Resources.ATLAS.get("/char/char_l_s.png"));
|
||||||
public static final TextureReference CHAR_t = Textures.texmap.getTextureReference(6, 7, 4, 5);
|
public static final Model CHAR_t = new ModelChar(Resources.ATLAS.get("/char/char_l_t.png"));
|
||||||
public static final TextureReference CHAR_u = Textures.texmap.getTextureReference(7, 8, 4, 5);
|
public static final Model CHAR_u = new ModelChar(Resources.ATLAS.get("/char/char_l_u.png"));
|
||||||
public static final TextureReference CHAR_v = Textures.texmap.getTextureReference(8, 9, 4, 5);
|
public static final Model CHAR_v = new ModelChar(Resources.ATLAS.get("/char/char_l_v.png"));
|
||||||
public static final TextureReference CHAR_w = Textures.texmap.getTextureReference(9, 10, 4, 5);
|
public static final Model CHAR_w = new ModelChar(Resources.ATLAS.get("/char/char_l_w.png"));
|
||||||
public static final TextureReference CHAR_x = Textures.texmap.getTextureReference(10, 11, 4, 5);
|
public static final Model CHAR_x = new ModelChar(Resources.ATLAS.get("/char/char_l_x.png"));
|
||||||
public static final TextureReference CHAR_y = Textures.texmap.getTextureReference(11, 12, 4, 5);
|
public static final Model CHAR_y = new ModelChar(Resources.ATLAS.get("/char/char_l_y.png"));
|
||||||
public static final TextureReference CHAR_z = Textures.texmap.getTextureReference(12, 13, 4, 5);
|
public static final Model CHAR_z = new ModelChar(Resources.ATLAS.get("/char/char_l_z.png"));
|
||||||
public static final TextureReference CHAR_0 = Textures.texmap.getTextureReference(13, 14, 4, 5);
|
public static final Model CHAR_0 = new ModelChar(Resources.ATLAS.get("/char/char_0.png"));
|
||||||
public static final TextureReference CHAR_1 = Textures.texmap.getTextureReference(14, 15, 4, 5);
|
public static final Model CHAR_1 = new ModelChar(Resources.ATLAS.get("/char/char_1.png"));
|
||||||
public static final TextureReference CHAR_2 = Textures.texmap.getTextureReference(15, 16, 4, 5);
|
public static final Model CHAR_2 = new ModelChar(Resources.ATLAS.get("/char/char_2.png"));
|
||||||
public static final TextureReference CHAR_3 = Textures.texmap.getTextureReference(5, 6, 5, 6);
|
public static final Model CHAR_3 = new ModelChar(Resources.ATLAS.get("/char/char_3.png"));
|
||||||
public static final TextureReference CHAR_4 = Textures.texmap.getTextureReference(6, 7, 5, 6);
|
public static final Model CHAR_4 = new ModelChar(Resources.ATLAS.get("/char/char_4.png"));
|
||||||
public static final TextureReference CHAR_5 = Textures.texmap.getTextureReference(7, 8, 5, 6);
|
public static final Model CHAR_5 = new ModelChar(Resources.ATLAS.get("/char/char_5.png"));
|
||||||
public static final TextureReference CHAR_6 = Textures.texmap.getTextureReference(8, 9, 5, 6);
|
public static final Model CHAR_6 = new ModelChar(Resources.ATLAS.get("/char/char_6.png"));
|
||||||
public static final TextureReference CHAR_7 = Textures.texmap.getTextureReference(9, 10, 5, 6);
|
public static final Model CHAR_7 = new ModelChar(Resources.ATLAS.get("/char/char_7.png"));
|
||||||
public static final TextureReference CHAR_8 = Textures.texmap.getTextureReference(10, 11, 5, 6);
|
public static final Model CHAR_8 = new ModelChar(Resources.ATLAS.get("/char/char_8.png"));
|
||||||
public static final TextureReference CHAR_9 = Textures.texmap.getTextureReference(11, 12, 5, 6);
|
public static final Model CHAR_9 = new ModelChar(Resources.ATLAS.get("/char/char_9.png"));
|
||||||
public static final TextureReference CHAR_PEROID = Textures.texmap.getTextureReference(12, 13, 5, 6);
|
public static final Model CHAR_FULLSTOP = new ModelChar(Resources.ATLAS.get("/char/char_fullstop.png"));
|
||||||
public static final TextureReference CHAR_COLON = Textures.texmap.getTextureReference(13, 14, 5, 6);
|
public static final Model CHAR_COLON = new ModelChar(Resources.ATLAS.get("/char/char_colon.png"));
|
||||||
public static final TextureReference CHAR_COMMA = Textures.texmap.getTextureReference(14, 15, 5, 6);
|
public static final Model CHAR_COMMA = new ModelChar(Resources.ATLAS.get("/char/char_comma.png"));
|
||||||
public static final TextureReference CHAR_EXMARK = Textures.texmap.getTextureReference(15, 16, 5, 6);
|
public static final Model CHAR_EXMARK = new ModelChar(Resources.ATLAS.get("/char/char_exclamation.png"));
|
||||||
public static final TextureReference CHAR_MINUS = Textures.texmap.getTextureReference(0, 1, 10, 11);
|
public static final Model CHAR_MINUS = new ModelChar(Resources.ATLAS.get("/char/char_minus.png"));
|
||||||
public static final TextureReference CHAR_PLUS = Textures.texmap.getTextureReference(1, 2, 10, 11);
|
public static final Model CHAR_PLUS = new ModelChar(Resources.ATLAS.get("/char/char_plus.png"));
|
||||||
public static final TextureReference CHAR_FSLASH = Textures.texmap.getTextureReference(2, 3, 10, 11);
|
public static final Model CHAR_F_SLASH = new ModelChar(Resources.ATLAS.get("/char/char_fslash.png"));
|
||||||
public static final TextureReference CHAR_BSLASH = Textures.texmap.getTextureReference(3, 4, 10, 11);
|
public static final Model CHAR_B_SLASH = new ModelChar(Resources.ATLAS.get("/char/char_bslash.png"));
|
||||||
public static final TextureReference CHAR_EQUALS = Textures.texmap.getTextureReference(4, 5, 10, 11);
|
public static final Model CHAR_EQUALS = new ModelChar(Resources.ATLAS.get("/char/char_equals.png"));
|
||||||
public static final TextureReference CHAR_USCORE = Textures.texmap.getTextureReference(5, 6, 10, 11);
|
public static final Model CHAR_USCORE = new ModelChar(Resources.ATLAS.get("/char/char_underscore.png"));
|
||||||
public static final TextureReference CHAR_NULL = Textures.texmap.getTextureReference(6, 7, 10, 11);
|
public static final Model CHAR_NULL = new ModelChar(Resources.ATLAS.get("/char/char_unknown.png"));
|
||||||
public static final TextureReference CHAR_BRACKET_O = Textures.texmap.getTextureReference(7, 8, 10, 11);
|
public static final Model CHAR_BRACKET_O = new ModelChar(Resources.ATLAS.get("/char/char_obracket.png"));
|
||||||
public static final TextureReference CHAR_BRACKET_C = Textures.texmap.getTextureReference(8, 9, 10, 11);
|
public static final Model CHAR_BRACKET_C = new ModelChar(Resources.ATLAS.get("/char/char_cbracket.png"));
|
||||||
public static final TextureReference CHAR_PERCENT = Textures.texmap.getTextureReference(9, 10, 10, 11);
|
public static final Model CHAR_PERCENT = new ModelChar(Resources.ATLAS.get("/char/char_percent.png"));
|
||||||
public static final TextureReference CHAR_VBAR = Textures.texmap.getTextureReference(10, 11, 10, 11);
|
public static final Model CHAR_VBAR = new ModelChar(Resources.ATLAS.get("/char/char_vertical.png"));
|
||||||
public static final TextureReference CHAR_QMARK = Textures.texmap.getTextureReference(11, 12, 10, 11);
|
public static final Model CHAR_QMARK = new ModelChar(Resources.ATLAS.get("/char/char_question.png"));
|
||||||
public static final TextureReference CHAR_DOLLAR = Textures.texmap.getTextureReference(12, 13, 10, 11);
|
public static final Model CHAR_DOLLAR = new ModelChar(Resources.ATLAS.get("/char/char_dollar.png"));
|
||||||
public static final TextureReference CHAR_HASHTAG = Textures.texmap.getTextureReference(13, 14, 10, 11);
|
public static final Model CHAR_HASHTAG = new ModelChar(Resources.ATLAS.get("/char/char_hashtag.png"));
|
||||||
public static final TextureReference CHAR_L_THEN = Textures.texmap.getTextureReference(14, 15, 10, 11);
|
public static final Model CHAR_L_THAN = new ModelChar(Resources.ATLAS.get("/char/char_lthan.png"));
|
||||||
public static final TextureReference CHAR_G_THEN = Textures.texmap.getTextureReference(15, 16, 10, 11);
|
public static final Model CHAR_G_THAN = new ModelChar(Resources.ATLAS.get("/char/char_gthan.png"));
|
||||||
|
|
||||||
public static void renderCenter(String text, Vec2d size) {
|
public static void renderCenter(String text, Vec2d size) {
|
||||||
int w = Main.window.getWidth();
|
int w = Main.window.getWidth();
|
||||||
|
|
@ -114,7 +117,7 @@ public class Text
|
||||||
for(int i=0;i<text_b.length;i++)
|
for(int i=0;i<text_b.length;i++)
|
||||||
{
|
{
|
||||||
// Get the character from the string
|
// Get the character from the string
|
||||||
TextureReference l = CHAR_NULL;
|
Model l = CHAR_NULL;
|
||||||
switch(text_b[i]) {
|
switch(text_b[i]) {
|
||||||
case(' '): l = null; break;
|
case(' '): l = null; break;
|
||||||
case('Q'): l = CHAR_Q; break;
|
case('Q'): l = CHAR_Q; break;
|
||||||
|
|
@ -181,12 +184,12 @@ public class Text
|
||||||
case('9'): l = CHAR_9; break;
|
case('9'): l = CHAR_9; break;
|
||||||
case(':'): l = CHAR_COLON; break;
|
case(':'): l = CHAR_COLON; break;
|
||||||
case(','): l = CHAR_COMMA; break;
|
case(','): l = CHAR_COMMA; break;
|
||||||
case('.'): l = CHAR_PEROID; break;
|
case('.'): l = CHAR_FULLSTOP; break;
|
||||||
case('!'): l = CHAR_EXMARK; break;
|
case('!'): l = CHAR_EXMARK; break;
|
||||||
case('-'): l = CHAR_MINUS; break;
|
case('-'): l = CHAR_MINUS; break;
|
||||||
case('+'): l = CHAR_PLUS; break;
|
case('+'): l = CHAR_PLUS; break;
|
||||||
case('/'): l = CHAR_FSLASH; break;
|
case('/'): l = CHAR_F_SLASH; break;
|
||||||
case('\\'): l = CHAR_BSLASH; break;
|
case('\\'): l = CHAR_B_SLASH; break;
|
||||||
case('='): l = CHAR_EQUALS; break;
|
case('='): l = CHAR_EQUALS; break;
|
||||||
case('_'): l = CHAR_USCORE; break;
|
case('_'): l = CHAR_USCORE; break;
|
||||||
case('('): l = CHAR_BRACKET_O; break;
|
case('('): l = CHAR_BRACKET_O; break;
|
||||||
|
|
@ -196,19 +199,11 @@ public class Text
|
||||||
case('?'): l = CHAR_QMARK; break;
|
case('?'): l = CHAR_QMARK; break;
|
||||||
case('$'): l = CHAR_DOLLAR; break;
|
case('$'): l = CHAR_DOLLAR; break;
|
||||||
case('#'): l = CHAR_HASHTAG; break;
|
case('#'): l = CHAR_HASHTAG; break;
|
||||||
case('>'): l = CHAR_G_THEN; break;
|
case('>'): l = CHAR_G_THAN; break;
|
||||||
case('<'): l = CHAR_L_THEN; break;
|
case('<'): l = CHAR_L_THAN; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is the letter not null
|
|
||||||
if(l != null)
|
|
||||||
{
|
|
||||||
// Render the character
|
|
||||||
l.texCoord(0, 1); GlHelpers.vertex2(sy*i, 0 );
|
|
||||||
l.texCoord(0, 0); GlHelpers.vertex2(sy*i, sx);
|
|
||||||
l.texCoord(1, 0); GlHelpers.vertex2(sy*(i+1), sx);
|
|
||||||
l.texCoord(1, 1); GlHelpers.vertex2(sy*(i+1), 0 );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop drawing quads
|
// Stop drawing quads
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,14 @@
|
||||||
package projectzombie.tiles;
|
package projectzombie.tiles;
|
||||||
|
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.display.transparent.ITransparentObject;
|
|
||||||
import projectzombie.display.transparent.TransparentObjects;
|
|
||||||
import projectzombie.entity.Entity;
|
import projectzombie.entity.Entity;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.util.math.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
public class Tile implements ITransparentObject
|
public class Tile
|
||||||
{
|
{
|
||||||
public short id;
|
public short id;
|
||||||
public boolean opaqueTile = false;
|
public boolean opaqueTile = false;
|
||||||
|
|
@ -23,22 +21,13 @@ public class Tile implements ITransparentObject
|
||||||
public boolean emitsLight = false;
|
public boolean emitsLight = false;
|
||||||
public boolean passNaturalLight = true;
|
public boolean passNaturalLight = true;
|
||||||
|
|
||||||
@Override
|
|
||||||
public void render(Vec2d pos, Camera camera, TileState state) {
|
public void render(Vec2d pos, Camera camera, TileState state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doRender(Vec2d pos, Camera camera, TileState state)
|
public void doRender(Vec2d pos, Camera camera, TileState state) {
|
||||||
{
|
|
||||||
if(this.opaqueTile) {
|
|
||||||
TransparentObjects.register(this, camera, pos, state);
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
|
||||||
this.render(pos, camera, state);
|
this.render(pos, camera, state);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOpaqueTile() {
|
public boolean isOpaqueTile() {
|
||||||
return this.opaqueTile;
|
return this.opaqueTile;
|
||||||
}
|
}
|
||||||
|
|
@ -46,7 +35,6 @@ public class Tile implements ITransparentObject
|
||||||
public void onWalkedOn(Chunk chunk, Layer layer, Vec2i pos, Entity entity, TileState state) {
|
public void onWalkedOn(Chunk chunk, Layer layer, Vec2i pos, Entity entity, TileState state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Vec2d getRenderOffset(TileState ts) {
|
public Vec2d getRenderOffset(TileState ts) {
|
||||||
return new Vec2d(0.5, 0.5);
|
return new Vec2d(0.5, 0.5);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,11 @@ import projectzombie.entity.Entity;
|
||||||
import projectzombie.entity.particle.ParticleBreak;
|
import projectzombie.entity.particle.ParticleBreak;
|
||||||
import projectzombie.entity.player.EntityPlayer;
|
import projectzombie.entity.player.EntityPlayer;
|
||||||
import projectzombie.init.LayerGenerators;
|
import projectzombie.init.LayerGenerators;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.util.math.MathHelpers;
|
import gl_engine.MathHelpers;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.util.math.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.world.chunk.ChunkEventHandler;
|
import projectzombie.world.chunk.ChunkEventHandler;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
import projectzombie.world.layer.layergen.LayerGenBossArena;
|
import projectzombie.world.layer.layergen.LayerGenBossArena;
|
||||||
|
|
@ -22,7 +22,7 @@ public class TileBossPortal extends TileVertical
|
||||||
private static Random rand = new Random();
|
private static Random rand = new Random();
|
||||||
|
|
||||||
public TileBossPortal() {
|
public TileBossPortal() {
|
||||||
super(Textures.TILE_BOSS_PORTAL, new Vec2d(2, 2));
|
super(Models.TILE_BOSS_PORTAL, new Vec2d(2, 2));
|
||||||
|
|
||||||
this.emitsLight = true;
|
this.emitsLight = true;
|
||||||
this.opaqueTile = true;
|
this.opaqueTile = true;
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,12 @@ import projectzombie.Main;
|
||||||
import projectzombie.entity.Entity;
|
import projectzombie.entity.Entity;
|
||||||
import projectzombie.entity.EntityItem;
|
import projectzombie.entity.EntityItem;
|
||||||
import projectzombie.init.Items;
|
import projectzombie.init.Items;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.util.math.ItemStack;
|
import projectzombie.util.math.ItemStack;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import projectzombie.util.math.random.RandomHelpers;
|
import projectzombie.util.math.random.RandomHelpers;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.util.math.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
|
|
@ -21,7 +21,7 @@ public class TileChest extends TileVertical implements TileBulletBreakable
|
||||||
public static final short CHEST_LAVA_CAVES = 2;
|
public static final short CHEST_LAVA_CAVES = 2;
|
||||||
|
|
||||||
public TileChest() {
|
public TileChest() {
|
||||||
super(Textures.TILE_CHEST, new Vec2d(1, 1));
|
super(Models.TILE_CHEST, new Vec2d(1, 1));
|
||||||
|
|
||||||
this.tileSolid = true;
|
this.tileSolid = true;
|
||||||
this.opaqueTile = true;
|
this.opaqueTile = true;
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
package projectzombie.tiles;
|
package projectzombie.tiles;
|
||||||
|
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
|
|
||||||
public class TileDirt extends TileFlatFaded
|
public class TileDirt extends TileFlatFaded
|
||||||
{
|
{
|
||||||
|
|
||||||
public TileDirt() {
|
public TileDirt() {
|
||||||
super(Textures.TILE_DIRT);
|
super(Models.TILE_DIRT);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -5,8 +5,8 @@ import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.gl.texture.IHasTexture;
|
import projectzombie.util.gl.texture.IHasTexture;
|
||||||
import projectzombie.util.gl.texture.TextureReference;
|
import projectzombie.util.gl.texture.TextureReference;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.util.math.vec.Vec3d;
|
import gl_engine.vec.Vec3d;
|
||||||
|
|
||||||
public class TileFlat extends Tile implements IHasTexture
|
public class TileFlat extends Tile implements IHasTexture
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ package projectzombie.tiles;
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.util.gl.texture.TextureReference;
|
import projectzombie.util.gl.texture.TextureReference;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.util.math.vec.Vec3d;
|
import gl_engine.vec.Vec3d;
|
||||||
|
|
||||||
public class TileFlatFaded extends TileFlat
|
public class TileFlatFaded extends TileFlat
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
package projectzombie.tiles;
|
package projectzombie.tiles;
|
||||||
|
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
|
|
||||||
public class TileGrass extends TileFlat
|
public class TileGrass extends TileFlat
|
||||||
{
|
{
|
||||||
|
|
||||||
public TileGrass() {
|
public TileGrass() {
|
||||||
super(Textures.TILE_GRASS);
|
super(Models.TILE_GRASS);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
package projectzombie.tiles;
|
package projectzombie.tiles;
|
||||||
|
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.util.math.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
|
|
||||||
public class TileLadder extends TileVertical
|
public class TileLadder extends TileVertical
|
||||||
{
|
{
|
||||||
|
|
||||||
public TileLadder() {
|
public TileLadder() {
|
||||||
super(Textures.TILE_LADDER, new Vec2d(1, 1));
|
super(Models.TILE_LADDER, new Vec2d(1, 1));
|
||||||
|
|
||||||
this.opaqueTile = true;
|
this.opaqueTile = true;
|
||||||
this.tileSolid = true;
|
this.tileSolid = true;
|
||||||
|
|
|
||||||
|
|
@ -4,18 +4,18 @@ import mainloop.task.IMainloopTask;
|
||||||
import projectzombie.Main;
|
import projectzombie.Main;
|
||||||
import projectzombie.entity.Entity;
|
import projectzombie.entity.Entity;
|
||||||
import projectzombie.entity.player.EntityPlayer;
|
import projectzombie.entity.player.EntityPlayer;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.mainloop.MainloopEventHandler;
|
import projectzombie.mainloop.MainloopEventHandler;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.util.math.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.world.chunk.ChunkEventHandler;
|
import projectzombie.world.chunk.ChunkEventHandler;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
public class TileLadderUp extends TileVertical
|
public class TileLadderUp extends TileVertical
|
||||||
{
|
{
|
||||||
public TileLadderUp() {
|
public TileLadderUp() {
|
||||||
super(Textures.TILE_LADDER_UP, new Vec2d(1, 16));
|
super(Models.TILE_LADDER_UP, new Vec2d(1, 16));
|
||||||
|
|
||||||
this.opaqueTile = true;
|
this.opaqueTile = true;
|
||||||
this.tileSolid = true;
|
this.tileSolid = true;
|
||||||
|
|
|
||||||
|
|
@ -3,18 +3,18 @@ package projectzombie.tiles;
|
||||||
import projectzombie.entity.Entity;
|
import projectzombie.entity.Entity;
|
||||||
import projectzombie.entity.EntityItem;
|
import projectzombie.entity.EntityItem;
|
||||||
import projectzombie.init.Items;
|
import projectzombie.init.Items;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.util.math.ItemStack;
|
import projectzombie.util.math.ItemStack;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.util.math.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
public class TileLantern extends TileVertical
|
public class TileLantern extends TileVertical
|
||||||
{
|
{
|
||||||
|
|
||||||
public TileLantern() {
|
public TileLantern() {
|
||||||
super(Textures.TILE_LANTERN, new Vec2d(1, 1));
|
super(Models.TILE_LANTERN, new Vec2d(1, 1));
|
||||||
|
|
||||||
this.emitsLight = true;
|
this.emitsLight = true;
|
||||||
this.opaqueTile = true;
|
this.opaqueTile = true;
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,11 @@ import java.util.Random;
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.entity.Entity;
|
import projectzombie.entity.Entity;
|
||||||
import projectzombie.entity.particle.ParticleLava;
|
import projectzombie.entity.particle.ParticleLava;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.util.math.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
|
|
@ -18,7 +18,7 @@ public class TileLava extends TileFlat
|
||||||
private Random rand = new Random();
|
private Random rand = new Random();
|
||||||
|
|
||||||
public TileLava() {
|
public TileLava() {
|
||||||
super(Textures.TILE_LAVA);
|
super(Models.TILE_LAVA);
|
||||||
|
|
||||||
this.slowness = 0.5;
|
this.slowness = 0.5;
|
||||||
this.tileWalkable = false;
|
this.tileWalkable = false;
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,12 @@ import java.util.Random;
|
||||||
|
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.entity.particle.ParticleSmoke;
|
import projectzombie.entity.particle.ParticleSmoke;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import projectzombie.util.math.random.RandomHelpers;
|
import projectzombie.util.math.random.RandomHelpers;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.util.math.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
|
|
@ -18,7 +18,7 @@ public class TileLavaFlow extends TileFlat
|
||||||
private Random rand = new Random();
|
private Random rand = new Random();
|
||||||
|
|
||||||
public TileLavaFlow() {
|
public TileLavaFlow() {
|
||||||
super(Textures.TILE_LAVA_FLOW);
|
super(Models.TILE_LAVA_FLOW);
|
||||||
|
|
||||||
this.emitsLight = true;
|
this.emitsLight = true;
|
||||||
this.unbreakable = true;
|
this.unbreakable = true;
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@ import mainloop.task.IMainloopTask;
|
||||||
import projectzombie.Main;
|
import projectzombie.Main;
|
||||||
import projectzombie.entity.Entity;
|
import projectzombie.entity.Entity;
|
||||||
import projectzombie.entity.player.EntityPlayer;
|
import projectzombie.entity.player.EntityPlayer;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.mainloop.MainloopEventHandler;
|
import projectzombie.mainloop.MainloopEventHandler;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import projectzombie.util.math.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.world.chunk.ChunkEventHandler;
|
import projectzombie.world.chunk.ChunkEventHandler;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
|
|
@ -15,7 +15,7 @@ public class TilePortalDown extends TileFlat
|
||||||
{
|
{
|
||||||
|
|
||||||
public TilePortalDown() {
|
public TilePortalDown() {
|
||||||
super(Textures.TILE_PORTAL);
|
super(Models.TILE_PORTAL);
|
||||||
|
|
||||||
this.unbreakable = true;
|
this.unbreakable = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,18 +3,18 @@ package projectzombie.tiles;
|
||||||
import projectzombie.entity.Entity;
|
import projectzombie.entity.Entity;
|
||||||
import projectzombie.entity.EntityItem;
|
import projectzombie.entity.EntityItem;
|
||||||
import projectzombie.init.Items;
|
import projectzombie.init.Items;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.util.math.ItemStack;
|
import projectzombie.util.math.ItemStack;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.util.math.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
public class TileRock extends TileVertical implements TileBulletBreakable
|
public class TileRock extends TileVertical implements TileBulletBreakable
|
||||||
{
|
{
|
||||||
|
|
||||||
public TileRock() {
|
public TileRock() {
|
||||||
super(Textures.TILE_ROCK, new Vec2d(1, 1));
|
super(Models.TILE_ROCK, new Vec2d(1, 1));
|
||||||
|
|
||||||
// Set some settings
|
// Set some settings
|
||||||
this.opaqueTile = true;
|
this.opaqueTile = true;
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
package projectzombie.tiles;
|
package projectzombie.tiles;
|
||||||
|
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
|
|
||||||
public class TileSand extends TileFlat
|
public class TileSand extends TileFlat
|
||||||
{
|
{
|
||||||
|
|
||||||
public TileSand() {
|
public TileSand() {
|
||||||
super(Textures.TILE_SAND);
|
super(Models.TILE_SAND);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
package projectzombie.tiles;
|
package projectzombie.tiles;
|
||||||
|
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
|
|
||||||
public class TileStone extends TileFlatFaded
|
public class TileStone extends TileFlatFaded
|
||||||
{
|
{
|
||||||
|
|
||||||
public TileStone() {
|
public TileStone() {
|
||||||
super(Textures.TILE_STONE);
|
super(Models.TILE_STONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
package projectzombie.tiles;
|
package projectzombie.tiles;
|
||||||
|
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
|
|
||||||
public class TileTree extends TileVertical implements TileBulletBreakable
|
public class TileTree extends TileVertical implements TileBulletBreakable
|
||||||
{
|
{
|
||||||
public TileTree() {
|
public TileTree() {
|
||||||
super(Textures.TILE_TREE, new Vec2d(1, 4));
|
super(Models.TILE_TREE, new Vec2d(1, 4));
|
||||||
|
|
||||||
// Set some settings
|
// Set some settings
|
||||||
this.opaqueTile = true;
|
this.opaqueTile = true;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import projectzombie.util.gl.VerticalRender;
|
||||||
import projectzombie.util.gl.texture.IHasTexture;
|
import projectzombie.util.gl.texture.IHasTexture;
|
||||||
import projectzombie.util.gl.texture.TextureReference;
|
import projectzombie.util.gl.texture.TextureReference;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
|
|
||||||
public class TileVertical extends Tile implements IHasTexture
|
public class TileVertical extends Tile implements IHasTexture
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
package projectzombie.tiles;
|
package projectzombie.tiles;
|
||||||
|
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
|
|
||||||
public class TileWall extends TileFlat
|
public class TileWall extends TileFlat
|
||||||
{
|
{
|
||||||
|
|
||||||
public TileWall() {
|
public TileWall() {
|
||||||
super(Textures.TILE_WALL);
|
super(Models.TILE_WALL);
|
||||||
|
|
||||||
this.tileWalkable = false;
|
this.tileWalkable = false;
|
||||||
this.tileSolid = true;
|
this.tileSolid = true;
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,11 @@ package projectzombie.tiles;
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.entity.Entity;
|
import projectzombie.entity.Entity;
|
||||||
import projectzombie.entity.particle.ParticleWater;
|
import projectzombie.entity.particle.ParticleWater;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.util.math.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
|
|
@ -15,7 +15,7 @@ public class TileWater extends TileFlat
|
||||||
{
|
{
|
||||||
|
|
||||||
public TileWater() {
|
public TileWater() {
|
||||||
super(Textures.TILE_WATER);
|
super(Models.TILE_WATER);
|
||||||
this.slowness = 0.5;
|
this.slowness = 0.5;
|
||||||
this.rotates = true;
|
this.rotates = true;
|
||||||
this.unbreakable = true;
|
this.unbreakable = true;
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
package projectzombie.tiles;
|
package projectzombie.tiles;
|
||||||
|
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.init.Textures;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
|
|
||||||
public class TileWaterFlow extends TileFlat
|
public class TileWaterFlow extends TileFlat
|
||||||
{
|
{
|
||||||
|
|
||||||
public TileWaterFlow() {
|
public TileWaterFlow() {
|
||||||
super(Textures.TILE_WATER_FLOW);
|
super(Models.TILE_WATER_FLOW);
|
||||||
|
|
||||||
this.unbreakable = true;
|
this.unbreakable = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package projectzombie.util.gl;
|
||||||
|
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.util.gl.texture.TextureReference;
|
import projectzombie.util.gl.texture.TextureReference;
|
||||||
import projectzombie.util.math.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
|
|
||||||
public class VerticalRender
|
public class VerticalRender
|
||||||
{
|
{
|
||||||
|
|
@ -19,7 +19,7 @@ public class VerticalRender
|
||||||
GlHelpers.pushMatrix();
|
GlHelpers.pushMatrix();
|
||||||
|
|
||||||
// Get the angle between the camera and the tile
|
// Get the angle between the camera and the tile
|
||||||
double angle_r = camera.angle.x;
|
double angle_r = camera.angle;
|
||||||
|
|
||||||
// Make the tile upright
|
// Make the tile upright
|
||||||
GlHelpers.translate3(0.5, 0.5, 0);
|
GlHelpers.translate3(0.5, 0.5, 0);
|
||||||
|
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
package projectzombie.util.gl.texture;
|
|
||||||
|
|
||||||
import mainloop.task.IMainloopTask;
|
|
||||||
import projectzombie.init.Textures;
|
|
||||||
|
|
||||||
public class AnimationEventHandler implements IMainloopTask
|
|
||||||
{
|
|
||||||
public static final AnimationEventHandler ANIMATION_EVENT_HANDLER = new AnimationEventHandler();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean MainLoopDelay(long millis) {
|
|
||||||
return millis > 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean MainLoopRepeat() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void MainLoopUpdate()
|
|
||||||
{
|
|
||||||
// Loop over the animations and update them all
|
|
||||||
for(AnimationReference r : Textures.animations) {
|
|
||||||
r.tick();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
package projectzombie.util.gl.texture;
|
|
||||||
|
|
||||||
import projectzombie.init.Textures;
|
|
||||||
import projectzombie.util.math.MathHelpers;
|
|
||||||
|
|
||||||
public class AnimationReference extends TextureReference
|
|
||||||
{
|
|
||||||
private TextureReference[] references;
|
|
||||||
private int upto = 0;
|
|
||||||
private int speed;
|
|
||||||
public TextureReference c;
|
|
||||||
|
|
||||||
public AnimationReference(int speed, TextureReference ... references)
|
|
||||||
{
|
|
||||||
// Store the texture references and the speed
|
|
||||||
this.references = references;
|
|
||||||
this.speed = speed;
|
|
||||||
|
|
||||||
// Register the animation
|
|
||||||
Textures.animations.add(this);
|
|
||||||
c = references[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void texCoord(double x, double y) {
|
|
||||||
c.texCoord(x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void tick()
|
|
||||||
{
|
|
||||||
// Cycle through all the textures
|
|
||||||
upto += 1;
|
|
||||||
upto = MathHelpers.mod(upto, references.length * speed);
|
|
||||||
c = references[upto / speed];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMaxX() {
|
|
||||||
return c.getMaxX();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMaxY() {
|
|
||||||
return c.getMaxY();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TextureReference getTextureReference(int start_x, int end_x, int start_y, int end_y) {
|
|
||||||
return c.getTextureReference(start_x, end_x, start_y, end_y);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -2,7 +2,7 @@ package projectzombie.util.gl.texture;
|
||||||
|
|
||||||
import static org.lwjgl.opengl.GL11.glTexCoord2f;
|
import static org.lwjgl.opengl.GL11.glTexCoord2f;
|
||||||
|
|
||||||
import projectzombie.util.math.MathHelpers;
|
import gl_engine.MathHelpers;
|
||||||
|
|
||||||
public abstract class TextureReference
|
public abstract class TextureReference
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue