Exit game screen (doesn't really work)

pull/12/head
Caroline Bell 2020-02-29 07:01:53 -08:00
parent 3e3332271f
commit 8247338f82
2 changed files with 37 additions and 2 deletions

View File

@ -3,7 +3,7 @@ package com.github.halotroop.litecraft;
import org.joml.*;
import com.github.halotroop.litecraft.save.LitecraftSave;
import com.github.halotroop.litecraft.screens.TitleScreen;
import com.github.halotroop.litecraft.screens.*;
import com.github.halotroop.litecraft.types.block.Blocks;
import com.github.halotroop.litecraft.util.RelativeDirection;
import com.github.halotroop.litecraft.world.World;
@ -52,7 +52,8 @@ public class Litecraft extends Game
@Override
public void exit()
{
engine.openScreen(null);
engine.openScreen(new ExitGameScreen());
render(); // Render the exit game screen
if (this.world != null)
{
System.out.println("Saving chunks...");

View File

@ -0,0 +1,34 @@
package com.github.halotroop.litecraft.screens;
import org.joml.*;
import com.github.hydos.ginger.engine.api.*;
import com.github.hydos.ginger.engine.font.GUIText;
import com.github.hydos.ginger.engine.io.Window;
import com.github.hydos.ginger.engine.screen.Screen;
public class ExitGameScreen extends Screen
{
private GUIText infoText;
private Ginger ginger3D = Ginger.getInstance();
public ExitGameScreen()
{
infoText = ginger3D.registerText("Saving and exiting...", 3, new Vector2f(Window.getWidth() / 2, Window.getHeight() / 2), 1f, true, "info");
infoText.setBorderWidth(0.5f);
}
@Override
public void render()
{
}
@Override
public void tick()
{}
@Override
public void close()
{ infoText.remove(); }
}