DEADSOFTWARE

Update version script
[cavedroid.git] / desktop / src / main / kotlin / ru / deadsoftware / cavedroid / desktop / DesktopLauncher.kt
1 package ru.deadsoftware.cavedroid.desktop
3 import com.badlogic.gdx.Files
4 import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application
5 import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration
6 import ru.deadsoftware.cavedroid.CaveGame
8 internal object DesktopLauncher {
10 @JvmStatic
11 fun main(arg: Array<String>) {
12 val config = Lwjgl3ApplicationConfiguration()
14 with(config) {
15 setWindowIcon(
16 /* fileType = */ Files.FileType.Internal,
17 /* ...filePaths = */ "icons/icon512.png", "icons/icon256.png", "icons/icon128.png"
18 )
19 setTitle("CaveDroid")
20 setWindowedMode(960, 540)
21 useVsync(true)
22 }
24 var touch = false
25 var debug = false
26 var assetsPath: String? = null
28 for (anArg in arg) {
29 if (anArg == "--touch") {
30 touch = true
31 }
33 if (anArg == "--debug") {
34 debug = true
35 }
37 if (anArg.startsWith("--assets")) {
38 val splitArg: Array<String> = anArg.split("=".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
39 if (splitArg.size >= 2) {
40 assetsPath = splitArg[1]
41 }
42 }
43 }
45 val caveGame = CaveGame(
46 gameDataDirectoryPath = System.getProperty("user.home") + "/.cavedroid",
47 isTouchScreen = touch,
48 isDebug = debug,
49 preferencesStore = DesktopPreferencesStore(),
50 )
52 Lwjgl3Application(caveGame, config)
53 }
54 }