Browse Source

minesweeper: use painterResource from resource library. (#2760)

pull/2761/head
Nikita Lipsky 2 years ago committed by GitHub
parent
commit
de0a081c12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      experimental/examples/minesweeper/shared/build.gradle.kts
  2. 8
      experimental/examples/minesweeper/shared/src/commonMain/kotlin/game.kt

2
experimental/examples/minesweeper/shared/build.gradle.kts

@ -55,7 +55,7 @@ kotlin {
implementation(compose.foundation)
implementation(compose.material)
implementation(compose.runtime)
implementation("org.jetbrains.compose.components:components-resources:$composeVersion")
implementation("org.jetbrains.compose.components:components-resources:1.4.0-alpha01-dev942")
}
}
val commonTest by getting {

8
experimental/examples/minesweeper/shared/src/commonMain/kotlin/game.kt

@ -6,18 +6,16 @@ import androidx.compose.foundation.layout.*
import androidx.compose.material.*
import androidx.compose.ui.*
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.painter.BitmapPainter
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.unit.*
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.orEmpty
import org.jetbrains.compose.resources.rememberImageBitmap
import org.jetbrains.compose.resources.resource
import org.jetbrains.compose.resources.painterResource
import kotlin.math.max
@OptIn(ExperimentalResourceApi::class)
@Composable
internal fun loadImage(res: String): Painter = BitmapPainter(resource(res).rememberImageBitmap().orEmpty())
internal fun loadImage(res: String): Painter = painterResource(res)
expect fun hasRightClick(): Boolean

Loading…
Cancel
Save