summaryrefslogtreecommitdiff
path: root/desktop/src/com/ilotterytea/maxoning/DesktopLauncher.java
blob: 2b15f4c973d1f04560618f20c432a8935cf97f1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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.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 {
		Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
		config.setForegroundFPS(60);
		config.setTitle(String.format("Maxon Petting Simulator - %s", getRandomLine()));
		config.setWindowIcon("icon.png");
		config.setMaximized(true);

		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<>();

		while (scan.hasNext()) {
			strings.add(scan.next());
		}

		return strings.get((int) Math.floor(Math.random() * strings.size()));
	}

}