Browse Source

move Compose submodule and update mpp demo (#1678)

Co-authored-by: Oleksandr Karpovich <oleksandr.karpovich@jetbrains.com>
pull/1682/head
Oleksandr Karpovich 3 years ago committed by GitHub
parent
commit
a7ea7b7767
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      compose/frameworks/support
  2. 8
      examples/falling-balls-mpp/src/commonMain/kotlin/fallingBalls/FallingBalls.kt
  3. 6
      examples/falling-balls-mpp/src/jsMain/kotlin/main.js.kt
  4. 6
      examples/falling-balls-mpp/src/macosMain/kotlin/main.macos.kt
  5. 5
      examples/falling-balls-mpp/src/uikitMain/kotlin/main.uikit.kt

2
compose/frameworks/support

@ -1 +1 @@
Subproject commit 50a86035871957ff062b5f4316475fcc8dc80fda Subproject commit fe220467abcf2368966a051b732752513ffeceda

8
examples/falling-balls-mpp/src/commonMain/kotlin/fallingBalls/FallingBalls.kt

@ -66,12 +66,8 @@ fun FallingBalls(game: Game) {
.fillMaxHeight(1f) .fillMaxHeight(1f)
.onSizeChanged { .onSizeChanged {
with(density) { with(density) {
if (org.jetbrains.skiko.kotlinBackend == KotlinBackend.JVM) { game.width = it.width.toDp()
// Really ugly hack, until we properly pass geometry. game.height = it.height.toDp()
// TODO: fix me in Compose.
game.width = it.width.toDp()
game.height = it.height.toDp()
}
} }
} }
) { ) {

6
examples/falling-balls-mpp/src/jsMain/kotlin/main.js.kt

@ -15,11 +15,7 @@ object JsTime : Time {
fun main() { fun main() {
onWasmReady { onWasmReady {
Window("Falling Balls") { Window("Falling Balls") {
val game = remember { Game(JsTime).apply { val game = remember { Game(JsTime) }
// Ugly hack, properly pass geometry.
width = 800.dp
height = 800.dp
}}
FallingBalls(game) FallingBalls(game)
} }
} }

6
examples/falling-balls-mpp/src/macosMain/kotlin/main.macos.kt

@ -16,11 +16,7 @@ object MacosTime : Time {
fun main() { fun main() {
NSApplication.sharedApplication() NSApplication.sharedApplication()
Window("Falling Balls") { Window("Falling Balls") {
val game = remember { Game(MacosTime).apply { val game = remember { Game(MacosTime) }
// TODO: rework, now we do not properly propagate geometry changes.
width = 800.dp
height = 600.dp
} }
FallingBalls(game) FallingBalls(game)
} }
NSApp?.run() NSApp?.run()

5
examples/falling-balls-mpp/src/uikitMain/kotlin/main.uikit.kt

@ -45,10 +45,7 @@ class SkikoAppDelegate : UIResponder, UIApplicationDelegateProtocol {
override fun application(application: UIApplication, didFinishLaunchingWithOptions: Map<Any?, *>?): Boolean { override fun application(application: UIApplication, didFinishLaunchingWithOptions: Map<Any?, *>?): Boolean {
window = UIWindow(frame = UIScreen.mainScreen.bounds) window = UIWindow(frame = UIScreen.mainScreen.bounds)
window!!.rootViewController = Application("Falling Balls") { window!!.rootViewController = Application("Falling Balls") {
val game = remember { Game(UikitTime).apply { val game = remember { Game(UikitTime) }
width = 800.dp
height = 800.dp
} }
Column { Column {
// To skip upper part of screen. // To skip upper part of screen.
Box(modifier = Modifier Box(modifier = Modifier

Loading…
Cancel
Save