# madihaiqbal417-droid/shift_game architecture

> Architecture diagram of the GitHub repository madihaiqbal417-droid/shift_game, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/madihaiqbal417-droid/shift_game
- Repository: https://github.com/madihaiqbal417-droid/shift_game

## Overview

SHIFT is a single-file SFML platform game about switching between mirrored realities across three levels. The player starts a run, moves and jumps, shifts worlds to navigate hazards, and reaches the goal while managing a nightmare meter. `src/main.cpp` owns the game state, simulation, level data, audio, and drawing rather than delegating to separate modules. The excerpts show input, physics, audio playback, and rendering; asset-loading details and some level transitions are omitted, so those connections are not inferred.

Main entry points: [`src/main.cpp`](https://github.com/madihaiqbal417-droid/shift_game/blob/main/src/main.cpp) (Game Loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_flow["Game Flow"]
  node_loop["Game Loop<br/>[main.cpp]"]
  node_progress["Game Progress<br/>[main.cpp]"]
end

subgraph group_world["World Simulation"]
  node_levels["Level Setup<br/>[main.cpp]"]
  node_shifting["World Shifting<br/>[main.cpp]"]
  node_physics["Movement Physics<br/>[main.cpp]"]
  node_hazards["Hazards and Monsters<br/>[main.cpp]"]
  node_meter["Nightmare Meter<br/>[main.cpp]"]
end

subgraph group_presentation["Presentation"]
  node_drawing["Game Drawing<br/>[main.cpp]"]
  node_audio["Sound and Music<br/>[main.cpp]"]
end

node_player(("Player"))
node_window["SFML Window"]

node_player -->|"provides input"| node_loop
node_loop -->|"handles shift"| node_shifting
node_loop -->|"updates movement"| node_physics
node_loop -->|"updates hazards"| node_hazards
node_loop -->|"updates state"| node_progress
node_loop -->|"loads levels"| node_levels
node_loop -->|"updates meter"| node_meter
node_loop -->|"plays sounds"| node_audio
node_loop -->|"draws scene"| node_drawing
node_drawing -->|"draws to"| node_window

click node_loop "https://github.com/madihaiqbal417-droid/shift_game/blob/main/src/main.cpp"
click node_progress "https://github.com/madihaiqbal417-droid/shift_game/blob/main/src/main.cpp"
click node_levels "https://github.com/madihaiqbal417-droid/shift_game/blob/main/src/main.cpp"
click node_shifting "https://github.com/madihaiqbal417-droid/shift_game/blob/main/src/main.cpp"
click node_physics "https://github.com/madihaiqbal417-droid/shift_game/blob/main/src/main.cpp"
click node_hazards "https://github.com/madihaiqbal417-droid/shift_game/blob/main/src/main.cpp"
click node_meter "https://github.com/madihaiqbal417-droid/shift_game/blob/main/src/main.cpp"
click node_drawing "https://github.com/madihaiqbal417-droid/shift_game/blob/main/src/main.cpp"
click node_audio "https://github.com/madihaiqbal417-droid/shift_game/blob/main/src/main.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_loop,node_progress toneBlue
class node_levels,node_shifting,node_physics,node_hazards,node_meter toneAmber
class node_drawing,node_audio toneMint
class node_player,node_window toneIndigo
```

## Components

### Game Flow

- [Game Loop](https://github.com/madihaiqbal417-droid/shift_game/blob/main/src/main.cpp): `src/main.cpp`
- [Game Progress](https://github.com/madihaiqbal417-droid/shift_game/blob/main/src/main.cpp): `src/main.cpp`

### World Simulation

- [Level Setup](https://github.com/madihaiqbal417-droid/shift_game/blob/main/src/main.cpp): `src/main.cpp`
- [World Shifting](https://github.com/madihaiqbal417-droid/shift_game/blob/main/src/main.cpp): `src/main.cpp`
- [Movement Physics](https://github.com/madihaiqbal417-droid/shift_game/blob/main/src/main.cpp): `src/main.cpp`
- [Hazards and Monsters](https://github.com/madihaiqbal417-droid/shift_game/blob/main/src/main.cpp): `src/main.cpp`
- [Nightmare Meter](https://github.com/madihaiqbal417-droid/shift_game/blob/main/src/main.cpp): `src/main.cpp`

### Presentation

- [Game Drawing](https://github.com/madihaiqbal417-droid/shift_game/blob/main/src/main.cpp): `src/main.cpp`
- [Sound and Music](https://github.com/madihaiqbal417-droid/shift_game/blob/main/src/main.cpp): `src/main.cpp`

### Other components

- **Player**
- **SFML Window**

## Connections

- Player → Game Loop: provides input (evidence: `src/main.cpp`)
- Game Loop → World Shifting: handles shift (evidence: `src/main.cpp`)
- Game Loop → Movement Physics: updates movement (evidence: `src/main.cpp`)
- Game Loop → Hazards and Monsters: updates hazards (evidence: `src/main.cpp`)
- Game Loop → Game Progress: updates state (evidence: `src/main.cpp`)
- Game Loop → Level Setup: loads levels (evidence: `src/main.cpp`)
- Game Loop → Nightmare Meter: updates meter (evidence: `src/main.cpp`)
- Game Loop → Sound and Music: plays sounds (evidence: `src/main.cpp`)
- Game Loop → Game Drawing: draws scene (evidence: `src/main.cpp`)
- Game Drawing → SFML Window: draws to (evidence: `src/main.cpp`)
