summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2022-10-15 17:15:43 +0200
committerilotterytea <iltsu@alright.party>2022-10-15 17:15:43 +0200
commit6661e7129ef8027f44ca3cba1025d753bfb85d1e (patch)
treee301eda576ad5244de30a8be2a37c9c6c5186c63 /desktop
parent0ba2d5549c44d34d98acba178bbf5e9c91cc4614 (diff)
приколы в тайтле вернулись, сучбка!
Diffstat (limited to 'desktop')
-rw-r--r--desktop/src/com/ilotterytea/maxoning/DesktopLauncher.java30
1 files changed, 19 insertions, 11 deletions
diff --git a/desktop/src/com/ilotterytea/maxoning/DesktopLauncher.java b/desktop/src/com/ilotterytea/maxoning/DesktopLauncher.java
index 3722e5f..8b07e33 100644
--- a/desktop/src/com/ilotterytea/maxoning/DesktopLauncher.java
+++ b/desktop/src/com/ilotterytea/maxoning/DesktopLauncher.java
@@ -3,17 +3,16 @@ package com.ilotterytea.maxoning;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
-import java.io.File;
-import java.io.FileNotFoundException;
import java.util.ArrayList;
+import java.util.Objects;
import java.util.Scanner;
// Please note that on macOS your application needs to be started with the -XstartOnFirstThread JVM argument
public class DesktopLauncher {
- public static void main (String[] arg) throws FileNotFoundException {
+ public static void main (String[] arg) {
Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
config.setForegroundFPS(60);
- config.setTitle("Maxon Petting Simulator");
+ config.setTitle(String.format("%s %s: %s", MaxonConstants.GAME_NAME, MaxonConstants.GAME_VERSION, getRandomLine()));
config.setWindowIcon("icon_chest.png");
config.setFullscreenMode(Lwjgl3ApplicationConfiguration.getDisplayMode());
@@ -21,15 +20,24 @@ public class DesktopLauncher {
new Lwjgl3Application(new MaxonGame(), config);
}
- private static String getRandomLine() throws FileNotFoundException {
- Scanner scan = new Scanner(new File("texts/splashes.txt"));
- ArrayList<String> strings = new ArrayList<>();
+ private static String getRandomLine() {
+ String line = "missingno";
- while (scan.hasNext()) {
- strings.add(scan.next());
+ try {
+ Scanner scanner = new Scanner(
+ Objects.requireNonNull(Thread.currentThread().getContextClassLoader().getResourceAsStream("texts/splashes.txt"))
+ );
+ ArrayList<String> strings = new ArrayList<>();
+
+ while (scanner.hasNext()) {
+ strings.add(scanner.next());
+ }
+
+ line = strings.get((int) Math.floor(Math.random() * strings.size()));
+ } catch (NullPointerException e) {
+ e.printStackTrace();
}
- return strings.get((int) Math.floor(Math.random() * strings.size()));
+ return line;
}
-
}