Started adding a proper save menu
This commit is contained in:
parent
2946a7ec9e
commit
16b04a62ba
|
|
@ -41,6 +41,6 @@
|
||||||
<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-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-natives-windows.jar"/>
|
||||||
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-stb-sources.jar"/>
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-stb-sources.jar"/>
|
||||||
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/binary-data-format-v2.3.jar"/>
|
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/binary-data-format-v2.4.jar"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
||||||
|
|
@ -49,20 +49,6 @@ public class Main
|
||||||
public static boolean game_paused = false;
|
public static boolean game_paused = false;
|
||||||
public static int tickrate = 10;
|
public static int tickrate = 10;
|
||||||
|
|
||||||
public static void respawn()
|
|
||||||
{
|
|
||||||
// Reset the world and the player
|
|
||||||
Layers.init(rand.nextLong());
|
|
||||||
player = new EntityPlayer();
|
|
||||||
GameTimer.resetTime();
|
|
||||||
|
|
||||||
/*BdfCompressedFileManager bdf = new BdfCompressedFileManager("./layer.bdf");
|
|
||||||
Main.world = new World();
|
|
||||||
Main.world.BdfClassLoad(bdf);*/
|
|
||||||
|
|
||||||
BossBars.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) throws IOException
|
public static void main(String[] args) throws IOException
|
||||||
{
|
{
|
||||||
MathHelpers.init();
|
MathHelpers.init();
|
||||||
|
|
|
||||||
|
|
@ -23,14 +23,17 @@ import projectzombie.input.KeyCharCallback;
|
||||||
import projectzombie.input.MouseButtonCallback;
|
import projectzombie.input.MouseButtonCallback;
|
||||||
import projectzombie.input.ScrollWheelCallback;
|
import projectzombie.input.ScrollWheelCallback;
|
||||||
import projectzombie.mainloop.MainloopEventHandler;
|
import projectzombie.mainloop.MainloopEventHandler;
|
||||||
|
import projectzombie.menu.MenuSettings;
|
||||||
|
import projectzombie.settings.Settings;
|
||||||
|
|
||||||
public class DisplayWindow implements IMainloopTask
|
public class DisplayWindow implements IMainloopTask
|
||||||
{
|
{
|
||||||
|
public static boolean fullscreen = true;
|
||||||
|
|
||||||
private long window;
|
private long window;
|
||||||
private long monitor;
|
private long monitor;
|
||||||
private int width;
|
private int width;
|
||||||
private int height;
|
private int height;
|
||||||
private boolean fullscreen = true;
|
|
||||||
private boolean mouseVisibility_last = false;
|
private boolean mouseVisibility_last = false;
|
||||||
public int texture_max_size;
|
public int texture_max_size;
|
||||||
|
|
||||||
|
|
@ -101,7 +104,7 @@ public class DisplayWindow implements IMainloopTask
|
||||||
//GLFW.glfwWindowHint(GLFW.GLFW_DOUBLEBUFFER, GLFW.GLFW_FALSE);
|
//GLFW.glfwWindowHint(GLFW.GLFW_DOUBLEBUFFER, GLFW.GLFW_FALSE);
|
||||||
|
|
||||||
// Create the window
|
// Create the window
|
||||||
window = GraphicsHelpers.initWindow("Project Zombie", width, height, monitor);
|
window = GraphicsHelpers.initWindow("Project Zombie", width, height, fullscreen ? monitor : 0);
|
||||||
|
|
||||||
// Make the context current
|
// Make the context current
|
||||||
GLFW.glfwMakeContextCurrent(this.window);
|
GLFW.glfwMakeContextCurrent(this.window);
|
||||||
|
|
@ -273,14 +276,37 @@ public class DisplayWindow implements IMainloopTask
|
||||||
fps += 1;
|
fps += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void toggleFullscreen() {
|
public void toggleFullscreen()
|
||||||
if(fullscreen) {
|
{
|
||||||
|
// Exit fullscreen if the window is in fullscreen
|
||||||
|
if(fullscreen)
|
||||||
|
{
|
||||||
fullscreen = false;
|
fullscreen = false;
|
||||||
GLFW.glfwSetWindowMonitor(window, 0, 1, 1, width, height, GLFW.GLFW_DONT_CARE);
|
GLFW.glfwSetWindowMonitor(window, 0, 1, 1, width, height, GLFW.GLFW_DONT_CARE);
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
// Enter fullscreen if the window is windowed
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Get the monitor size
|
||||||
|
IntBuffer w = BufferUtils.createIntBuffer(1);
|
||||||
|
IntBuffer h = BufferUtils.createIntBuffer(1);
|
||||||
|
GLFW.glfwGetMonitorPhysicalSize(monitor, w, h);
|
||||||
|
width = w.get()*4;
|
||||||
|
height = h.get()*4;
|
||||||
|
|
||||||
|
// Enter fullscreen mode
|
||||||
fullscreen = true;
|
fullscreen = true;
|
||||||
GLFW.glfwSetWindowMonitor(window, monitor, 0, 0, width, height, GLFW.GLFW_DONT_CARE);
|
GLFW.glfwSetWindowMonitor(window, monitor, 0, 0, width, height, GLFW.GLFW_DONT_CARE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update the settings file
|
||||||
|
Settings.update();
|
||||||
|
|
||||||
|
if(Main.menu instanceof MenuSettings) {
|
||||||
|
((MenuSettings) Main.menu).buttonFullscreen.setText(
|
||||||
|
"Fullscreen: " + (fullscreen ? "On" : "Off"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMouseVisibility(boolean status) {
|
public void setMouseVisibility(boolean status) {
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,16 @@ package projectzombie.init;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import projectzombie.Main;
|
import projectzombie.Main;
|
||||||
|
import projectzombie.display.bossbar.BossBars;
|
||||||
|
import projectzombie.entity.player.EntityPlayer;
|
||||||
|
import projectzombie.time.GameTimer;
|
||||||
import projectzombie.world.World;
|
import projectzombie.world.World;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
import projectzombie.world.layer.layergen.LayerGenBossArena;
|
import projectzombie.world.layer.layergen.LayerGenBossArena;
|
||||||
|
|
||||||
public class Layers
|
public class Layers
|
||||||
{
|
{
|
||||||
public static void init(long seed)
|
public static void createWorld(String path, long seed)
|
||||||
{
|
{
|
||||||
// Create all the layers
|
// Create all the layers
|
||||||
EARTH = new Layer(new Random(seed), LayerGenerators.EARTH);
|
EARTH = new Layer(new Random(seed), LayerGenerators.EARTH);
|
||||||
|
|
@ -17,11 +20,16 @@ public class Layers
|
||||||
LAVA_CAVES = new Layer(new Random(seed), LayerGenerators.LAVA_CAVES);
|
LAVA_CAVES = new Layer(new Random(seed), LayerGenerators.LAVA_CAVES);
|
||||||
|
|
||||||
// Create the world and set the earth as the default layer
|
// Create the world and set the earth as the default layer
|
||||||
Main.world = new World();
|
Main.world = new World(path);
|
||||||
Main.world.addLayer(EARTH);
|
Main.world.addLayer(EARTH);
|
||||||
Main.world.addLayer(CAVES);
|
Main.world.addLayer(CAVES);
|
||||||
Main.world.addLayer(LAVA_CAVES);
|
Main.world.addLayer(LAVA_CAVES);
|
||||||
Main.world.setLayer(0);
|
Main.world.setLayer(0);
|
||||||
|
|
||||||
|
// Initialize some other objects
|
||||||
|
Main.player = new EntityPlayer();
|
||||||
|
GameTimer.resetTime();
|
||||||
|
BossBars.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Layer EARTH;
|
public static Layer EARTH;
|
||||||
|
|
|
||||||
|
|
@ -94,8 +94,13 @@ public class Models
|
||||||
new ModelVertical(Resources.ATLAS.get("/particle/smoke_4.png")),
|
new ModelVertical(Resources.ATLAS.get("/particle/smoke_4.png")),
|
||||||
new ModelVertical(Resources.ATLAS.get("/particle/smoke_5.png")));
|
new ModelVertical(Resources.ATLAS.get("/particle/smoke_5.png")));
|
||||||
|
|
||||||
public static final ModelGui UI_BUTTON = new ModelGui(Resources.ATLAS.get("/gui/button_normal.png"), new Vec2d(12, 1.5));
|
public static final ModelGui UI_BUTTON = new ModelGui(Resources.ATLAS.get("/gui/button_normal.png"), new Vec2d(12, 1.5));
|
||||||
public static final ModelGui UI_BUTTON_HOVER = new ModelGui(Resources.ATLAS.get("/gui/button_hover.png"), new Vec2d(12, 1.5));
|
public static final ModelGui UI_BUTTON_HOVER = new ModelGui(Resources.ATLAS.get("/gui/button_hover.png"), new Vec2d(12, 1.5));
|
||||||
|
public static final ModelGui UI_BUTTON_DELETE = new ModelGui(Resources.ATLAS.get("/gui/button_delete.png"), new Vec2d(1.2, 1.2));
|
||||||
|
public static final ModelGui UI_BUTTON_DELETE_HOVER = new ModelGui(Resources.ATLAS.get("/gui/button_delete_hover.png"), new Vec2d(1.2, 1.2));
|
||||||
|
public static final ModelGui UI_BUTTON_PLAY = new ModelGui(Resources.ATLAS.get("/gui/button_play.png"), new Vec2d(1.2, 1.2));
|
||||||
|
public static final ModelGui UI_BUTTON_PLAY_HOVER = new ModelGui(Resources.ATLAS.get("/gui/button_play_hover.png"), new Vec2d(1.2, 1.2));
|
||||||
|
public static final ModelGui UI_LABEL = new ModelGui(Resources.ATLAS.get("/gui/label.png"), new Vec2d(24, 3));
|
||||||
|
|
||||||
public static final ModelGui UI_HEALTH_FG = new ModelGui(Resources.ATLAS.get("/gui/health_full.png"), new Vec2d(6, 0.375));
|
public static final ModelGui UI_HEALTH_FG = new ModelGui(Resources.ATLAS.get("/gui/health_full.png"), new Vec2d(6, 0.375));
|
||||||
public static final ModelGui UI_HEALTH_BG = new ModelGui(Resources.ATLAS.get("/gui/health_empty.png"), new Vec2d(6, 0.375));
|
public static final ModelGui UI_HEALTH_BG = new ModelGui(Resources.ATLAS.get("/gui/health_empty.png"), new Vec2d(6, 0.375));
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
package projectzombie.menu;
|
package projectzombie.menu;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import gl_engine.vec.Vec3d;
|
import gl_engine.vec.Vec3d;
|
||||||
import projectzombie.Main;
|
import projectzombie.Main;
|
||||||
|
import projectzombie.init.Layers;
|
||||||
import projectzombie.input.types.InputGUI;
|
import projectzombie.input.types.InputGUI;
|
||||||
import projectzombie.menu.gui.GUIButtonGroup;
|
import projectzombie.menu.gui.GUIButtonGroup;
|
||||||
import projectzombie.menu.gui.GUI;
|
import projectzombie.menu.gui.GUI;
|
||||||
|
|
@ -10,6 +13,8 @@ import projectzombie.menu.gui.components.LabelMain;
|
||||||
|
|
||||||
public class MenuMain extends Menu
|
public class MenuMain extends Menu
|
||||||
{
|
{
|
||||||
|
private static final Random rand = new Random();
|
||||||
|
|
||||||
private GUI gui;
|
private GUI gui;
|
||||||
|
|
||||||
public MenuMain() {
|
public MenuMain() {
|
||||||
|
|
@ -26,8 +31,7 @@ public class MenuMain extends Menu
|
||||||
GUIButtonGroup group = new GUIButtonGroup();
|
GUIButtonGroup group = new GUIButtonGroup();
|
||||||
|
|
||||||
group.add(new ButtonBasic("Play", button -> {
|
group.add(new ButtonBasic("Play", button -> {
|
||||||
Main.respawn();
|
Main.menu = new MenuSaves(Main.menu);
|
||||||
Main.menu = new MenuGame();
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
group.add(new ButtonBasic("Settings", button -> {
|
group.add(new ButtonBasic("Settings", button -> {
|
||||||
|
|
@ -41,7 +45,7 @@ public class MenuMain extends Menu
|
||||||
gui.add(group);
|
gui.add(group);
|
||||||
gui.setSelected(group.get(0));
|
gui.setSelected(group.get(0));
|
||||||
|
|
||||||
Main.respawn();
|
Layers.createWorld(null, rand.nextLong());
|
||||||
Main.player.dead = true;
|
Main.player.dead = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
package projectzombie.menu;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import gl_engine.vec.Vec2d;
|
||||||
|
import projectzombie.Main;
|
||||||
|
import projectzombie.init.Layers;
|
||||||
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.input.types.InputGUI;
|
||||||
|
import projectzombie.menu.gui.GUI;
|
||||||
|
import projectzombie.menu.gui.GUIAlignment;
|
||||||
|
import projectzombie.menu.gui.GUIButton;
|
||||||
|
import projectzombie.menu.gui.GUILabel;
|
||||||
|
import projectzombie.menu.gui.GuiButtonModel;
|
||||||
|
import projectzombie.menu.gui.components.ButtonBasic;
|
||||||
|
import projectzombie.menu.gui.components.ButtonCallback;
|
||||||
|
import projectzombie.menu.gui.components.ButtonSetting;
|
||||||
|
|
||||||
|
public class MenuSaves extends Menu
|
||||||
|
{
|
||||||
|
private static final Random rand = new Random();
|
||||||
|
|
||||||
|
private Menu parent;
|
||||||
|
private GUI gui;
|
||||||
|
|
||||||
|
public MenuSaves(Menu parent)
|
||||||
|
{
|
||||||
|
this.parent = parent;
|
||||||
|
|
||||||
|
doGameloop = parent.doGameloop;
|
||||||
|
doGameRender = parent.doGameRender;
|
||||||
|
showIngameGUI = parent.showIngameGUI;
|
||||||
|
|
||||||
|
gui = new GUI();
|
||||||
|
input = new InputGUI(gui);
|
||||||
|
keepMouse = false;
|
||||||
|
|
||||||
|
ButtonBasic buttonBack = new ButtonBasic("Back", button -> {
|
||||||
|
Main.menu = parent;
|
||||||
|
});
|
||||||
|
|
||||||
|
ButtonBasic buttonCreate = new ButtonBasic("Create", button -> {
|
||||||
|
Layers.createWorld(null, rand.nextLong());
|
||||||
|
Main.menu = new MenuGame();
|
||||||
|
});
|
||||||
|
|
||||||
|
GuiButtonModel buttonPlay = new GuiButtonModel(Models.UI_BUTTON_DELETE, Models.UI_BUTTON_DELETE_HOVER);
|
||||||
|
gui.add(buttonPlay);
|
||||||
|
|
||||||
|
buttonBack.setAlign(GUIAlignment.RIGHT);
|
||||||
|
buttonCreate.setAlign(GUIAlignment.LEFT);
|
||||||
|
|
||||||
|
buttonBack.setPos(new Vec2d(-0.5, -8));
|
||||||
|
buttonCreate.setPos(new Vec2d(0.5, -8));
|
||||||
|
|
||||||
|
GUILabel labelSaves = new GUILabel();
|
||||||
|
labelSaves.setText("Saves");
|
||||||
|
labelSaves.setSize(new Vec2d(1, 1));
|
||||||
|
labelSaves.setPos(new Vec2d(0, 6.8));
|
||||||
|
gui.add(labelSaves);
|
||||||
|
|
||||||
|
gui.add(buttonBack);
|
||||||
|
gui.add(buttonCreate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render() {
|
||||||
|
gui.render();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update()
|
||||||
|
{
|
||||||
|
parent.update();
|
||||||
|
|
||||||
|
super.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -4,6 +4,7 @@ import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.Main;
|
import projectzombie.Main;
|
||||||
import projectzombie.display.DisplayRender;
|
import projectzombie.display.DisplayRender;
|
||||||
import projectzombie.display.DisplayRenderUI;
|
import projectzombie.display.DisplayRenderUI;
|
||||||
|
import projectzombie.display.DisplayWindow;
|
||||||
import projectzombie.entity.EntityParticle;
|
import projectzombie.entity.EntityParticle;
|
||||||
import projectzombie.input.types.InputGUI;
|
import projectzombie.input.types.InputGUI;
|
||||||
import projectzombie.menu.gui.GUIButton;
|
import projectzombie.menu.gui.GUIButton;
|
||||||
|
|
@ -21,6 +22,8 @@ import projectzombie.world.chunk.Chunk;
|
||||||
|
|
||||||
public class MenuSettings extends Menu
|
public class MenuSettings extends Menu
|
||||||
{
|
{
|
||||||
|
public ButtonSetting buttonFullscreen;
|
||||||
|
|
||||||
private GUI gui;
|
private GUI gui;
|
||||||
private Menu menuOld;
|
private Menu menuOld;
|
||||||
|
|
||||||
|
|
@ -54,6 +57,12 @@ public class MenuSettings extends Menu
|
||||||
Settings.update();
|
Settings.update();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
group.add(buttonFullscreen = new ButtonSetting("Fullscreen: " + (DisplayWindow.fullscreen ? "On" : "Off"),
|
||||||
|
button -> {
|
||||||
|
Main.window.toggleFullscreen();
|
||||||
|
button.setText("Fullscreen: " + (DisplayWindow.fullscreen ? "On" : "Off"));
|
||||||
|
}));
|
||||||
|
|
||||||
group.add(new ButtonSetting("Debug mode: " + (DisplayRenderUI.debug ? "On" : "Off"),
|
group.add(new ButtonSetting("Debug mode: " + (DisplayRenderUI.debug ? "On" : "Off"),
|
||||||
button ->
|
button ->
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,66 @@
|
||||||
|
package projectzombie.menu.gui;
|
||||||
|
|
||||||
|
import gl_engine.matrix.Matrix4;
|
||||||
|
import gl_engine.vec.Vec2d;
|
||||||
|
import projectzombie.model.Model;
|
||||||
|
import projectzombie.model.ModelGui;
|
||||||
|
|
||||||
|
public class GuiButtonModel implements GUIComponent
|
||||||
|
{
|
||||||
|
private ModelGui modelHover;
|
||||||
|
private ModelGui model;
|
||||||
|
|
||||||
|
private Vec2d pos = new Vec2d(0, 0);
|
||||||
|
|
||||||
|
public GuiButtonModel(ModelGui model, ModelGui modelHover) {
|
||||||
|
this.modelHover = modelHover;
|
||||||
|
this.model = model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPos(Vec2d pos) {
|
||||||
|
this.pos = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(Vec2d mousePos)
|
||||||
|
{
|
||||||
|
Model model = checkMouseHover(mousePos) ? this.modelHover : this.model;
|
||||||
|
|
||||||
|
model.setModel(Matrix4.translate(pos.x, pos.y, 0));
|
||||||
|
model.render();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(Vec2d mousePos) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkMouseHover(Vec2d mousePos) {
|
||||||
|
return (mousePos.x > pos.x && mousePos.x < pos.x + model.getWidth() &&
|
||||||
|
mousePos.y > pos.y && mousePos.y < pos.y + model.getHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRightClick(Vec2d mousePos) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMouseClick(Vec2d mousePos) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivate() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBack() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -6,8 +6,10 @@ import bdf.file.BdfFileManager;
|
||||||
import bdf.types.BdfNamedList;
|
import bdf.types.BdfNamedList;
|
||||||
import bdf.types.BdfObject;
|
import bdf.types.BdfObject;
|
||||||
import bdf.types.BdfTypes;
|
import bdf.types.BdfTypes;
|
||||||
|
import projectzombie.Main;
|
||||||
import projectzombie.display.DisplayRender;
|
import projectzombie.display.DisplayRender;
|
||||||
import projectzombie.display.DisplayRenderUI;
|
import projectzombie.display.DisplayRenderUI;
|
||||||
|
import projectzombie.display.DisplayWindow;
|
||||||
import projectzombie.entity.EntityParticle;
|
import projectzombie.entity.EntityParticle;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
|
|
||||||
|
|
@ -38,6 +40,10 @@ public class Settings implements IBdfClassManager
|
||||||
DisplayRenderUI.debug = false;
|
DisplayRenderUI.debug = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(nl.get("fullscreen").getType() == BdfTypes.BOOLEAN) {
|
||||||
|
DisplayWindow.fullscreen = nl.get("fullscreen").getBoolean();
|
||||||
|
}
|
||||||
|
|
||||||
if(nl.get("shadow_size").getType() == BdfTypes.INTEGER)
|
if(nl.get("shadow_size").getType() == BdfTypes.INTEGER)
|
||||||
{
|
{
|
||||||
SettingQuality quality = DisplayRender.getShadowQuality();
|
SettingQuality quality = DisplayRender.getShadowQuality();
|
||||||
|
|
@ -104,10 +110,11 @@ public class Settings implements IBdfClassManager
|
||||||
nl.set("show_fps", BdfObject.withBoolean(DisplayRenderUI.showFPS));
|
nl.set("show_fps", BdfObject.withBoolean(DisplayRenderUI.showFPS));
|
||||||
nl.set("debug", BdfObject.withBoolean(DisplayRenderUI.debug));
|
nl.set("debug", BdfObject.withBoolean(DisplayRenderUI.debug));
|
||||||
nl.set("shadow_size", BdfObject.withInteger(shadow_size));
|
nl.set("shadow_size", BdfObject.withInteger(shadow_size));
|
||||||
|
nl.set("fullscreen", BdfObject.withBoolean(Main.window.fullscreen));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
FILE_MANAGER = new BdfFileManager(Environment.gdir + "/settings.bdf");
|
FILE_MANAGER = new BdfFileManager(Environment.gdir + "/settings.bdf", true);
|
||||||
SETTINGS.load(FILE_MANAGER);
|
SETTINGS.load(FILE_MANAGER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,11 +29,20 @@ public class World implements IBdfClassManager
|
||||||
private Layer loaded;
|
private Layer loaded;
|
||||||
private ArrayList<Layer> layers = new ArrayList<Layer>();
|
private ArrayList<Layer> layers = new ArrayList<Layer>();
|
||||||
|
|
||||||
|
private String path;
|
||||||
private int pool_vao, pool_vbo, pool_ibo;
|
private int pool_vao, pool_vbo, pool_ibo;
|
||||||
private boolean pool_dirty = true;
|
private boolean pool_dirty = true;
|
||||||
private int pool_particle_count = 0;
|
private int pool_particle_count = 0;
|
||||||
private int pool_size = 1;
|
private int pool_size = 1;
|
||||||
|
|
||||||
|
public World(String path) {
|
||||||
|
this.path = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSavePath() {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isPoolDirty() {
|
public boolean isPoolDirty() {
|
||||||
return pool_dirty;
|
return pool_dirty;
|
||||||
}
|
}
|
||||||
|
|
@ -151,11 +160,15 @@ public class World implements IBdfClassManager
|
||||||
DisplayLighting.clearLighting();
|
DisplayLighting.clearLighting();
|
||||||
DisplayLighting.setDirty();
|
DisplayLighting.setDirty();
|
||||||
|
|
||||||
|
if(this.loaded != null) {
|
||||||
|
this.loaded.free();
|
||||||
|
}
|
||||||
|
|
||||||
this.loaded = layers.get(id);
|
this.loaded = layers.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeLayer(int id) {
|
public void removeLayer(int id) {
|
||||||
layers.remove(id);
|
layers.remove(id).free();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int addLayer(Layer layer) {
|
public int addLayer(Layer layer) {
|
||||||
|
|
@ -227,4 +240,11 @@ public class World implements IBdfClassManager
|
||||||
// Save the game timer
|
// Save the game timer
|
||||||
nl.set("time", BdfObject.withLong(GameTimer.getTime()));
|
nl.set("time", BdfObject.withLong(GameTimer.getTime()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void free()
|
||||||
|
{
|
||||||
|
for(Layer layer : layers) {
|
||||||
|
layer.free();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -341,7 +341,7 @@ public class Chunk implements IBdfClassManager
|
||||||
|
|
||||||
public int render(Camera camera, FloatBuffer particle_pool, int upto)
|
public int render(Camera camera, FloatBuffer particle_pool, int upto)
|
||||||
{
|
{
|
||||||
if(this.render_dirty)
|
if(model == null || this.render_dirty)
|
||||||
{
|
{
|
||||||
this.render_dirty = false;
|
this.render_dirty = false;
|
||||||
int verticies_size = 0;
|
int verticies_size = 0;
|
||||||
|
|
@ -689,11 +689,15 @@ public class Chunk implements IBdfClassManager
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tick the tile
|
// Tick the tile
|
||||||
ts.tile.tickRandomly(
|
ts.tile.tickRandomly(layer, this, ts, pos);
|
||||||
layer,
|
}
|
||||||
this,
|
|
||||||
ts,
|
public void free()
|
||||||
pos);
|
{
|
||||||
|
if(this.model != null) {
|
||||||
|
this.model.free();
|
||||||
|
this.model = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -157,4 +157,8 @@ public class ChunkEmpty extends Chunk
|
||||||
public boolean isDirty() {
|
public boolean isDirty() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void free() {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ public class ChunkEventHandler implements IMainloopTask
|
||||||
) {
|
) {
|
||||||
// Unload the chunk
|
// Unload the chunk
|
||||||
layer.unloadChunk(ce.pos);
|
layer.unloadChunk(ce.pos);
|
||||||
|
ce.o.free();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -336,4 +336,11 @@ public class Layer implements IBdfClassManager
|
||||||
bdf_chunks.add(BdfObject.withNamedList(chunk_nl));
|
bdf_chunks.add(BdfObject.withNamedList(chunk_nl));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void free()
|
||||||
|
{
|
||||||
|
for(Map2DElement<Chunk> chunk : chunks) {
|
||||||
|
chunk.o.free();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 614 B |
Binary file not shown.
|
After Width: | Height: | Size: 597 B |
Binary file not shown.
|
After Width: | Height: | Size: 626 B |
Binary file not shown.
|
After Width: | Height: | Size: 632 B |
Binary file not shown.
|
After Width: | Height: | Size: 3.9 KiB |
|
|
@ -1,208 +1,215 @@
|
||||||
./text/char_question.png
|
./tile/hemp6.png
|
||||||
./text/char_l_a.png
|
./tile/hemp7.png
|
||||||
./text/char_u_j.png
|
./tile/hemp1.png
|
||||||
./text/char_l_u.png
|
./tile/rock.png
|
||||||
./text/char_u_s.png
|
./tile/rock_ice.png
|
||||||
./text/char_l_s.png
|
./tile/sapling3.png
|
||||||
./text/char_plus.png
|
./tile/ladder.png
|
||||||
./text/char_l_e.png
|
./tile/tree_leaves_snow.png
|
||||||
./text/char_7.png
|
./tile/ice_wall.png
|
||||||
./text/char_minus.png
|
./tile/water.png
|
||||||
./text/char_u_r.png
|
./tile/sandstone_wall.png
|
||||||
./text/char_u_l.png
|
./tile/ladder_up.png
|
||||||
./text/char_obracket.png
|
./tile/cactus4.png
|
||||||
./text/char_u_m.png
|
./tile/tall_grass.png
|
||||||
./text/char_l_t.png
|
./tile/cactus2.png
|
||||||
./text/char_percent.png
|
./tile/grass_infested.png
|
||||||
./text/char_l_y.png
|
./tile/tree_branch_leaves.png
|
||||||
./text/char_0.png
|
./tile/dirt.png
|
||||||
./text/char_4.png
|
./tile/wall.png
|
||||||
./text/char_l_r.png
|
./tile/tree_base.png
|
||||||
./text/char_l_m.png
|
./tile/cactus1.png
|
||||||
./text/char_cbracket.png
|
./tile/sapling4.png
|
||||||
./text/char_u_g.png
|
./tile/hemp3.png
|
||||||
./text/char_u_q.png
|
./tile/cactus_top.png
|
||||||
./text/char_u_i.png
|
./tile/tunnel_down.png
|
||||||
./text/char_l_w.png
|
./tile/stone.png
|
||||||
./text/char_l_v.png
|
./tile/snow.png
|
||||||
./text/char_fslash.png
|
./tile/boss_portal.png
|
||||||
./text/char_u_p.png
|
./tile/hemp4.png
|
||||||
./text/char_gthan.png
|
./tile/sand.png
|
||||||
./text/char_8.png
|
./tile/lantern.png
|
||||||
./text/char_unknown.png
|
./tile/ice.png
|
||||||
./text/char_u_n.png
|
./tile/sapling1.png
|
||||||
./text/char_l_i.png
|
./tile/chest.png
|
||||||
./text/char_u_y.png
|
./tile/hemp2.png
|
||||||
./text/char_l_p.png
|
./tile/hemp8.png
|
||||||
./text/char_lthan.png
|
./tile/cactus3.png
|
||||||
./text/char_l_g.png
|
./tile/lava.png
|
||||||
./text/char_bslash.png
|
./tile/tree_leaves.png
|
||||||
./text/char_1.png
|
./tile/hemp5.png
|
||||||
./text/char_u_z.png
|
./tile/lava_flow.png
|
||||||
./text/char_l_f.png
|
./tile/grass.png
|
||||||
./text/char_u_w.png
|
./tile/tree_branch.png
|
||||||
./text/char_9.png
|
./tile/sandstone.png
|
||||||
./text/char_l_x.png
|
./tile/tree_branch_leaves_snow.png
|
||||||
./text/char_l_o.png
|
./tile/rock_sandstone.png
|
||||||
./text/char_equals.png
|
./tile/sapling2.png
|
||||||
./text/char_l_d.png
|
|
||||||
./text/char_dollar.png
|
|
||||||
./text/char_hashtag.png
|
|
||||||
./text/char_l_q.png
|
|
||||||
./text/char_u_o.png
|
|
||||||
./text/char_6.png
|
|
||||||
./text/char_u_d.png
|
|
||||||
./text/char_u_e.png
|
|
||||||
./text/char_exclamation.png
|
|
||||||
./text/char_vertical.png
|
|
||||||
./text/char_u_k.png
|
|
||||||
./text/char_u_c.png
|
|
||||||
./text/char_l_n.png
|
|
||||||
./text/char_u_b.png
|
|
||||||
./text/char_u_f.png
|
|
||||||
./text/char_l_h.png
|
|
||||||
./text/char_l_k.png
|
|
||||||
./text/char_u_t.png
|
|
||||||
./text/char_3.png
|
|
||||||
./text/char_u_v.png
|
|
||||||
./text/char_u_h.png
|
|
||||||
./text/char_u_a.png
|
|
||||||
./text/char_l_b.png
|
|
||||||
./text/char_underscore.png
|
|
||||||
./text/char_u_x.png
|
|
||||||
./text/char_comma.png
|
|
||||||
./text/char_l_l.png
|
|
||||||
./text/char_5.png
|
|
||||||
./text/char_colon.png
|
|
||||||
./text/char_l_z.png
|
|
||||||
./text/char_space.png
|
|
||||||
./text/char_2.png
|
|
||||||
./text/char_l_j.png
|
|
||||||
./text/char_fullstop.png
|
|
||||||
./text/char_l_c.png
|
|
||||||
./text/char_u_u.png
|
|
||||||
./list.txt
|
./list.txt
|
||||||
./player/player_white_front_moving.png
|
./item/log.png
|
||||||
./player/player_white_back_moving.png
|
./item/rock.png
|
||||||
./player/player_black_back_moving.png
|
./item/acorn.png
|
||||||
./player/player_black_back_still.png
|
./item/ammo_box.png
|
||||||
|
./item/plant_fibre.png
|
||||||
|
./item/hemp_seed.png
|
||||||
|
./item/shield_upgrade.png
|
||||||
|
./item/grappling_hook.png
|
||||||
|
./item/log_snow.png
|
||||||
|
./item/health_potion.png
|
||||||
|
./item/snow_pile.png
|
||||||
|
./item/gun_upgrade.png
|
||||||
|
./item/sandstone.png
|
||||||
|
./item/flint.png
|
||||||
./player/player_white_back_still.png
|
./player/player_white_back_still.png
|
||||||
./player/player_white_front_still.png
|
./player/player_white_front_still.png
|
||||||
./player/player_black_front_moving.png
|
./player/player_black_front_moving.png
|
||||||
./player/player_black_front_still.png
|
./player/player_black_front_still.png
|
||||||
./particle/smoke_trail.png
|
./player/player_black_back_moving.png
|
||||||
./particle/water.png
|
./player/player_black_back_still.png
|
||||||
./particle/smoke_0.png
|
./player/player_white_back_moving.png
|
||||||
./particle/smoke_1.png
|
./player/player_white_front_moving.png
|
||||||
./particle/blood.png
|
|
||||||
./particle/lava.png
|
|
||||||
./particle/bullet.png
|
|
||||||
./particle/smoke_2.png
|
|
||||||
./particle/smoke_4.png
|
|
||||||
./particle/smoke_3.png
|
|
||||||
./particle/smoke_5.png
|
|
||||||
./gui/temperature.png
|
|
||||||
./gui/slot_armor_chest.png
|
|
||||||
./gui/health_empty.png
|
|
||||||
./gui/button_hover.png
|
|
||||||
./gui/water.png
|
|
||||||
./gui/slot_armor_legs.png
|
|
||||||
./gui/button_normal.png
|
|
||||||
./gui/hotbar.png
|
|
||||||
./gui/slot_armor_helmet.png
|
|
||||||
./gui/inventory.png
|
|
||||||
./gui/health_full.png
|
|
||||||
./gui/hotbar_selected.png
|
|
||||||
./gui/slot_clothing_shirt.png
|
|
||||||
./gui/pixel_white.png
|
./gui/pixel_white.png
|
||||||
./gui/pixel_black.png
|
./gui/water.png
|
||||||
./gui/slot_clothing_pants.png
|
|
||||||
./gui/shield.png
|
|
||||||
./gui/slot_clothing_boots.png
|
|
||||||
./gui/gun.png
|
./gui/gun.png
|
||||||
./tile/cactus4.png
|
./gui/button_delete.png
|
||||||
./tile/hemp1.png
|
./gui/button_delete_hover.png
|
||||||
./tile/dirt.png
|
./gui/slot_armor_chest.png
|
||||||
./tile/lantern.png
|
./gui/pixel_black.png
|
||||||
./tile/hemp8.png
|
./gui/slot_clothing_shirt.png
|
||||||
./tile/wall.png
|
./gui/button_play.png
|
||||||
./tile/cactus_top.png
|
./gui/slot_armor_legs.png
|
||||||
./tile/cactus2.png
|
./gui/inventory.png
|
||||||
./tile/rock.png
|
./gui/label.png
|
||||||
./tile/water.png
|
./gui/slot_clothing_pants.png
|
||||||
./tile/hemp4.png
|
./gui/health_empty.png
|
||||||
./tile/stone.png
|
./gui/hotbar_selected.png
|
||||||
./tile/tree_leaves.png
|
./gui/health_full.png
|
||||||
./tile/sapling2.png
|
./gui/temperature.png
|
||||||
./tile/ladder_up.png
|
./gui/button_play_hover.png
|
||||||
./tile/sapling3.png
|
./gui/slot_armor_helmet.png
|
||||||
./tile/lava_flow.png
|
./gui/slot_clothing_boots.png
|
||||||
./tile/ice_wall.png
|
./gui/hotbar.png
|
||||||
./tile/grass.png
|
./gui/button_normal.png
|
||||||
./tile/chest.png
|
./gui/shield.png
|
||||||
./tile/sapling4.png
|
./gui/button_hover.png
|
||||||
./tile/lava.png
|
./text/char_bslash.png
|
||||||
./tile/tall_grass.png
|
./text/char_dollar.png
|
||||||
./tile/hemp5.png
|
./text/char_l_w.png
|
||||||
./tile/sapling1.png
|
./text/char_u_d.png
|
||||||
./tile/snow.png
|
./text/char_u_t.png
|
||||||
./tile/sandstone_wall.png
|
./text/char_space.png
|
||||||
./tile/rock_sandstone.png
|
./text/char_l_x.png
|
||||||
./tile/hemp6.png
|
./text/char_l_k.png
|
||||||
./tile/cactus1.png
|
./text/char_6.png
|
||||||
./tile/tree_branch_leaves.png
|
./text/char_unknown.png
|
||||||
./tile/tunnel_down.png
|
./text/char_comma.png
|
||||||
./tile/tree_branch_leaves_snow.png
|
./text/char_obracket.png
|
||||||
./tile/tree_leaves_snow.png
|
./text/char_u_w.png
|
||||||
./tile/rock_ice.png
|
./text/char_7.png
|
||||||
./tile/boss_portal.png
|
./text/char_l_f.png
|
||||||
./tile/ladder.png
|
./text/char_vertical.png
|
||||||
./tile/hemp7.png
|
./text/char_plus.png
|
||||||
./tile/grass_infested.png
|
./text/char_u_a.png
|
||||||
./tile/tree_branch.png
|
./text/char_9.png
|
||||||
./tile/sand.png
|
./text/char_u_k.png
|
||||||
./tile/tree_base.png
|
./text/char_u_n.png
|
||||||
./tile/cactus3.png
|
./text/char_percent.png
|
||||||
./tile/sandstone.png
|
./text/char_u_m.png
|
||||||
./tile/hemp3.png
|
./text/char_exclamation.png
|
||||||
./tile/hemp2.png
|
./text/char_1.png
|
||||||
./tile/ice.png
|
./text/char_l_q.png
|
||||||
./entity/flare.png
|
./text/char_l_z.png
|
||||||
./entity/grappling_hook.png
|
./text/char_l_h.png
|
||||||
./entity/zombie_back_moving.png
|
./text/char_u_c.png
|
||||||
./entity/tnt.png
|
./text/char_l_g.png
|
||||||
|
./text/char_l_s.png
|
||||||
|
./text/char_fullstop.png
|
||||||
|
./text/char_u_j.png
|
||||||
|
./text/char_l_m.png
|
||||||
|
./text/char_l_t.png
|
||||||
|
./text/char_u_v.png
|
||||||
|
./text/char_colon.png
|
||||||
|
./text/char_l_i.png
|
||||||
|
./text/char_l_y.png
|
||||||
|
./text/char_u_l.png
|
||||||
|
./text/char_u_e.png
|
||||||
|
./text/char_5.png
|
||||||
|
./text/char_2.png
|
||||||
|
./text/char_3.png
|
||||||
|
./text/char_l_p.png
|
||||||
|
./text/char_fslash.png
|
||||||
|
./text/char_l_u.png
|
||||||
|
./text/char_u_f.png
|
||||||
|
./text/char_u_u.png
|
||||||
|
./text/char_l_e.png
|
||||||
|
./text/char_l_l.png
|
||||||
|
./text/char_u_g.png
|
||||||
|
./text/char_u_q.png
|
||||||
|
./text/char_u_b.png
|
||||||
|
./text/char_l_o.png
|
||||||
|
./text/char_minus.png
|
||||||
|
./text/char_l_v.png
|
||||||
|
./text/char_lthan.png
|
||||||
|
./text/char_u_s.png
|
||||||
|
./text/char_equals.png
|
||||||
|
./text/char_8.png
|
||||||
|
./text/char_underscore.png
|
||||||
|
./text/char_u_x.png
|
||||||
|
./text/char_0.png
|
||||||
|
./text/char_l_d.png
|
||||||
|
./text/char_l_c.png
|
||||||
|
./text/char_l_j.png
|
||||||
|
./text/char_u_z.png
|
||||||
|
./text/char_u_h.png
|
||||||
|
./text/char_hashtag.png
|
||||||
|
./text/char_gthan.png
|
||||||
|
./text/char_cbracket.png
|
||||||
|
./text/char_u_i.png
|
||||||
|
./text/char_question.png
|
||||||
|
./text/char_u_o.png
|
||||||
|
./text/char_u_y.png
|
||||||
|
./text/char_l_r.png
|
||||||
|
./text/char_l_b.png
|
||||||
|
./text/char_l_a.png
|
||||||
|
./text/char_l_n.png
|
||||||
|
./text/char_u_p.png
|
||||||
|
./text/char_u_r.png
|
||||||
|
./text/char_4.png
|
||||||
./entity/armored_zombie_back_moving.png
|
./entity/armored_zombie_back_moving.png
|
||||||
./entity/armored_zombie_front_moving.png
|
./entity/zombie_front_still.png
|
||||||
./entity/player/hair_side.png
|
./entity/tnt.png
|
||||||
./entity/player/head_top.png
|
./entity/flare.png
|
||||||
./entity/player/head_side.png
|
./entity/boss1/boss_walking.png
|
||||||
./entity/player/head_back.png
|
|
||||||
./entity/player/head_bottom.png
|
|
||||||
./entity/player/hair_front.png
|
|
||||||
./entity/player/head_front.png
|
|
||||||
./entity/player/hair_back.png
|
|
||||||
./entity/player/hair_top.png
|
|
||||||
./entity/dummy.png
|
|
||||||
./entity/armored_zombie_front_still.png
|
|
||||||
./entity/armored_zombie_back_still.png
|
|
||||||
./entity/zombie_front_moving.png
|
|
||||||
./entity/boss1/boss_walking_firing.png
|
|
||||||
./entity/boss1/boss_firing.png
|
./entity/boss1/boss_firing.png
|
||||||
./entity/boss1/boss_still.png
|
./entity/boss1/boss_still.png
|
||||||
./entity/boss1/boss_walking.png
|
./entity/boss1/boss_walking_firing.png
|
||||||
|
./entity/armored_zombie_back_still.png
|
||||||
|
./entity/armored_zombie_front_moving.png
|
||||||
|
./entity/player/head_back.png
|
||||||
|
./entity/player/hair_top.png
|
||||||
|
./entity/player/head_front.png
|
||||||
|
./entity/player/head_top.png
|
||||||
|
./entity/player/hair_side.png
|
||||||
|
./entity/player/head_side.png
|
||||||
|
./entity/player/hair_back.png
|
||||||
|
./entity/player/hair_front.png
|
||||||
|
./entity/player/head_bottom.png
|
||||||
|
./entity/grappling_hook.png
|
||||||
./entity/zombie_back_still.png
|
./entity/zombie_back_still.png
|
||||||
./entity/zombie_front_still.png
|
./entity/dummy.png
|
||||||
./item/acorn.png
|
./entity/zombie_back_moving.png
|
||||||
./item/grappling_hook.png
|
./entity/armored_zombie_front_still.png
|
||||||
./item/gun_upgrade.png
|
./entity/zombie_front_moving.png
|
||||||
./item/shield_upgrade.png
|
./particle/smoke_1.png
|
||||||
./item/rock.png
|
./particle/water.png
|
||||||
./item/log.png
|
./particle/rain.png
|
||||||
./item/log_snow.png
|
./particle/blood.png
|
||||||
./item/hemp_seed.png
|
./particle/snow.png
|
||||||
./item/ammo_box.png
|
./particle/smoke_3.png
|
||||||
./item/plant_fibre.png
|
./particle/smoke_4.png
|
||||||
./item/health_potion.png
|
./particle/smoke_2.png
|
||||||
./item/snow_pile.png
|
./particle/smoke_0.png
|
||||||
./item/flint.png
|
./particle/bullet.png
|
||||||
./item/sandstone.png
|
./particle/lava.png
|
||||||
|
./particle/smoke_trail.png
|
||||||
|
./particle/smoke_5.png
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
Loading…
Reference in New Issue