diff --git a/wordle-compose-mosaic/src/main/java/net/opatry/game/wordle/mosaic/component/alphabet.kt b/wordle-compose-mosaic/src/main/java/net/opatry/game/wordle/mosaic/component/alphabet.kt new file mode 100644 index 0000000..727705d --- /dev/null +++ b/wordle-compose-mosaic/src/main/java/net/opatry/game/wordle/mosaic/component/alphabet.kt @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2022 Olivier Patry + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software + * is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package net.opatry.game.wordle.mosaic.component + +import androidx.compose.runtime.Composable +import com.jakewharton.mosaic.Column +import com.jakewharton.mosaic.Row +import net.opatry.game.wordle.AnswerFlag + +@Composable +fun Alphabet(alphabet: Map) { + Column { + alphabet.keys.chunked(9).forEach { row -> + Row { + row.forEach { letter -> + WordleCharCell(letter, alphabet[letter]!!) + } + } + } + } +} diff --git a/wordle-compose-mosaic/src/main/java/net/opatry/game/wordle/mosaic/wordleComposeMosaic.kt b/wordle-compose-mosaic/src/main/java/net/opatry/game/wordle/mosaic/wordleComposeMosaic.kt index 6cd2d8e..6f4e398 100644 --- a/wordle-compose-mosaic/src/main/java/net/opatry/game/wordle/mosaic/wordleComposeMosaic.kt +++ b/wordle-compose-mosaic/src/main/java/net/opatry/game/wordle/mosaic/wordleComposeMosaic.kt @@ -35,6 +35,8 @@ import net.opatry.game.wordle.Answer import net.opatry.game.wordle.AnswerFlag import net.opatry.game.wordle.State import net.opatry.game.wordle.WordleRules +import net.opatry.game.wordle.mosaic.component.Alphabet +import net.opatry.game.wordle.mosaic.component.WordleGrid import net.opatry.game.wordle.toEmoji import net.opatry.game.wordle.ui.WordleViewModel import org.jline.terminal.TerminalBuilder @@ -108,7 +110,12 @@ fun GameScreen(viewModel: WordleViewModel) { Column { Text("") - WordleGrid(viewModel.grid) + Row { + Text(" ") + WordleGrid(viewModel.grid) + Text(" ") + Alphabet(viewModel.alphabet) + } when (val state = viewModel.state) { is State.Won -> {