DEADSOFTWARE

Add desktop debug option
[cavedroid.git] / desktop / src / ru / deadsoftware / cavedroid / desktop / DesktopLauncher.java
index 025beb484ed0e573abf795d267d3705feac6ee7b..fe78235dd8fe5bc0ec937561b82ae1a9b4f6e87e 100644 (file)
@@ -6,35 +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");
+    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(true);
+        config.setWindowedMode(960, 540);
+        config.useVsync(true);
 
-               boolean touch = false;
-               String assetsPath = null;
+        boolean touch = false;
+        boolean debug = false;
+        String assetsPath = null;
 
-               for (String anArg : arg) {
+        for (String anArg : arg) {
             if (anArg.equals("--touch")) {
                 touch = true;
             }
 
-                       if (anArg.startsWith("--assets")) {
-                               String[] splitArg = anArg.split("=");
-                               if (splitArg.length >= 2) {
-                                       assetsPath = splitArg[1];
-                               }
-                       }
-               }
-
-        new Lwjgl3Application(
-                               new CaveGame(
-                                               System.getProperty("user.home") + "/.cavedroid",
-                                               touch,
-                                               assetsPath),
-                               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);
+    }
 }