# moumoulongs/raycast-2d architecture

> Architecture diagram of the GitHub repository moumoulongs/raycast-2d, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/moumoulongs/raycast-2d
- Repository: https://github.com/moumoulongs/raycast-2d

## Overview

raycast-2d is a Windows console raycasting demo. The main loop accepts movement keys, updates the camera, raycasts the map into a character-cell canvas, and presents the frame. The README gives no further capability detail; the map is defined in the entry-point source. Source excerpts establish the principal calls, while the math helper and map declaration are shown but their broader use is not expanded beyond supported links.

Main entry points: [`include/camera.h`](https://github.com/moumoulongs/raycast-2d/blob/main/include/camera.h) (Camera and raycaster), [`src/main.cpp`](https://github.com/moumoulongs/raycast-2d/blob/main/src/main.cpp) (Input and frame loop), [`include/screen.h`](https://github.com/moumoulongs/raycast-2d/blob/main/include/screen.h) (Canvas and console output), [`include/worldMap.h`](https://github.com/moumoulongs/raycast-2d/blob/main/include/worldMap.h) (Map declaration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime loop"]
  node_main["Input and frame loop<br/>[main.cpp]"]
end

subgraph group_raycast["Raycasting"]
  node_camera["Camera and raycaster<br/>[camera.h]"]
  node_map[("World map data<br/>[main.cpp]")]
  node_map_api["Map declaration<br/>[worldMap.h]"]
end

subgraph group_display["Console display"]
  node_screen["Canvas and console output<br/>[screen.h]"]
end

subgraph group_foundation["Core data"]
  node_vector["2D vector math<br/>[vec2.h]"]
end

node_user(("Keyboard user"))

node_user -->|"presses keys"| node_main
node_main -->|"updates and renders"| node_camera
node_main -->|"presents and clears"| node_screen
node_camera -->|"draws wall lines"| node_screen
node_camera -->|"reads collision cells"| node_map
node_main -->|"defines map"| node_map
node_camera -->|"uses vectors"| node_vector
node_camera -->|"includes declaration"| node_map_api

click node_main "https://github.com/moumoulongs/raycast-2d/blob/main/src/main.cpp"
click node_camera "https://github.com/moumoulongs/raycast-2d/blob/main/include/camera.h"
click node_map "https://github.com/moumoulongs/raycast-2d/blob/main/src/main.cpp"
click node_map_api "https://github.com/moumoulongs/raycast-2d/blob/main/include/worldMap.h"
click node_screen "https://github.com/moumoulongs/raycast-2d/blob/main/include/screen.h"
click node_vector "https://github.com/moumoulongs/raycast-2d/blob/main/include/vec2.h"

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_main,node_user toneBlue
class node_camera,node_map,node_map_api toneAmber
class node_screen toneMint
class node_vector toneRose
```

## Components

### Runtime loop

- [Input and frame loop](https://github.com/moumoulongs/raycast-2d/blob/main/src/main.cpp): `src/main.cpp`

### Raycasting

- [Camera and raycaster](https://github.com/moumoulongs/raycast-2d/blob/main/include/camera.h): `include/camera.h`
- [World map data](https://github.com/moumoulongs/raycast-2d/blob/main/src/main.cpp): `src/main.cpp`
- [Map declaration](https://github.com/moumoulongs/raycast-2d/blob/main/include/worldMap.h): `include/worldMap.h`

### Console display

- [Canvas and console output](https://github.com/moumoulongs/raycast-2d/blob/main/include/screen.h): `include/screen.h`

### Core data

- [2D vector math](https://github.com/moumoulongs/raycast-2d/blob/main/include/vec2.h): `include/vec2.h`

### Other components

- **Keyboard user**

## Connections

- Keyboard user → Input and frame loop: presses keys (evidence: `src/main.cpp`)
- Input and frame loop → Camera and raycaster: updates and renders (evidence: `src/main.cpp`)
- Input and frame loop → Canvas and console output: presents and clears (evidence: `src/main.cpp`)
- Camera and raycaster → Canvas and console output: draws wall lines (evidence: `include/camera.h`)
- Camera and raycaster → World map data: reads collision cells (evidence: `include/camera.h`)
- Input and frame loop → World map data: defines map (evidence: `src/main.cpp`)
- Camera and raycaster → 2D vector math: uses vectors (evidence: `include/camera.h`)
- Camera and raycaster → Map declaration: includes declaration (evidence: `include/camera.h`)
