# wesweslington/ftw_linterminal architecture

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

- Interactive diagram: https://gitdiagram.com/wesweslington/ftw_linterminal
- Repository: https://github.com/wesweslington/ftw_linterminal

## Overview

FTW_LinTerminal is a Raspberry Pi/Linux terminal game. Its principal workflow starts the game loop, creates the player and first level, then repeatedly updates, checks input, and—at a fixed interval—runs physics and renders entities. The implementation is a single C++ file; the graph separates its visible runtime responsibilities. The excerpts establish the loop and some entity behavior, but omit key method bodies, so uncertain input-to-player and rendering-to-device links are not asserted.

Main entry points: [`main.cpp`](https://github.com/wesweslington/ftw_linterminal/blob/main/main.cpp) (Game loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Game runtime"]
  node_game["Game loop<br/>[main.cpp]"]
  node_physics["Physics<br/>[main.cpp]"]
  node_renderer["Renderer<br/>[main.cpp]"]
end

subgraph group_gameplay["Gameplay"]
  node_player["Player<br/>[main.cpp]"]
  node_level["Level spawning<br/>[main.cpp]"]
  node_entities["Entity system<br/>[main.cpp]"]
  node_enemies["Enemies<br/>[main.cpp]"]
  node_weapons["Weapons<br/>[main.cpp]"]
  node_projectiles["Projectiles<br/>[main.cpp]"]
  node_token["Token<br/>[main.cpp]"]
end

subgraph group_platform["Linux devices"]
  node_input["Keyboard input<br/>[main.cpp]"]
  node_framebuffer["Framebuffer setup<br/>[main.cpp]"]
end

node_linux_input[("Linux input device")]
node_linux_fb[("Linux framebuffer")]
node_player_actor(("Player"))

node_player_actor -.->|"provides input"| node_input
node_input -->|"opens device"| node_linux_input
node_game -->|"initializes"| node_framebuffer
node_framebuffer -->|"grabs device"| node_linux_fb
node_game -->|"spawns"| node_player
node_game -->|"spawns level"| node_level
node_game -->|"runs physics"| node_physics
node_game -->|"renders"| node_renderer
node_renderer -->|"renders entities"| node_entities
node_physics -->|"starts physics"| node_entities
node_weapons -->|"attacks with"| node_projectiles

click node_player "https://github.com/wesweslington/ftw_linterminal/blob/main/main.cpp"
click node_game "https://github.com/wesweslington/ftw_linterminal/blob/main/main.cpp"
click node_level "https://github.com/wesweslington/ftw_linterminal/blob/main/main.cpp"
click node_entities "https://github.com/wesweslington/ftw_linterminal/blob/main/main.cpp"
click node_enemies "https://github.com/wesweslington/ftw_linterminal/blob/main/main.cpp"
click node_weapons "https://github.com/wesweslington/ftw_linterminal/blob/main/main.cpp"
click node_projectiles "https://github.com/wesweslington/ftw_linterminal/blob/main/main.cpp"
click node_token "https://github.com/wesweslington/ftw_linterminal/blob/main/main.cpp"
click node_physics "https://github.com/wesweslington/ftw_linterminal/blob/main/main.cpp"
click node_renderer "https://github.com/wesweslington/ftw_linterminal/blob/main/main.cpp"
click node_input "https://github.com/wesweslington/ftw_linterminal/blob/main/main.cpp"
click node_framebuffer "https://github.com/wesweslington/ftw_linterminal/blob/main/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_game,node_physics,node_renderer toneBlue
class node_player,node_level,node_entities,node_enemies,node_weapons,node_projectiles,node_token,node_linux_input,node_linux_fb toneAmber
class node_input,node_framebuffer toneMint
class node_player_actor toneIndigo
```

## Components

### Game runtime

- [Game loop](https://github.com/wesweslington/ftw_linterminal/blob/main/main.cpp): `main.cpp`
- [Physics](https://github.com/wesweslington/ftw_linterminal/blob/main/main.cpp): `main.cpp`
- [Renderer](https://github.com/wesweslington/ftw_linterminal/blob/main/main.cpp): `main.cpp`

### Gameplay

- [Player](https://github.com/wesweslington/ftw_linterminal/blob/main/main.cpp): `main.cpp`
- [Level spawning](https://github.com/wesweslington/ftw_linterminal/blob/main/main.cpp): `main.cpp`
- [Entity system](https://github.com/wesweslington/ftw_linterminal/blob/main/main.cpp): `main.cpp`
- [Enemies](https://github.com/wesweslington/ftw_linterminal/blob/main/main.cpp): `main.cpp`
- [Weapons](https://github.com/wesweslington/ftw_linterminal/blob/main/main.cpp): `main.cpp`
- [Projectiles](https://github.com/wesweslington/ftw_linterminal/blob/main/main.cpp): `main.cpp`
- [Token](https://github.com/wesweslington/ftw_linterminal/blob/main/main.cpp): `main.cpp`

### Linux devices

- [Keyboard input](https://github.com/wesweslington/ftw_linterminal/blob/main/main.cpp): `main.cpp`
- [Framebuffer setup](https://github.com/wesweslington/ftw_linterminal/blob/main/main.cpp): `main.cpp`

### Other components

- **Linux input device**
- **Linux framebuffer**
- **Player**

## Connections

- Player → Keyboard input: provides input
- Keyboard input → Linux input device: opens device (evidence: `main.cpp`)
- Game loop → Framebuffer setup: initializes (evidence: `main.cpp`)
- Framebuffer setup → Linux framebuffer: grabs device (evidence: `main.cpp`)
- Game loop → Player: spawns (evidence: `main.cpp`)
- Game loop → Level spawning: spawns level (evidence: `main.cpp`)
- Game loop → Physics: runs physics (evidence: `main.cpp`)
- Game loop → Renderer: renders (evidence: `main.cpp`)
- Renderer → Entity system: renders entities (evidence: `main.cpp`)
- Physics → Entity system: starts physics (evidence: `main.cpp`)
- Weapons → Projectiles: attacks with (evidence: `main.cpp`)
