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. 4
      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

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

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

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

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

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

@ -16,11 +16,7 @@ object MacosTime : Time {
fun main() {
NSApplication.sharedApplication()
Window("Falling Balls") {
val game = remember { Game(MacosTime).apply {
// TODO: rework, now we do not properly propagate geometry changes.
width = 800.dp
height = 600.dp
} }
val game = remember { Game(MacosTime) }
FallingBalls(game)
}
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 {
window = UIWindow(frame = UIScreen.mainScreen.bounds)
window!!.rootViewController = Application("Falling Balls") {
val game = remember { Game(UikitTime).apply {
width = 800.dp
height = 800.dp
} }
val game = remember { Game(UikitTime) }
Column {
// To skip upper part of screen.
Box(modifier = Modifier

Loading…
Cancel
Save