Skip to content

Commit

Permalink
modularize version info name
Browse files Browse the repository at this point in the history
  • Loading branch information
oilboi committed Oct 15, 2020
1 parent 855ab18 commit 7312461
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/engine/Hud.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand Down Expand Up @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion src/engine/Timer.java
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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;
}
Expand Down
6 changes: 5 additions & 1 deletion src/game/Crafter.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down

0 comments on commit 7312461

Please sign in to comment.