# capibaraengineer/terminalengine architecture

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

- Interactive diagram: https://gitdiagram.com/capibaraengineer/terminalengine
- Repository: https://github.com/capibaraengineer/terminalengine

## Overview

TerminalEngine is a small C++ engine for composing terminal games from layered character grids and positioned game objects. In the included demo, the main loop polls keyboard input to move an object, then asks GameHandler to update and render the scene; Rendering overlays objects onto copied layers, combines the layers, and writes the frame to the terminal. The sampled code shows no collision processing despite collision flags in the data model. The graph reflects the supplied headers and demo; other capabilities are not documented in the README.

Main entry points: [`TerminalEngine/TestGame.cpp`](https://github.com/capibaraengineer/terminalengine/blob/master/TerminalEngine/TestGame.cpp) (Demo loop), [`TerminalEngine/Rendering.hpp`](https://github.com/capibaraengineer/terminalengine/blob/master/TerminalEngine/Rendering.hpp) (Terminal renderer), [`TerminalEngine/LayerList.hpp`](https://github.com/capibaraengineer/terminalengine/blob/master/TerminalEngine/LayerList.hpp) (Layer list), [`TerminalEngine/GameHandler.hpp`](https://github.com/capibaraengineer/terminalengine/blob/master/TerminalEngine/GameHandler.hpp) (Game handler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_demo["Demo game"]
  node_demo_loop["Demo loop<br/>[TestGame.cpp]"]
end

subgraph group_runtime["Engine runtime"]
  node_handler["Game handler<br/>[GameHandler.hpp]"]
  node_renderer["Terminal renderer<br/>[Rendering.hpp]"]
end

subgraph group_scene["Scene model"]
  node_layers["Layer list<br/>[LayerList.hpp]"]
  node_layer["Game layer<br/>[GameLayer.hpp]"]
  node_object["Game object<br/>[GameObject.hpp]"]
  node_grid["Character grid<br/>[Vector2D.hpp]"]
end

node_player(("Player"))
node_terminal["Terminal"]

node_player -->|"presses keys"| node_demo_loop
node_demo_loop -->|"moves object"| node_object
node_demo_loop -->|"creates scene"| node_layers
node_demo_loop -->|"starts and updates"| node_handler
node_handler -->|"calls render"| node_renderer
node_renderer -->|"copies and reads"| node_layers
node_renderer -->|"reads positions"| node_object
node_renderer -->|"writes frame"| node_terminal
node_layers -->|"stores layers"| node_layer
node_layer -->|"stores grid"| node_grid

click node_demo_loop "https://github.com/capibaraengineer/terminalengine/blob/master/TerminalEngine/TestGame.cpp"
click node_handler "https://github.com/capibaraengineer/terminalengine/blob/master/TerminalEngine/GameHandler.hpp"
click node_renderer "https://github.com/capibaraengineer/terminalengine/blob/master/TerminalEngine/Rendering.hpp"
click node_layers "https://github.com/capibaraengineer/terminalengine/blob/master/TerminalEngine/LayerList.hpp"
click node_layer "https://github.com/capibaraengineer/terminalengine/blob/master/TerminalEngine/GameLayer.hpp"
click node_object "https://github.com/capibaraengineer/terminalengine/blob/master/TerminalEngine/GameObject.hpp"
click node_grid "https://github.com/capibaraengineer/terminalengine/blob/master/TerminalEngine/Vector2D.hpp"

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_demo_loop toneBlue
class node_handler,node_renderer toneAmber
class node_layers,node_layer,node_object,node_grid toneMint
class node_player,node_terminal toneIndigo
```

## Components

### Demo game

- [Demo loop](https://github.com/capibaraengineer/terminalengine/blob/master/TerminalEngine/TestGame.cpp): `TerminalEngine/TestGame.cpp`

### Engine runtime

- [Game handler](https://github.com/capibaraengineer/terminalengine/blob/master/TerminalEngine/GameHandler.hpp): `TerminalEngine/GameHandler.hpp`
- [Terminal renderer](https://github.com/capibaraengineer/terminalengine/blob/master/TerminalEngine/Rendering.hpp): `TerminalEngine/Rendering.hpp`

### Scene model

- [Layer list](https://github.com/capibaraengineer/terminalengine/blob/master/TerminalEngine/LayerList.hpp): `TerminalEngine/LayerList.hpp`
- [Game layer](https://github.com/capibaraengineer/terminalengine/blob/master/TerminalEngine/GameLayer.hpp): `TerminalEngine/GameLayer.hpp`
- [Game object](https://github.com/capibaraengineer/terminalengine/blob/master/TerminalEngine/GameObject.hpp): `TerminalEngine/GameObject.hpp`
- [Character grid](https://github.com/capibaraengineer/terminalengine/blob/master/TerminalEngine/Vector2D.hpp): `TerminalEngine/Vector2D.hpp`

### Other components

- **Player**
- **Terminal**

## Connections

- Player → Demo loop: presses keys
- Demo loop → Game object: moves object
- Demo loop → Layer list: creates scene
- Demo loop → Game handler: starts and updates
- Game handler → Terminal renderer: calls render
- Terminal renderer → Layer list: copies and reads
- Terminal renderer → Game object: reads positions
- Terminal renderer → Terminal: writes frame
- Layer list → Game layer: stores layers
- Game layer → Character grid: stores grid
