From 7312461b11c7b7cb6a7dcaafe6147e4f0d31edf8 Mon Sep 17 00:00:00 2001 From: oilboi <47129783+oilboi@users.noreply.github.com> Date: Thu, 15 Oct 2020 12:44:14 -0400 Subject: [PATCH] modularize version info name --- src/engine/Hud.java | 5 +++-- src/engine/Timer.java | 3 ++- src/game/Crafter.java | 6 +++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/engine/Hud.java b/src/engine/Hud.java index 645b30d..1b91b2a 100644 --- a/src/engine/Hud.java +++ b/src/engine/Hud.java @@ -13,6 +13,7 @@ import static engine.Renderer.getWindowSize; import static engine.Window.*; import static engine.sound.SoundAPI.playSound; +import static game.Crafter.getVersionName; import static game.player.Inventory.*; import static game.player.Player.*; import static org.lwjgl.glfw.GLFW.*; @@ -197,8 +198,8 @@ public static void createHud(){ createSelection(); createWorldSelectionMesh(); createCrossHair(); - versionInfoText = createCustomHudText("Crafter Pre-Alpha 0.02a", 1,1,1); - versionInfoTextShadow = createCustomHudText("Crafter Pre-Alpha 0.02a", 0,0,0); + versionInfoText = createCustomHudText(getVersionName(), 1,1,1); + versionInfoTextShadow = createCustomHudText(getVersionName(), 0,0,0); createPlayerMesh(); createInventorySelection(); createWieldHandMesh(); diff --git a/src/engine/Timer.java b/src/engine/Timer.java index 898d886..a08f7ba 100644 --- a/src/engine/Timer.java +++ b/src/engine/Timer.java @@ -1,6 +1,7 @@ package engine; import static engine.Window.updateWindowTitle; +import static game.Crafter.getVersionName; import static org.lwjgl.glfw.GLFW.glfwGetTime; public class Timer { @@ -34,7 +35,7 @@ public static void countFPS() { framesPerSecond++; if (elapsedTime >= 1_000_000_000) { // System.out.println("framerate :" + framesPerSecond); - updateWindowTitle("Crafter Pre-Alpha 0.02 | FPS: " + framesPerSecond); + updateWindowTitle(getVersionName() + " | FPS: " + framesPerSecond); framesPerSecond = 0; elapsedTime = 0; } diff --git a/src/game/Crafter.java b/src/game/Crafter.java index 5adbe55..8ac6a62 100644 --- a/src/game/Crafter.java +++ b/src/game/Crafter.java @@ -44,7 +44,11 @@ public class Crafter { private static boolean eButtonPushed = false; private static boolean F11Pushed = false; private static boolean escapePushed = false; + private static final String versionName = "Crafter Pre-Alpha 0.02b"; + public static String getVersionName(){ + return versionName; + } //core game engine elements private static final int TARGET_FPS = 75; @@ -55,7 +59,7 @@ public static void main(String[] args){ Toolkit tk = Toolkit.getDefaultToolkit(); Dimension d = tk.getScreenSize(); - initWindow("Crafter Pre-Alpha 0.02a", d.width/2,d.height/2,vSync); + initWindow(versionName, d.width/2,d.height/2,vSync); initRenderer(); initMouseInput(); initSoundManager();