Created
July 31, 2021 18:31
-
-
Save zsoltk/48a64e0bfee6e3f5363ca91f30a55082 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun Board( | |
fromState: GameSnapshotState, | |
toState: GameSnapshotState, | |
uiState: UiState, | |
isFlipped: Boolean = false, | |
onClick: (Position) -> Unit, | |
) { | |
BoxWithConstraints( | |
modifier = Modifier | |
.fillMaxWidth() | |
.aspectRatio(1f) | |
) { | |
val boardProperties = | |
BoardRenderProperties( | |
fromState = fromState, | |
toState = toState, | |
uiState = uiState, | |
squareSize = maxWidth / 8, | |
isFlipped = isFlipped, | |
onClick = onClick | |
) | |
DefaultBoardRenderer.decorations.forEach { | |
it.render(properties = boardProperties) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment