[WIP] Ingame HUD

No idea what that last commit actually did!
pull/12/head
Caroline Bell 2020-02-28 22:01:33 -08:00
parent 7b189e71d9
commit 5775793a80
3 changed files with 45 additions and 2 deletions

View File

@ -0,0 +1,45 @@
package com.github.halotroop.litecraft.screens;
import org.joml.*;
import com.github.halotroop.litecraft.Litecraft;
import com.github.hydos.ginger.engine.api.*;
import com.github.hydos.ginger.engine.font.GUIText;
import com.github.hydos.ginger.engine.screen.Screen;
public class IngameHUD extends Screen
{
private GUIText debugText;
private GUIText positionText;
private Ginger ginger3D = Ginger.getInstance();
private Litecraft litecraft = Litecraft.getInstance();
public IngameHUD()
{
debugText = ginger3D.registerText("Loading...", 2, new Vector2f(0, 0), 1f, true, "debugInfo");
debugText.setBorderWidth(0.5f);
positionText = ginger3D.registerText("Loading...", 2, new Vector2f(5, 5), 1f, true, "debugInfo");
positionText.setBorderWidth(0.5f);
}
@Override
public void render()
{
}
@Override
public void tick()
{
Vector4i dbg = litecraft.dbgStats;
debugText.setText("FPS: " + dbg.x() + " UPS: " + dbg.y + " TPS: " + dbg.z);
positionText.setText("Position " + GingerRegister.getInstance().game.data.player.getPosition().toString());
}
@Override
public void close()
{
}
}

View File

@ -67,8 +67,6 @@ public class TitleScreen extends Screen
public void close()
{
this.debugText.remove();
this.debugText = null;
this.playButton.hide(this.elements);
this.playButton = null;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB