Add selectable piece sets and remove font-symbol pieces

Four new sets (outline, pastel, wooden, flat) next to the classic one.
The chosen set is used on the board, home screen, colour chips,
promotion and captured pieces. The font-symbol option is removed.
This commit is contained in:
2026-11-19 15:42:26 +02:00
parent e7054202a1
commit 3554907164
82 changed files with 276 additions and 154 deletions
@@ -66,6 +66,7 @@ class MainActivity : ComponentActivity() {
SoundManager.init(this)
val appContext = applicationContext
cc.skysparkle.matewave.settings.PieceSetState.load(this)
kotlin.concurrent.thread(name = "warmup", isDaemon = true) {
runCatching { cc.skysparkle.matewave.data.FriendsStore.preload() }
// Decoded here, the pieces are ready before the first board is shown.
@@ -7,44 +7,6 @@ enum class PieceType(val symbol: Char) {
}
data class Piece(val type: PieceType, val color: PieceColor) {
fun drawableRes(): Int = when (color) {
PieceColor.WHITE -> when (type) {
PieceType.PAWN -> cc.skysparkle.matewave.R.drawable.piece_white_pawn
PieceType.KNIGHT -> cc.skysparkle.matewave.R.drawable.piece_white_knight
PieceType.BISHOP -> cc.skysparkle.matewave.R.drawable.piece_white_bishop
PieceType.ROOK -> cc.skysparkle.matewave.R.drawable.piece_white_rook
PieceType.QUEEN -> cc.skysparkle.matewave.R.drawable.piece_white_queen
PieceType.KING -> cc.skysparkle.matewave.R.drawable.piece_white_king
}
PieceColor.BLACK -> when (type) {
PieceType.PAWN -> cc.skysparkle.matewave.R.drawable.piece_black_pawn
PieceType.KNIGHT -> cc.skysparkle.matewave.R.drawable.piece_black_knight
PieceType.BISHOP -> cc.skysparkle.matewave.R.drawable.piece_black_bishop
PieceType.ROOK -> cc.skysparkle.matewave.R.drawable.piece_black_rook
PieceType.QUEEN -> cc.skysparkle.matewave.R.drawable.piece_black_queen
PieceType.KING -> cc.skysparkle.matewave.R.drawable.piece_black_king
}
}
fun unicode(): String = when (color) {
PieceColor.WHITE -> when (type) {
PieceType.PAWN -> "\u2659"
PieceType.KNIGHT -> "\u2658"
PieceType.BISHOP -> "\u2657"
PieceType.ROOK -> "\u2656"
PieceType.QUEEN -> "\u2655"
PieceType.KING -> "\u2654"
}
PieceColor.BLACK -> when (type) {
PieceType.PAWN -> "\u265F"
PieceType.KNIGHT -> "\u265E"
PieceType.BISHOP -> "\u265D"
PieceType.ROOK -> "\u265C"
PieceType.QUEEN -> "\u265B"
PieceType.KING -> "\u265A"
}
}
fun fenChar(): Char =
if (color == PieceColor.WHITE) type.symbol else type.symbol.lowercaseChar()
}
@@ -22,10 +22,6 @@ class BoardAppearance(context: Context) {
get() = prefs.getBoolean(KEY_COORDS, true)
set(value) { prefs.edit().putBoolean(KEY_COORDS, value).apply() }
var useImagePieces: Boolean
get() = prefs.getBoolean(KEY_IMAGES, true)
set(value) { prefs.edit().putBoolean(KEY_IMAGES, value).apply() }
var showLastMove: Boolean
get() = prefs.getBoolean(KEY_LAST_MOVE, true)
set(value) { prefs.edit().putBoolean(KEY_LAST_MOVE, value).apply() }
@@ -45,6 +41,5 @@ class BoardAppearance(context: Context) {
const val PREFS = "board_appearance"
const val KEY_THEME = "theme"
const val KEY_COORDS = "coords"
const val KEY_IMAGES = "images"
}
}
@@ -0,0 +1,94 @@
package cc.skysparkle.matewave.settings
import android.content.Context
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import cc.skysparkle.matewave.R
import cc.skysparkle.matewave.engine.PieceColor
import cc.skysparkle.matewave.engine.PieceType
/** Piece pictures, white and black, in PieceType order: pawn, knight, bishop, rook, queen, king. */
enum class PieceSet(val titleRes: Int, private val white: IntArray, private val black: IntArray) {
CLASSIC(
R.string.piece_set_classic,
intArrayOf(
R.drawable.piece_classic_white_pawn, R.drawable.piece_classic_white_knight, R.drawable.piece_classic_white_bishop,
R.drawable.piece_classic_white_rook, R.drawable.piece_classic_white_queen, R.drawable.piece_classic_white_king
),
intArrayOf(
R.drawable.piece_classic_black_pawn, R.drawable.piece_classic_black_knight, R.drawable.piece_classic_black_bishop,
R.drawable.piece_classic_black_rook, R.drawable.piece_classic_black_queen, R.drawable.piece_classic_black_king
)
),
OUTLINE(
R.string.piece_set_outline,
intArrayOf(
R.drawable.piece_outline_white_pawn, R.drawable.piece_outline_white_knight, R.drawable.piece_outline_white_bishop,
R.drawable.piece_outline_white_rook, R.drawable.piece_outline_white_queen, R.drawable.piece_outline_white_king
),
intArrayOf(
R.drawable.piece_outline_black_pawn, R.drawable.piece_outline_black_knight, R.drawable.piece_outline_black_bishop,
R.drawable.piece_outline_black_rook, R.drawable.piece_outline_black_queen, R.drawable.piece_outline_black_king
)
),
PASTEL(
R.string.piece_set_pastel,
intArrayOf(
R.drawable.piece_pastel_white_pawn, R.drawable.piece_pastel_white_knight, R.drawable.piece_pastel_white_bishop,
R.drawable.piece_pastel_white_rook, R.drawable.piece_pastel_white_queen, R.drawable.piece_pastel_white_king
),
intArrayOf(
R.drawable.piece_pastel_black_pawn, R.drawable.piece_pastel_black_knight, R.drawable.piece_pastel_black_bishop,
R.drawable.piece_pastel_black_rook, R.drawable.piece_pastel_black_queen, R.drawable.piece_pastel_black_king
)
),
WOOD(
R.string.piece_set_wood,
intArrayOf(
R.drawable.piece_wood_white_pawn, R.drawable.piece_wood_white_knight, R.drawable.piece_wood_white_bishop,
R.drawable.piece_wood_white_rook, R.drawable.piece_wood_white_queen, R.drawable.piece_wood_white_king
),
intArrayOf(
R.drawable.piece_wood_black_pawn, R.drawable.piece_wood_black_knight, R.drawable.piece_wood_black_bishop,
R.drawable.piece_wood_black_rook, R.drawable.piece_wood_black_queen, R.drawable.piece_wood_black_king
)
),
FLAT(
R.string.piece_set_flat,
intArrayOf(
R.drawable.piece_flat_white_pawn, R.drawable.piece_flat_white_knight, R.drawable.piece_flat_white_bishop,
R.drawable.piece_flat_white_rook, R.drawable.piece_flat_white_queen, R.drawable.piece_flat_white_king
),
intArrayOf(
R.drawable.piece_flat_black_pawn, R.drawable.piece_flat_black_knight, R.drawable.piece_flat_black_bishop,
R.drawable.piece_flat_black_rook, R.drawable.piece_flat_black_queen, R.drawable.piece_flat_black_king
)
);
fun res(type: PieceType, color: PieceColor): Int =
(if (color == PieceColor.WHITE) white else black)[type.ordinal]
}
/** The chosen piece set; every board and piece picture follows it at once. */
object PieceSetState {
private const val PREFS = "board_appearance"
private const val KEY = "piece_set"
var current by mutableStateOf(PieceSet.CLASSIC)
private set
/** Reads the saved set; call once before the first frame. */
fun load(context: Context) {
val saved = prefs(context).getString(KEY, null)
current = PieceSet.entries.firstOrNull { it.name == saved } ?: PieceSet.CLASSIC
}
fun select(context: Context, set: PieceSet) {
prefs(context).edit().putString(KEY, set.name).apply()
current = set
}
private fun prefs(context: Context) =
context.applicationContext.getSharedPreferences(PREFS, Context.MODE_PRIVATE)
}
@@ -33,10 +33,11 @@ import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.IntSize
import cc.skysparkle.matewave.engine.Board
import cc.skysparkle.matewave.engine.Move
import cc.skysparkle.matewave.engine.Piece
import cc.skysparkle.matewave.engine.PieceColor
import cc.skysparkle.matewave.engine.PieceType
import cc.skysparkle.matewave.settings.BoardAppearance
import cc.skysparkle.matewave.settings.PieceSet
import cc.skysparkle.matewave.settings.PieceSetState
import cc.skysparkle.matewave.ui.theme.HighlightCheck
import cc.skysparkle.matewave.ui.theme.HighlightHint
import cc.skysparkle.matewave.ui.theme.HighlightLastMove
@@ -44,21 +45,22 @@ import cc.skysparkle.matewave.ui.theme.HighlightMove
import kotlin.math.floor
import kotlin.math.roundToInt
/** The twelve piece pictures, decoded once and shared by the board and the other piece views. */
/** The twelve pictures of the chosen piece set, decoded once and shared by the board and the other piece views. */
internal object PieceImages {
@Volatile private var cache: Array<ImageBitmap>? = null
@Volatile private var cache: Pair<PieceSet, Array<ImageBitmap>>? = null
fun get(context: Context): Array<ImageBitmap> {
cache?.let { return it }
fun get(context: Context, set: PieceSet = PieceSetState.current): Array<ImageBitmap> {
cache?.let { if (it.first == set) return it.second }
synchronized(this) {
cache?.let { return it }
cache?.let { if (it.first == set) return it.second }
val options = BitmapFactory.Options().apply { inScaled = false }
val types = PieceType.entries
val loaded = Array(PieceColor.entries.size * types.size) { i ->
val piece = Piece(types[i % types.size], PieceColor.entries[i / types.size])
BitmapFactory.decodeResource(context.resources, piece.drawableRes(), options).asImageBitmap()
val res = set.res(types[i % types.size], PieceColor.entries[i / types.size])
BitmapFactory.decodeResource(context.resources, res, options).asImageBitmap()
}
cache = loaded
// Only the set in use stays in memory.
cache = set to loaded
return loaded
}
}
@@ -91,12 +93,12 @@ fun ChessBoardView(
val appearance = remember { BoardAppearance(context) }
val theme = remember { appearance.theme }
val showCoords = remember { appearance.showCoordinates }
val imagePieces = remember { appearance.useImagePieces }
val lastMoveSetting = remember { appearance.showLastMove }
val showLastMove = highlightLastMove ?: lastMoveSetting
val showCheck = remember { appearance.showCheckHighlight }
val pieceImages = if (imagePieces) remember(context) { PieceImages.get(context) } else null
val pieceSet = PieceSetState.current
val pieceImages = remember(pieceSet) { PieceImages.get(context, pieceSet) }
val targetMask = remember(legalTargets) {
var mask = 0L
@@ -107,9 +109,6 @@ fun ChessBoardView(
val coordPaint = remember {
Paint().apply { isAntiAlias = true; typeface = Typeface.DEFAULT_BOLD }
}
val glyphPaint = remember {
Paint().apply { isAntiAlias = true; textAlign = Paint.Align.CENTER }
}
val currentOnSquareClick by rememberUpdatedState(onSquareClick)
val currentBoard by rememberUpdatedState(board)
@@ -184,13 +183,6 @@ fun ChessBoardView(
val liftedSize = pieceSize * LIFT_SCALE
val liftedDst = IntSize(liftedSize.roundToInt(), liftedSize.roundToInt())
val hoverStroke = Stroke(width = cell * 0.07f)
val glyphSize = cell * 0.62f
glyphPaint.textSize = glyphSize
val glyphMetrics = glyphPaint.fontMetrics
val glyphShift = (glyphMetrics.ascent + glyphMetrics.descent) / 2f
glyphPaint.textSize = glyphSize * LIFT_SCALE
val liftedMetrics = glyphPaint.fontMetrics
val liftedGlyphShift = (liftedMetrics.ascent + liftedMetrics.descent) / 2f
onDrawBehind {
val lastFrom = if (showLastMove) (lastMove?.from ?: -1) else -1
val lastTo = if (showLastMove) (lastMove?.to ?: -1) else -1
@@ -251,10 +243,6 @@ fun ChessBoardView(
}
}
if (pieceImages == null) {
glyphPaint.textSize = glyphSize
glyphPaint.color = GLYPH_COLOR
}
for (row in 0 until 8) {
for (col in 0 until 8) {
val displayRank = if (flipped) row else 7 - row
@@ -262,24 +250,15 @@ fun ChessBoardView(
val pieceSq = displayRank * 8 + displayFile
if (pieceSq == liftedSq) continue
val piece = board.pieceAt(pieceSq) ?: continue
if (pieceImages != null) {
drawImage(
image = pieceImages[PieceImages.indexOf(piece.type, piece.color)],
dstOffset = IntOffset(
(col * cell + inset).roundToInt(),
(row * cell + inset).roundToInt()
),
dstSize = pieceDst,
filterQuality = FilterQuality.Medium
)
} else {
drawContext.canvas.nativeCanvas.drawText(
piece.unicode(),
col * cell + cell / 2f,
row * cell + cell / 2f - glyphShift,
glyphPaint
)
}
drawImage(
image = pieceImages[PieceImages.indexOf(piece.type, piece.color)],
dstOffset = IntOffset(
(col * cell + inset).roundToInt(),
(row * cell + inset).roundToInt()
),
dstSize = pieceDst,
filterQuality = FilterQuality.Medium
)
}
}
@@ -306,25 +285,15 @@ fun ChessBoardView(
topLeft = Offset(liftedAt.x - liftedSize * 0.36f, liftedAt.y + cell * 0.05f),
size = Size(liftedSize * 0.72f, liftedSize * 0.28f)
)
if (pieceImages != null) {
drawImage(
image = pieceImages[PieceImages.indexOf(liftedPiece.type, liftedPiece.color)],
dstOffset = IntOffset(
(cx - liftedSize / 2f).roundToInt(),
(cy - liftedSize / 2f).roundToInt()
),
dstSize = liftedDst,
filterQuality = FilterQuality.Medium
)
} else {
glyphPaint.textSize = glyphSize * LIFT_SCALE
drawContext.canvas.nativeCanvas.drawText(
liftedPiece.unicode(),
cx,
cy - liftedGlyphShift,
glyphPaint
)
}
drawImage(
image = pieceImages[PieceImages.indexOf(liftedPiece.type, liftedPiece.color)],
dstOffset = IntOffset(
(cx - liftedSize / 2f).roundToInt(),
(cy - liftedSize / 2f).roundToInt()
),
dstSize = liftedDst,
filterQuality = FilterQuality.Medium
)
}
}
}
@@ -344,8 +313,6 @@ private fun squareAt(x: Float, y: Float, boardPx: Float, flipped: Boolean): Int
return displayRank * 8 + displayFile
}
private val GLYPH_COLOR = Color(0xFF1B1B1B).toArgb()
private val FILE_LABELS = Array(8) { ('a' + it).toString() }
private val RANK_LABELS = Array(8) { (it + 1).toString() }
@@ -40,6 +40,10 @@ import androidx.compose.foundation.Image
import cc.skysparkle.matewave.R
import cc.skysparkle.matewave.settings.BoardAppearance
import cc.skysparkle.matewave.settings.BoardTheme
import cc.skysparkle.matewave.settings.PieceSet
import cc.skysparkle.matewave.settings.PieceSetState
import cc.skysparkle.matewave.engine.PieceColor
import cc.skysparkle.matewave.engine.PieceType
import cc.skysparkle.matewave.ui.components.GlassCard
import cc.skysparkle.matewave.ui.components.GlassScaffold
import cc.skysparkle.matewave.ui.theme.PanelBorder
@@ -51,7 +55,6 @@ fun AppearanceScreen(onBack: () -> Unit) {
var theme by remember { mutableStateOf(appearance.theme) }
var coords by remember { mutableStateOf(appearance.showCoordinates) }
var images by remember { mutableStateOf(appearance.useImagePieces) }
var lastMove by remember { mutableStateOf(appearance.showLastMove) }
var checkGlow by remember { mutableStateOf(appearance.showCheckHighlight) }
var openingBar by remember { mutableStateOf(appearance.showOpening) }
@@ -81,7 +84,7 @@ fun AppearanceScreen(onBack: () -> Unit) {
}
) {
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp)) {
ThemePreview(candidate, showPieces = images)
ThemePreview(candidate)
Text(
stringResource(candidate.titleRes),
color = ink,
@@ -97,6 +100,43 @@ fun AppearanceScreen(onBack: () -> Unit) {
}
}
Text(
stringResource(R.string.appearance_pieces),
color = ink,
style = MaterialTheme.typography.titleMedium
)
PieceSet.entries.forEach { candidate ->
GlassCard(
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 4.dp)
.clickable {
PieceSetState.select(context, candidate)
// Decode the pictures now, so the next board opens without a pause.
val appContext = context.applicationContext
kotlin.concurrent.thread(isDaemon = true) {
runCatching { cc.skysparkle.matewave.ui.components.PieceImages.get(appContext, candidate) }
}
}
) {
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp)) {
PieceSetPreview(candidate, theme)
Text(
stringResource(candidate.titleRes),
color = ink,
style = MaterialTheme.typography.bodyLarge,
modifier = Modifier.weight(1f)
)
if (candidate == PieceSetState.current) {
cc.skysparkle.matewave.ui.components.AppIcon(
R.drawable.ic_check_box, size = 20.dp, tint = cc.skysparkle.matewave.ui.theme.ChessGreen
)
}
}
}
}
AppearanceToggle(
icon = R.drawable.ic_coordinates,
title = stringResource(R.string.appearance_coordinates),
@@ -104,13 +144,6 @@ fun AppearanceScreen(onBack: () -> Unit) {
checked = coords
) { coords = it; appearance.showCoordinates = it }
AppearanceToggle(
icon = R.drawable.ic_image_pieces,
title = stringResource(R.string.appearance_image_pieces),
subtitle = stringResource(R.string.appearance_image_pieces_hint),
checked = images
) { images = it; appearance.useImagePieces = it }
AppearanceToggle(
icon = R.drawable.ic_last_move,
title = stringResource(R.string.appearance_last_move),
@@ -220,7 +253,8 @@ private fun StyleSwatch(
}
@Composable
private fun ThemePreview(theme: BoardTheme, showPieces: Boolean) {
private fun ThemePreview(theme: BoardTheme) {
val set = PieceSetState.current
val shape = RoundedCornerShape(6.dp)
Column(modifier = Modifier.size(56.dp).clip(shape).border(1.dp, PanelBorder, shape)) {
repeat(2) { row ->
@@ -234,16 +268,16 @@ private fun ThemePreview(theme: BoardTheme, showPieces: Boolean) {
.background(if (light) theme.light else theme.dark),
contentAlignment = Alignment.Center
) {
if (showPieces && row == 0 && col == 0) {
if (row == 0 && col == 0) {
Image(
painter = painterResource(R.drawable.piece_white_king),
painter = painterResource(set.res(PieceType.KING, PieceColor.WHITE)),
contentDescription = null,
modifier = Modifier.size(22.dp)
)
}
if (showPieces && row == 1 && col == 1) {
if (row == 1 && col == 1) {
Image(
painter = painterResource(R.drawable.piece_black_knight),
painter = painterResource(set.res(PieceType.KNIGHT, PieceColor.BLACK)),
contentDescription = null,
modifier = Modifier.size(22.dp)
)
@@ -255,6 +289,34 @@ private fun ThemePreview(theme: BoardTheme, showPieces: Boolean) {
}
}
/** Four pieces of the set on squares of the chosen board. */
@Composable
private fun PieceSetPreview(set: PieceSet, theme: BoardTheme) {
val shape = RoundedCornerShape(6.dp)
val pieces = listOf(
PieceType.KING to PieceColor.WHITE,
PieceType.QUEEN to PieceColor.BLACK,
PieceType.KNIGHT to PieceColor.WHITE,
PieceType.PAWN to PieceColor.BLACK
)
Row(modifier = Modifier.clip(shape).border(1.dp, PanelBorder, shape)) {
pieces.forEachIndexed { i, (type, color) ->
Box(
modifier = Modifier
.size(36.dp)
.background(if (i % 2 == 0) theme.light else theme.dark),
contentAlignment = Alignment.Center
) {
Image(
painter = painterResource(set.res(type, color)),
contentDescription = null,
modifier = Modifier.size(32.dp)
)
}
}
}
}
@Composable
private fun AppearanceToggle(
icon: Int,
@@ -51,6 +51,9 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import cc.skysparkle.matewave.R
import cc.skysparkle.matewave.engine.PieceColor
import cc.skysparkle.matewave.engine.PieceType
import cc.skysparkle.matewave.settings.PieceSetState
import cc.skysparkle.matewave.stats.Stats
import cc.skysparkle.matewave.ui.components.AppBottomBar
import cc.skysparkle.matewave.ui.components.AppDialog
@@ -259,7 +262,7 @@ private fun Hero() {
)
}
Image(
painter = painterResource(R.drawable.piece_white_knight),
painter = painterResource(PieceSetState.current.res(PieceType.KNIGHT, PieceColor.WHITE)),
contentDescription = null,
modifier = Modifier
.align(Alignment.CenterEnd)
@@ -280,7 +283,7 @@ private fun AiCard(subtitle: String, modifier: Modifier = Modifier, onClick: ()
.clickable(onClick = onClick)
) {
Image(
painter = painterResource(R.drawable.piece_black_king),
painter = painterResource(PieceSetState.current.res(PieceType.KING, PieceColor.BLACK)),
contentDescription = null,
modifier = Modifier
.align(Alignment.TopEnd)
@@ -44,6 +44,10 @@ import cc.skysparkle.matewave.R
import cc.skysparkle.matewave.ai.AiDifficulty
import cc.skysparkle.matewave.clock.TimeControl
import cc.skysparkle.matewave.engine.PieceColor
import cc.skysparkle.matewave.engine.PieceType
import cc.skysparkle.matewave.settings.PieceSetState
import androidx.compose.ui.draw.drawWithContent
import androidx.compose.ui.graphics.drawscope.clipRect
import cc.skysparkle.matewave.ui.components.GlassButton
import cc.skysparkle.matewave.ui.components.GlassScaffold
@@ -126,9 +130,9 @@ fun VsAiSetupScreen(
SectionCaption(stringResource(R.string.your_color))
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
ColorChip(R.drawable.piece_white_king, stringResource(R.string.color_white), color == PieceColor.WHITE) { color = PieceColor.WHITE }
ColorChip(R.drawable.piece_black_king, stringResource(R.string.color_black), color == PieceColor.BLACK) { color = PieceColor.BLACK }
ColorChip(R.drawable.ic_random_colour, stringResource(R.string.color_random), color == null) { color = null }
ColorChip(listOf(PieceColor.WHITE), stringResource(R.string.color_white), color == PieceColor.WHITE) { color = PieceColor.WHITE }
ColorChip(listOf(PieceColor.BLACK), stringResource(R.string.color_black), color == PieceColor.BLACK) { color = PieceColor.BLACK }
ColorChip(listOf(PieceColor.WHITE, PieceColor.BLACK), stringResource(R.string.color_random), color == null) { color = null }
}
SectionCaption(stringResource(R.string.time_control_label))
@@ -144,7 +148,7 @@ private fun aiDescription(d: AiDifficulty): Int = when (d) {
}
@Composable
private fun ColorChip(iconRes: Int, text: String, selected: Boolean, onClick: () -> Unit) {
private fun ColorChip(kings: List<PieceColor>, text: String, selected: Boolean, onClick: () -> Unit) {
val shape = RoundedCornerShape(50)
Row(
modifier = Modifier
@@ -164,12 +168,26 @@ private fun ColorChip(iconRes: Int, text: String, selected: Boolean, onClick: ()
.background(Color(0xFF9AA0A8)),
contentAlignment = Alignment.Center
) {
Image(
painter = painterResource(iconRes),
contentDescription = null,
modifier = Modifier.size(20.dp)
)
val set = PieceSetState.current
kings.forEachIndexed { i, king ->
Image(
painter = painterResource(set.res(PieceType.KING, king)),
contentDescription = null,
modifier = Modifier
.size(20.dp)
.then(if (kings.size > 1) Modifier.halfOf(left = i == 0) else Modifier)
)
}
}
Text(text, color = ink, style = MaterialTheme.typography.bodySmall)
}
}
/** Draws only the left or the right half, for the half-white, half-black king. */
private fun Modifier.halfOf(left: Boolean): Modifier = drawWithContent {
val mid = size.width / 2f
clipRect(left = if (left) 0f else mid, right = if (left) mid else size.width) {
this@drawWithContent.drawContent()
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

@@ -1,10 +0,0 @@
<!-- Material Symbols "image" by Google, Apache License 2.0 -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M5 21q-.825 0-1.412-.587T3 19V5q0-.825.588-1.412T5 3h14q.825 0 1.413.588T21 5v14q0 .825-.587 1.413T19 21zm1-4h12l-3.75-5l-3 4L9 13z" />
</vector>
+6 -2
View File
@@ -122,10 +122,14 @@
<string name="app_style_device">Gerät</string>
<string name="app_style_device_hint">Die Farben kommen aus deinem Hintergrundbild (Material You) und ändern sich mit ihm.</string>
<string name="appearance_board_theme">Brettfarben</string>
<string name="appearance_pieces">Figuren</string>
<string name="piece_set_classic">Klassisch</string>
<string name="piece_set_outline">Kontur</string>
<string name="piece_set_pastel">Pastell</string>
<string name="piece_set_wood">Holz</string>
<string name="piece_set_flat">Flach</string>
<string name="appearance_coordinates">Buchstaben und Zahlen auf dem Brett</string>
<string name="appearance_coordinates_hint">Feldbeschriftung an den Rändern: a–h und 1–8</string>
<string name="appearance_image_pieces">Figuren als Bilder</string>
<string name="appearance_image_pieces_hint">Überall dasselbe Aussehen. Ohne das werden Figuren mit Schriftsymbolen gezeichnet und sehen auf manchen Geräten anders aus.</string>
<string name="appearance_restart_hint">Änderungen gelten beim nächsten Öffnen des Bretts.</string>
<string name="trust_first_meeting">Neuer Gegner. Fingerabdruck: %1$s – vergleiche ihn mit dem Gegner, wenn du sichergehen willst, dass er es ist</string>
<string name="account_fingerprint">Fingerabdruck deines Schlüssels</string>
+6 -2
View File
@@ -122,10 +122,14 @@
<string name="app_style_device">端末</string>
<string name="app_style_device_hint">色は壁紙から取得され(Material You)、壁紙に合わせて変わります。</string>
<string name="appearance_board_theme">盤の色</string>
<string name="appearance_pieces">駒</string>
<string name="piece_set_classic">クラシック</string>
<string name="piece_set_outline">アウトライン</string>
<string name="piece_set_pastel">パステル</string>
<string name="piece_set_wood">木製</string>
<string name="piece_set_flat">フラット</string>
<string name="appearance_coordinates">盤上の文字と数字</string>
<string name="appearance_coordinates_hint">盤の端のマス目ラベル: a〜h と 1〜8</string>
<string name="appearance_image_pieces">駒を画像で表示</string>
<string name="appearance_image_pieces_hint">どのスマホでも同じ見た目になります。オフの場合、駒はフォントの記号で描かれ、端末によって見た目が異なります。</string>
<string name="appearance_restart_hint">変更は次に盤を開いたときに反映されます。</string>
<string name="trust_first_meeting">新しい相手です。フィンガープリント: %1$s — 本人か確かめたい場合は、相手と照合してください</string>
<string name="account_fingerprint">あなたの鍵のフィンガープリント</string>
+6 -2
View File
@@ -122,10 +122,14 @@
<string name="app_style_device">Įrenginys</string>
<string name="app_style_device_hint">Spalvos paimamos iš ekrano fono („Material You“) ir keičiasi kartu su juo.</string>
<string name="appearance_board_theme">Lentos spalvos</string>
<string name="appearance_pieces">Figūros</string>
<string name="piece_set_classic">Klasikinės</string>
<string name="piece_set_outline">Kontūrinės</string>
<string name="piece_set_pastel">Pastelinės</string>
<string name="piece_set_wood">Medinės</string>
<string name="piece_set_flat">Plokščios</string>
<string name="appearance_coordinates">Raidės ir skaičiai ant lentos</string>
<string name="appearance_coordinates_hint">Langelių žymos pakraščiuose: a–h ir 1–8</string>
<string name="appearance_image_pieces">Figūros paveikslėliais</string>
<string name="appearance_image_pieces_hint">Vienoda išvaizda visuose telefonuose. Be šito figūros piešiamos šrifto simboliais ir kai kuriuose įrenginiuose atrodo kitaip.</string>
<string name="appearance_restart_hint">Pakeitimai pritaikomi kitą kartą atidarius lentą.</string>
<string name="trust_first_meeting">Naujas varžovas. Kontrolinis kodas: %1$s — palyginkite su juo, jei norite įsitikinti, kad tai jis</string>
<string name="account_fingerprint">Jūsų rakto kontrolinis kodas</string>
+6 -2
View File
@@ -127,10 +127,14 @@
<string name="app_style_device">Устройство</string>
<string name="app_style_device_hint">Цвета берутся из обоев (Material You) и меняются вместе с ними.</string>
<string name="appearance_board_theme">Цвета доски</string>
<string name="appearance_pieces">Фигуры</string>
<string name="piece_set_classic">Классические</string>
<string name="piece_set_outline">Контурные</string>
<string name="piece_set_pastel">Пастельные</string>
<string name="piece_set_wood">Деревянные</string>
<string name="piece_set_flat">Плоские</string>
<string name="appearance_coordinates">Буквы и цифры на доске</string>
<string name="appearance_coordinates_hint">Подписи полей по краям: a–h и 1–8</string>
<string name="appearance_image_pieces">Фигуры картинками</string>
<string name="appearance_image_pieces_hint">Единый вид на всех телефонах. Без этого фигуры рисуются символами шрифта и на части устройств выглядят иначе.</string>
<string name="appearance_restart_hint">Изменения применяются при следующем открытии доски.</string>
<string name="trust_first_meeting">Новый соперник. Отпечаток: %1$s — сверьте с ним, если хотите убедиться, что это он</string>
<string name="account_fingerprint">Отпечаток вашего ключа</string>
+6 -2
View File
@@ -122,10 +122,14 @@
<string name="app_style_device">设备</string>
<string name="app_style_device_hint">颜色取自壁纸(Material You),并随壁纸变化。</string>
<string name="appearance_board_theme">棋盘颜色</string>
<string name="appearance_pieces">棋子</string>
<string name="piece_set_classic">经典</string>
<string name="piece_set_outline">描边</string>
<string name="piece_set_pastel">粉彩</string>
<string name="piece_set_wood">木质</string>
<string name="piece_set_flat">扁平</string>
<string name="appearance_coordinates">棋盘上的字母和数字</string>
<string name="appearance_coordinates_hint">边缘的格子标注:a–h 和 1–8</string>
<string name="appearance_image_pieces">用图片显示棋子</string>
<string name="appearance_image_pieces_hint">所有手机外观一致。关闭后棋子将用字体符号绘制,在部分设备上会显示不同。</string>
<string name="appearance_restart_hint">更改将在下次打开棋盘时生效。</string>
<string name="trust_first_meeting">新对手。指纹:%1$s — 如需确认是对方本人,请与其核对</string>
<string name="account_fingerprint">你的密钥指纹</string>
+6 -2
View File
@@ -122,10 +122,14 @@
<string name="app_style_device">Device</string>
<string name="app_style_device_hint">Colors are taken from your wallpaper (Material You) and change with it.</string>
<string name="appearance_board_theme">Board colors</string>
<string name="appearance_pieces">Pieces</string>
<string name="piece_set_classic">Classic</string>
<string name="piece_set_outline">Outline</string>
<string name="piece_set_pastel">Pastel</string>
<string name="piece_set_wood">Wooden</string>
<string name="piece_set_flat">Flat</string>
<string name="appearance_coordinates">Letters and numbers on the board</string>
<string name="appearance_coordinates_hint">Square labels along the edges: a–h and 1–8</string>
<string name="appearance_image_pieces">Pieces as images</string>
<string name="appearance_image_pieces_hint">The same look on every phone. Without this, pieces are drawn with font symbols and look different on some devices.</string>
<string name="appearance_restart_hint">Changes apply the next time the board is opened.</string>
<string name="trust_first_meeting">New opponent. Fingerprint: %1$s — check it with them if you want to be sure it\'s really them</string>
<string name="account_fingerprint">Your key fingerprint</string>
@@ -1,3 +1,4 @@
• Vier neue Figurensätze unter Darstellung: Kontur, Pastell, Holz und Flach; der gewählte Satz gilt überall, auch auf dem Startbildschirm. Figuren als Schriftsymbole entfallen
• Unterstützungskarte mit Ko-fi-Button unten in den Einstellungen
• Links zum Quellcode führen jetzt zu GitHub
• Eine kurze Anleitung beim ersten Start mit Name und Spielstärke; erneut aufrufbar in den Einstellungen
@@ -1,3 +1,4 @@
• Four new piece sets in Appearance: outline, pastel, wooden and flat; the chosen set is used everywhere, including the home screen. The font-symbol pieces option is gone
• Support card with a Ko-fi button at the bottom of Settings
• Source code links now lead to GitHub
• A short guide on first launch, with your name and level; open it again from Settings
@@ -1,3 +1,4 @@
• 外観に4つの新しい駒セット(アウトライン、パステル、木製、フラット)。選んだセットはホーム画面を含むすべての場所に反映。フォント記号の駒は廃止
• 設定の下部にKo-fiボタン付きの支援カード
• ソースコードへのリンクはGitHubに変更
• 初回起動時の簡単なガイド(名前とレベルの設定つき)。設定から再表示できます
@@ -1,3 +1,4 @@
• Keturi nauji figūrų rinkiniai skiltyje „Išvaizda“: kontūrinės, pastelinės, medinės ir plokščios; pasirinktas rinkinys matomas visur, ir pradžios ekrane. Figūrų šrifto simboliais nebėra
• Paramos kortelė su Ko-fi mygtuku nustatymų apačioje
• Nuorodos į išeitinį kodą dabar veda į GitHub
• Trumpas gidas pirmą kartą paleidus, su vardu ir lygiu; jį vėl rasite nustatymuose
@@ -1,3 +1,4 @@
• Четыре новых набора фигур в «Оформлении»: контурные, пастельные, деревянные и плоские; выбранный набор виден везде, включая главный экран. Режим фигур-символов убран
• Карточка поддержки с кнопкой Ko-fi внизу настроек
• Ссылки на исходный код теперь ведут на GitHub
• Короткий гид при первом запуске с выбором имени и уровня; его можно открыть снова в настройках
@@ -1,3 +1,4 @@
• 外观中新增四套棋子:描边、粉彩、木质和扁平;所选棋子在所有地方生效,包括主页。移除了字体符号棋子
• 设置底部新增带 Ko-fi 按钮的支持卡片
• 源代码链接现在指向 GitHub
• 首次启动时的简短指南,可设置名字和水平;可在设置中再次打开