Skip to content

Commit 6aafb76

Browse files
committed
Show a found trio on the Trio menu tile
A 2x2 board with three cards lit green as a trio beside a decoy, instead of a row of circles that said nothing about the rule.
1 parent 78ad063 commit 6aafb76

1 file changed

Lines changed: 40 additions & 19 deletions

File tree

  • composeApp/src/commonMain/kotlin/com/inspiredandroid/braincup/ui/components

‎composeApp/src/commonMain/kotlin/com/inspiredandroid/braincup/ui/components/GameTile.kt‎

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import androidx.compose.ui.geometry.Size
1919
import androidx.compose.ui.graphics.Color
2020
import androidx.compose.ui.graphics.ColorFilter
2121
import androidx.compose.ui.graphics.StrokeCap
22+
import androidx.compose.ui.graphics.compositeOver
2223
import androidx.compose.ui.graphics.drawscope.translate
2324
import androidx.compose.ui.graphics.vector.rememberVectorPainter
2425
import androidx.compose.ui.platform.LocalDensity
@@ -43,6 +44,7 @@ import com.inspiredandroid.braincup.games.GameType
4344
import com.inspiredandroid.braincup.games.PrismTileType
4445
import com.inspiredandroid.braincup.games.RuleShiftGame
4546
import com.inspiredandroid.braincup.games.SimonSaysGame
47+
import com.inspiredandroid.braincup.games.TrioCard
4648
import com.inspiredandroid.braincup.games.TrioFill
4749
import com.inspiredandroid.braincup.games.TrioShape
4850
import com.inspiredandroid.braincup.games.formattedScore
@@ -2547,29 +2549,48 @@ private fun FlagsPreview() {
25472549
}
25482550
}
25492551

2550-
private val TrioPreviewGlyphs = listOf(1, 2, 3)
2552+
/**
2553+
* A board in miniature with the trio already found: three cards lit green, one shape each and a
2554+
* single mark so the shapes stay readable at tile size, beside a decoy. Raised and opaque rather
2555+
* than the game's pressed, translucent correct face, which reads as mud on the tile's background.
2556+
*/
2557+
private val TrioPreviewCards = listOf(
2558+
TrioCard(TrioShape.CIRCLE, 1, TrioFill.SOLID) to true,
2559+
TrioCard(TrioShape.SQUARE, 2, TrioFill.OUTLINE) to false,
2560+
TrioCard(TrioShape.TRIANGLE, 1, TrioFill.OUTLINE) to true,
2561+
TrioCard(TrioShape.SQUARE, 1, TrioFill.STRIPED) to true,
2562+
)
2563+
2564+
private val TrioPreviewFoundFace = SuccessGreen.copy(alpha = 0.4f).compositeOver(Color.White)
25512565

25522566
@Composable
25532567
private fun TrioPreview() {
2554-
val ink = GameColor.RED.composeColor()
2555-
Row(
2556-
modifier = Modifier
2557-
.fillMaxHeight()
2558-
.aspectRatio(1f)
2559-
.padding(16.dp),
2560-
horizontalArrangement = Arrangement.spacedBy(6.dp),
2561-
verticalAlignment = Alignment.CenterVertically,
2568+
Column(
2569+
modifier = Modifier.fillMaxHeight().aspectRatio(1f).padding(24.dp),
2570+
horizontalAlignment = Alignment.CenterHorizontally,
2571+
verticalArrangement = Arrangement.Center,
25622572
) {
2563-
TrioPreviewGlyphs.forEach { count ->
2564-
TrioCardGlyphs(
2565-
shape = TrioShape.CIRCLE,
2566-
count = count,
2567-
fill = TrioFill.SOLID,
2568-
color = ink,
2569-
modifier = Modifier
2570-
.weight(1f)
2571-
.aspectRatio(1f),
2572-
)
2573+
TrioPreviewCards.chunked(2).forEach { row ->
2574+
Row(modifier = Modifier.fillMaxWidth()) {
2575+
row.forEach { (card, found) ->
2576+
PrismCard(
2577+
face = if (found) TrioPreviewFoundFace else MaterialTheme.colorScheme.surfaceContainer,
2578+
facet = PrismFacet.Cell,
2579+
modifier = Modifier
2580+
.weight(1f)
2581+
.aspectRatio(1f)
2582+
.padding(2.dp),
2583+
) {
2584+
TrioCardGlyphs(
2585+
shape = card.shape,
2586+
count = card.count,
2587+
fill = card.fill,
2588+
color = Color.Black,
2589+
modifier = Modifier.fillMaxSize(),
2590+
)
2591+
}
2592+
}
2593+
}
25732594
}
25742595
}
25752596
}

0 commit comments

Comments
 (0)