Package-level declarations

Overview

Screen for creating a new game with player configuration options.

Components

  • NewGamePage — New game creation page composable

  • NewGameViewModel — State management for game creation

Responsibilities

  • Configuring game parameters (player names, types, board size)

  • Validating game creation inputs

  • Initiating new game sessions

Types

Link copied to clipboard
data class NewGameUiState(val screenState: ScreenState = ScreenState()) : UiState

UI state for the new game screen.

Link copied to clipboard
class NewGameViewModel(val scope: CoroutineScope, val appState: AppStateImpl, val globalError: ReversiException? = null, val setGlobalError: (Exception?, ErrorType?) -> Unit, val createGame: (Game) -> Unit) : ViewModel<NewGameUiState>

ViewModel that builds local or remote games based on user inputs. Validates piece selection, triggers game creation, and exposes UI state/errors.

Functions

Link copied to clipboard
@Composable
fun ReversiScope.NewGamePage(viewModel: NewGameViewModel, playerNameChange: (String) -> Unit, onLeave: () -> Unit)

New game page for creating a local game with piece selection. Allows the user to choose their piece color and start a new game.

Link copied to clipboard
@Composable
private fun ReversiScope.NewGamePageView(modifier: Modifier, onClick: (Game, Int, String?) -> Unit)

Shared UI for new game page with piece selection and game initiation. Provides input fields for game name, player name, board size, and a dropdown menu for piece selection.

Link copied to clipboard
private fun String.parseBoardSize(): Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard