How bradhillier/pixel-chess works
Pixel-Chess is a chess game organized around an MVC boundary: the frontend handles user interaction and presentation, while a controller mediates access to the chessboard and its rules. The principal flow is user input in the playing state, controller processing, board and piece rule evaluation, then refreshed board state for display. The main executable runs the menu/playing/help/credits state loop. The tree also contains a separate SDL_TEST frontend; its state implementation is distinct from the main game path. Some state implementations and piece-specific rules were not excerpted, so their internal links are omitted.
Main entry points: chessboard.cpp Chessboard state · sdl_chess_game.cpp Game loop · playing.cpp Playing view · GameState.cpp SDL test states
Components 21
Game application
- Game entry
src/main.cpp - Game loop
src/sdl_chess_game.cpp - State lifecycle
src/state.cpp - SDL test entry
FrontEnd/SDL_TEST/main.cpp - Test state machine
FrontEnd/SDL_TEST/GameStateMachine/GameStateMachine.cpp
Presentation states
- Main menu
src/main_menu.cpp - Playing view
src/playing.cpp - Help view
src/help.cpp - Credits view
src/credits.cpp - Visual effects
src/effects.cpp - SDL test states
FrontEnd/SDL_TEST/GameState.cpp
Chess gameplay
- Game controller
src/chess_controller.cpp - Chessboard state
src/chessboard.cpp
Piece rules
- Piece movement base
src/piece.cpp - Pawn rules
src/pawn.cpp - Rook rules
src/rook.cpp - Knight rules
src/knight.cpp - Bishop rules
src/bishop.cpp - Queen rules
src/queen.cpp - King rules
src/king.cpp
Other components
- Player
Connections 18
- Game entry → Game loop: runs loop
src/main.cpp - Game loop → Main menu: manages states
src/sdl_chess_game.cpp - Game loop → Playing view: manages states
src/sdl_chess_game.cpp - Game loop → Help view: manages states
- Game loop → Credits view: manages states
- Playing view → Game controller: handles input
- Game controller → Chessboard state: processes moves
src/chess_controller.cpp - Chessboard state → Piece movement base: queries movement
src/chessboard.cpp - Chessboard state → Pawn rules: creates pieces
src/chessboard.cpp - Chessboard state → Rook rules: creates pieces
src/chessboard.cpp - Chessboard state → Knight rules: creates pieces
src/chessboard.cpp - Chessboard state → Bishop rules: creates pieces
src/chessboard.cpp - Chessboard state → Queen rules: creates pieces
src/chessboard.cpp - Chessboard state → King rules: creates pieces
src/chessboard.cpp - Player → Playing view: plays game
README.md - SDL test entry → SDL test states: updates state
FrontEnd/SDL_TEST/main.cpp - SDL test states → Game controller: uses controller
- Test state machine → SDL test states: manages states