Added some extra new features

-Added: Clearing Depth Buffer before UI Renders.
-Added: Rotation reference into facing.
-Added: Access to the currentFrame
-Code Cleanup
This commit is contained in:
Speiger 2021-09-30 14:09:03 +02:00
parent d7164fb152
commit 6e57f72ac2
4 changed files with 23 additions and 3 deletions

View File

@ -47,7 +47,7 @@ public abstract class Application
protected FontManager fonts = new FontManager();
protected ProjectionBuffer projectionBuffer;
protected GuiManager uiManager;
public void run()
{
GLFWErrorCallback.createPrint(System.err).set();
@ -110,12 +110,14 @@ public abstract class Application
public abstract Window createWindow(WindowProvider provider) throws Exception;
public void preinit() {}
public abstract void init(File file);
public void preUpdate() {}
public abstract void update();
public abstract void render(float particalTicks);
public abstract void destroy();
protected final void updateInternal()
{
preUpdate();
if(uiManager != null)
{
clientProfiler.start("UI");
@ -178,6 +180,11 @@ public abstract class Application
return timer;
}
public FontManager getFonts()
{
return fonts;
}
public GuiManager getUiManager()
{
return uiManager;
@ -192,4 +199,9 @@ public abstract class Application
{
return gpuProfiler;
}
}
public long getFrame()
{
return executor.frame;
}
}

View File

@ -20,6 +20,7 @@ public enum Facing
final Axis axis;
final Vec2i offset;
final boolean positive;
final Rotation rotation;
private Facing(int direction, int rotation, String display, Axis axis, Vec2i offset)
{
@ -29,6 +30,7 @@ public enum Facing
this.axis = axis;
this.offset = offset;
positive = index < 2;
this.rotation = Rotation.fromFacing(this);
}
public int getIndex()
@ -88,6 +90,11 @@ public enum Facing
return getRotation();
}
public Rotation toRotation()
{
return rotation;
}
public Facing rotate(int amount)
{
return byIndex(index + amount);

View File

@ -156,6 +156,7 @@ public abstract class GuiManager implements IWindowListener
protected Vec2i start()
{
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
GLUtils.DEBTH_TEST.push(false);
GLUtils.CULL_FACE.push(false);
GLUtils.BLEND.setFunction(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA).push(true);

View File

@ -69,7 +69,7 @@ public class MainThreadTaskProcessor
ITask task = tasks.dequeue();
try
{
task.execute();
task.execute();
}
catch(InterruptedException e)
{