Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruce0203 committed Aug 7, 2023
1 parent 7ebc778 commit 74a3643
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
1 change: 1 addition & 0 deletions client/src/commonMain/kotlin/start.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import korlibs.korge.scene.SceneContainer
import korlibs.korge.scene.sceneContainer
import korlibs.math.geom.ScaleMode
import korlibs.math.geom.Size
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.currentCoroutineContext
import kotlinx.coroutines.withContext
import network.client
Expand Down
5 changes: 4 additions & 1 deletion client/src/macosArm64Main/kotlin/main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import io.ktor.client.engine.cio.*
import korlibs.io.async.runBlockingNoSuspensions
import korlibs.io.file.std.resourcesVfs
import korlibs.io.lang.readProperties
import kotlinx.coroutines.currentCoroutineContext
import kotlinx.coroutines.withContext
import network.ClientEngineFactory
import network.URLProvider
Expand All @@ -10,13 +11,15 @@ import org.koin.core.qualifier.named
import org.koin.dsl.bind
import org.koin.dsl.module
import org.koin.mp.KoinPlatform
import util.launchNow
import kotlin.coroutines.CoroutineContext

class Main

fun runMain() = main()

fun main() {
runBlockingNoSuspensions {
launchNow {
val clientProps = resourcesVfs["client.properties"].readProperties()
val url = clientProps["server"]!!
val version = clientProps["version"]!!
Expand Down
39 changes: 39 additions & 0 deletions client/src/mingwX64Main/kotlin/main.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import io.ktor.client.engine.winhttp.*
import korlibs.io.async.runBlockingNoSuspensions
import korlibs.io.file.std.resourcesVfs
import korlibs.io.lang.readProperties
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withContext
import network.ClientEngineFactory
import network.URLProvider
import org.koin.core.context.startKoin
import org.koin.core.qualifier.named
import org.koin.dsl.bind
import org.koin.dsl.module
import org.koin.mp.KoinPlatform
import util.launchNow

class Main

fun runMain() = main()

fun main() {
launchNow {
val clientProps = resourcesVfs["client.properties"].readProperties()
val url = clientProps["server"]!!
val version = clientProps["version"]!!
startKoin {}
KoinPlatform.getKoin().loadModules(listOf(module {
single(named("version")) { version }
factory {
object : URLProvider {
override val url: String get() = url
}
} bind URLProvider::class
factory {
object : ClientEngineFactory { override fun getEngine() = WinHttp }
} bind ClientEngineFactory::class
}))
start()
}
}

0 comments on commit 74a3643

Please sign in to comment.