# kareem-hany-77/lantern-keeper architecture

> Architecture diagram of the GitHub repository kareem-hany-77/lantern-keeper, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kareem-hany-77/lantern-keeper
- Repository: https://github.com/kareem-hany-77/lantern-keeper

## Overview

Lantern Keeper is a small GLUT platform game. The player selects survival or a numbered level, enters the play screen, and moves and jumps across platforms; gameplay draws the world and HUD. The graph reflects the implemented prototype, including menu/input dispatch, movement and rendering. The README gives no further capability detail, and sampled gameplay explicitly leaves levels and other mechanics as future work; unsampled modules are represented only where the source index supports them.

Main entry points: [`src/gameplay/play.cpp`](https://github.com/kareem-hany-77/lantern-keeper/blob/main/src/gameplay/play.cpp) (Gameplay screen), [`src/core/game.cpp`](https://github.com/kareem-hany-77/lantern-keeper/blob/main/src/core/game.cpp) (Game state and dispatch), [`src/physics/movement.cpp`](https://github.com/kareem-hany-77/lantern-keeper/blob/main/src/physics/movement.cpp) (Player movement), [`src/ui/menu.cpp`](https://github.com/kareem-hany-77/lantern-keeper/blob/main/src/ui/menu.cpp) (Menu and level select)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Game runtime"]
  node_entry["Application entry<br/>[main.cpp]"]
  node_game["Game state and dispatch<br/>[game.cpp]"]
  node_config["Game configuration<br/>[config.h]"]
  node_input["Input state<br/>[input.cpp]"]
end

subgraph group_play["Gameplay"]
  node_play_screen["Gameplay screen<br/>[play.cpp]"]
  node_player["Player entity<br/>[player.cpp]"]
  node_movement["Player movement<br/>[movement.cpp]"]
  node_platforms["Platform world<br/>[platform.cpp]"]
end

subgraph group_presentation["UI and rendering"]
  node_menu["Menu and level select<br/>[menu.cpp]"]
  node_shapes["Shape drawing<br/>[shapes.cpp]"]
  node_ui["UI controls<br/>[ui.cpp]"]
  node_text["Text drawing<br/>[text.cpp]"]
end

node_player_actor(("Player"))
node_glut["GLUT runtime"]

node_player_actor -->|"provides input"| node_glut
node_glut -->|"starts callbacks"| node_entry
node_entry -->|"initializes and dispatches"| node_game
node_game -->|"routes menu events"| node_menu
node_game -->|"routes play events"| node_play_screen
node_game -->|"updates key state"| node_input
node_menu -->|"starts game or changes state"| node_game
node_menu -->|"tests button hits"| node_ui
node_menu -->|"draws menu labels"| node_text
node_play_screen -->|"loads and draws platforms"| node_platforms
node_play_screen -->|"initializes and draws"| node_player
node_play_screen -->|"updates player"| node_movement
node_play_screen -->|"resets input"| node_input
node_play_screen -->|"returns to menu"| node_game
node_play_screen -->|"draws HUD"| node_text
node_movement -->|"reads actions"| node_input
node_movement -->|"checks collisions"| node_platforms
node_player -->|"draws entity"| node_shapes
node_platforms -->|"draws platforms"| node_shapes
node_ui -->|"draws button labels"| node_text
node_game -->|"uses world dimensions"| node_config
node_movement -->|"uses physics constants"| node_config
node_play_screen -->|"uses level and mode values"| node_config

click node_entry "https://github.com/kareem-hany-77/lantern-keeper/blob/main/main.cpp"
click node_game "https://github.com/kareem-hany-77/lantern-keeper/blob/main/src/core/game.cpp"
click node_config "https://github.com/kareem-hany-77/lantern-keeper/blob/main/src/core/config.h"
click node_input "https://github.com/kareem-hany-77/lantern-keeper/blob/main/src/core/input.cpp"
click node_menu "https://github.com/kareem-hany-77/lantern-keeper/blob/main/src/ui/menu.cpp"
click node_play_screen "https://github.com/kareem-hany-77/lantern-keeper/blob/main/src/gameplay/play.cpp"
click node_player "https://github.com/kareem-hany-77/lantern-keeper/blob/main/src/entities/player.cpp"
click node_movement "https://github.com/kareem-hany-77/lantern-keeper/blob/main/src/physics/movement.cpp"
click node_platforms "https://github.com/kareem-hany-77/lantern-keeper/blob/main/src/world/platform.cpp"
click node_shapes "https://github.com/kareem-hany-77/lantern-keeper/blob/main/src/render/shapes.cpp"
click node_ui "https://github.com/kareem-hany-77/lantern-keeper/blob/main/src/ui/ui.cpp"
click node_text "https://github.com/kareem-hany-77/lantern-keeper/blob/main/src/ui/text.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_game,node_config,node_input toneBlue
class node_play_screen,node_player,node_movement,node_platforms toneAmber
class node_menu,node_shapes,node_ui,node_text toneMint
class node_player_actor,node_glut toneIndigo
```

## Components

### Game runtime

- [Application entry](https://github.com/kareem-hany-77/lantern-keeper/blob/main/main.cpp): `main.cpp`
- [Game state and dispatch](https://github.com/kareem-hany-77/lantern-keeper/blob/main/src/core/game.cpp): `src/core/game.cpp`
- [Game configuration](https://github.com/kareem-hany-77/lantern-keeper/blob/main/src/core/config.h): `src/core/config.h`
- [Input state](https://github.com/kareem-hany-77/lantern-keeper/blob/main/src/core/input.cpp): `src/core/input.cpp`

### Gameplay

- [Gameplay screen](https://github.com/kareem-hany-77/lantern-keeper/blob/main/src/gameplay/play.cpp): `src/gameplay/play.cpp`
- [Player entity](https://github.com/kareem-hany-77/lantern-keeper/blob/main/src/entities/player.cpp): `src/entities/player.cpp`
- [Player movement](https://github.com/kareem-hany-77/lantern-keeper/blob/main/src/physics/movement.cpp): `src/physics/movement.cpp`
- [Platform world](https://github.com/kareem-hany-77/lantern-keeper/blob/main/src/world/platform.cpp): `src/world/platform.cpp`

### UI and rendering

- [Menu and level select](https://github.com/kareem-hany-77/lantern-keeper/blob/main/src/ui/menu.cpp): `src/ui/menu.cpp`
- [Shape drawing](https://github.com/kareem-hany-77/lantern-keeper/blob/main/src/render/shapes.cpp): `src/render/shapes.cpp`
- [UI controls](https://github.com/kareem-hany-77/lantern-keeper/blob/main/src/ui/ui.cpp): `src/ui/ui.cpp`
- [Text drawing](https://github.com/kareem-hany-77/lantern-keeper/blob/main/src/ui/text.cpp): `src/ui/text.cpp`

### Other components

- **Player**
- **GLUT runtime**

## Connections

- Player → GLUT runtime: provides input
- GLUT runtime → Application entry: starts callbacks (evidence: `main.cpp`)
- Application entry → Game state and dispatch: initializes and dispatches (evidence: `main.cpp`)
- Game state and dispatch → Menu and level select: routes menu events (evidence: `src/core/game.cpp`)
- Game state and dispatch → Gameplay screen: routes play events (evidence: `src/core/game.cpp`)
- Game state and dispatch → Input state: updates key state (evidence: `src/core/game.cpp`)
- Menu and level select → Game state and dispatch: starts game or changes state (evidence: `src/ui/menu.cpp`)
- Menu and level select → UI controls: tests button hits (evidence: `src/ui/menu.cpp`)
- Menu and level select → Text drawing: draws menu labels (evidence: `src/ui/menu.cpp`)
- Gameplay screen → Platform world: loads and draws platforms (evidence: `src/gameplay/play.cpp`)
- Gameplay screen → Player entity: initializes and draws (evidence: `src/gameplay/play.cpp`)
- Gameplay screen → Player movement: updates player (evidence: `src/gameplay/play.cpp`)
- Gameplay screen → Input state: resets input (evidence: `src/gameplay/play.cpp`)
- Gameplay screen → Game state and dispatch: returns to menu (evidence: `src/gameplay/play.cpp`)
- Gameplay screen → Text drawing: draws HUD (evidence: `src/gameplay/play.cpp`)
- Player movement → Input state: reads actions (evidence: `src/physics/movement.cpp`)
- Player movement → Platform world: checks collisions (evidence: `src/physics/movement.cpp`)
- Player entity → Shape drawing: draws entity (evidence: `src/entities/player.cpp`)
- Platform world → Shape drawing: draws platforms (evidence: `src/world/platform.cpp`)
- UI controls → Text drawing: draws button labels (evidence: `src/ui/ui.cpp`)
- Game state and dispatch → Game configuration: uses world dimensions (evidence: `src/core/game.cpp`)
- Player movement → Game configuration: uses physics constants (evidence: `src/physics/movement.cpp`)
- Gameplay screen → Game configuration: uses level and mode values (evidence: `src/gameplay/play.cpp`)
