How dhnguyencs/2048_cpp works
This is a small SFML 2048 game: keyboard input enters the main loop, which asks the board to apply moves and render each frame. The board owns the grid, score, random-tile placement, and move/merge logic; tiles carry the positions and animation state used when drawing. The rounded-rectangle shape supplies a custom drawing primitive. The excerpts show these core responsibilities, but omit parts of the board implementation, so the graph keeps them within the board component rather than inventing separate stages.
Main entry points: gameBoard.cpp Board and game rules · main.cpp Window and input loop · tile.cpp Tile state and animation · RoundedRectangleShape.cpp Rounded rectangle shape
Components 5
Game application
- Window and input loop
src/main.cpp
Game state
- Board and game rules
src/gameBoard.cpp - Tile state and animation
src/tile.cpp
Drawing
- Rounded rectangle shape
src/RoundedRectangleShape.cpp
Other components
- Player
Connections 5
- Player → Window and input loop: presses keys
src/main.cpp - Window and input loop → Board and game rules: dispatches moves
src/main.cpp - Window and input loop → Board and game rules: requests rendering
src/main.cpp - Board and game rules → Tile state and animation: updates and animates
src/gameBoard.cpp - Board and game rules → Rounded rectangle shape: draws board background
src/gameBoard.cpp