How zadnap/tetris works
This is a raylib-based desktop Tetris game. The runtime loop in main initializes gameplay, input, rendering, and audio, then handles menus and active play; gameplay state and board/tetromino logic provide the game result. The graph preserves the major runtime modules and their visible connections. Some internal calls are not excerpted, so only documented or source-index-supported relationships are shown; uncertain links are omitted.
Main entry points: game.cpp Game State · main.cpp Main Loop · userInterface.cpp User Interface · tetromino.cpp Tetromino Model
Components 13
Game Runtime
- Main Loop
src/main.cpp
Gameplay Model
- Game State
src/game.cpp - Board
src/board.cpp - Tetromino Shapes
src/tetrominoes.cpp - Tetromino Model
src/tetromino.cpp - Grid Position
src/position.cpp - Game Utilities
src/utils.cpp
Input And Display
- Input Handler
src/inputHandler.cpp - User Interface
src/userInterface.cpp - Color Palette
src/colors.cpp
Audio
- Audio Handler
src/audioHandler.cpp - Audio Assets
assets/audio
Other components
- Player
Connections 14
- Player → Main Loop: plays
- Main Loop → Game State: updates
src/main.cpp - Main Loop → Input Handler: handles input
src/main.cpp - Main Loop → User Interface: draws screens
src/main.cpp - Main Loop → Audio Handler: controls audio
src/main.cpp - Main Loop → Audio Assets: loads files
src/main.cpp - Input Handler → Game State: controls
- User Interface → Game State: reads state
- User Interface → Color Palette: uses palette
- Game State → Board: owns board
- Game State → Tetromino Shapes: creates shapes
- Game State → Tetromino Model: uses pieces
- Game State → Game Utilities: uses timing
- Tetromino Model → Grid Position: stores cells