DEADSOFTWARE

Add desktop debug option
[cavedroid.git] / desktop / src / ru / deadsoftware / cavedroid / desktop / DesktopLauncher.java
index cc0bb932a0db15561b05e494c12f8ea1f8b6cd19..fe78235dd8fe5bc0ec937561b82ae1a9b4f6e87e 100644 (file)
@@ -6,21 +6,37 @@ import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
 import ru.deadsoftware.cavedroid.CaveGame;
 
 class DesktopLauncher {
-       public static void main (String[] arg) {
-               Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
-               config.setWindowIcon(Files.FileType.Internal, "icons/icon256.png", "icons/icon128.png");
-//             config.setForegroundFPS(144);
+    public static void main(String[] arg) {
+        Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
+        config.setWindowIcon(Files.FileType.Internal, "icons/icon256.png", "icons/icon128.png");
         config.setTitle("CaveDroid");
-               config.setWindowedMode(960, 540);
-               config.useVsync(false);
+        config.setWindowedMode(960, 540);
+        config.useVsync(true);
 
-               boolean touch = false;
-               for (String anArg : arg) {
+        boolean touch = false;
+        boolean debug = false;
+        String assetsPath = null;
+
+        for (String anArg : arg) {
             if (anArg.equals("--touch")) {
                 touch = true;
-                break;
             }
-               }
-        new Lwjgl3Application(new CaveGame(System.getProperty("user.home") + "/.cavedroid", touch), config);
-       }
+
+            if (anArg.equals("--debug")) {
+                debug = true;
+            }
+
+            if (anArg.startsWith("--assets")) {
+                String[] splitArg = anArg.split("=");
+                if (splitArg.length >= 2) {
+                    assetsPath = splitArg[1];
+                }
+            }
+        }
+
+        CaveGame caveGame = new CaveGame(System.getProperty("user.home") + "/.cavedroid", touch, assetsPath);
+        caveGame.setDebug(debug);
+
+        new Lwjgl3Application(caveGame, config);
+    }
 }