How igord69/snake_game works
Snake Game is a C++ game whose main workflow is started by main.cpp, then orchestrated by Engine: it initializes the board, snake, and apple; reads Raylib keyboard/window state, advances movement and collision/eating logic, and sends a character-grid image and score text to the Raylib renderer. Core gameplay and rendering calls are visible in the excerpts. Other indexed modules document map, position, direction, and input abstractions, but their runtime relationships are not inferred where callers were not shown.
Main entry points: Engine.cpp Game engine · Player.cpp Player · Renderer.cpp Raylib renderer · Apple.cpp Apple
Components 13
Game orchestration
- Game engine
Engine.cpp - Application entry
main.cpp
Rendering
- Raylib renderer
Renderer.cpp - Renderer contract
Abstract_Renderer.hpp
Input abstractions
- Listener contract
AbstractListener.hpp - Terminal listener
CmdListener.cpp
Other components
- Player
- Raylib
Connections 18
- Application entry → Game engine: starts
main.cpp - Game engine → Map: initializes
Engine.cpp - Game engine → Player: initializes
Engine.cpp - Game engine → Apple: initializes
Engine.cpp - Game engine → Player: moves and checks
Engine.cpp - Game engine → Player: eats apple
Engine.cpp - Game engine → Apple: replaces
Engine.cpp - Game engine → Raylib renderer: draws through
Engine.cpp - Game engine → Raylib renderer: reads window input
Engine.cpp - Game engine → Raylib renderer: sends game image
Engine.cpp - Raylib renderer → Renderer contract: implements
- Raylib renderer → Raylib: renders with
- Player → Position: stores coordinates
Player.cpp - Player → Direction: moves by
- Apple → Position: stores coordinates
- Renderer contract → Position: uses coordinates
Abstract_Renderer.hpp - Player → Game engine: controls
README.md - Terminal listener → Listener contract: implements