Skip to content

Commit

Permalink
Speed up UI launch time
Browse files Browse the repository at this point in the history
  • Loading branch information
DRSchlaubi committed Feb 22, 2025
1 parent e5a2d55 commit 81e1417
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
1 change: 0 additions & 1 deletion client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ compose.desktop {
packageName = "GTA Killer"

windows {
console = true
menuGroup = "GTA Killer"
upgradeUuid = "8193b8f9-1355-4d0f-9c6f-6619d0f18604"
}
Expand Down
39 changes: 36 additions & 3 deletions client/src/main/kotlin/Launcher.kt
Original file line number Diff line number Diff line change
@@ -1,15 +1,48 @@
package dev.schlaubi.mastermind

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.window.singleWindowApplication
import dev.schlaubi.mastermind.core.registerKeyBoardListener
import dev.schlaubi.mastermind.theme.AppTheme
import dev.schlaubi.mastermind.ui.GTAKiller
import dev.schlaubi.mastermind.windows_helper.WindowsAPI

fun main() {
WindowsAPI.registerKeyboardHook()
registerKeyBoardListener()

singleWindowApplication(title = "GTA Killer") {
var loading by remember { mutableStateOf(true) }
if (loading) {
SideEffect {
WindowsAPI.registerKeyboardHook()
registerKeyBoardListener()
}

AppTheme {
Scaffold {
Column(
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.fillMaxSize()
) {
CircularProgressIndicator()
Text(
"Launching App ...",
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurface
)
}
}
}
}

GTAKiller()
}
}

0 comments on commit 81e1417

Please sign in to comment.