From 6377ee262c95537355801ee28149b87eb6d9cb9e Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Fri, 26 Aug 2022 18:23:43 +0600 Subject: Initial commit --- .../com/ilotterytea/maxoning/DesktopLauncher.java | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 desktop/src/com/ilotterytea/maxoning/DesktopLauncher.java (limited to 'desktop/src') diff --git a/desktop/src/com/ilotterytea/maxoning/DesktopLauncher.java b/desktop/src/com/ilotterytea/maxoning/DesktopLauncher.java new file mode 100644 index 0000000..c543213 --- /dev/null +++ b/desktop/src/com/ilotterytea/maxoning/DesktopLauncher.java @@ -0,0 +1,35 @@ +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.setWindowedMode(1280, 720); + //config.setFullscreenMode(Lwjgl3ApplicationConfiguration.getDisplayMode()); + + new Lwjgl3Application(new MaxonGame(), config); + } + + private static String getRandomLine() throws FileNotFoundException { + Scanner scan = new Scanner(new File("texts/splashes.txt")); + ArrayList strings = new ArrayList<>(); + + while (scan.hasNext()) { + strings.add(scan.next()); + } + + return strings.get((int) Math.floor(Math.random() * strings.size())); + } + +} -- cgit v1.2.3