# semajavoye/virtuallogigate architecture

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

- Interactive diagram: https://gitdiagram.com/semajavoye/virtuallogigate
- Repository: https://github.com/semajavoye/virtuallogigate

## Overview

VirtualLogiGate is an SDL-based digital logic simulator and visual circuit editor. The user enters through a menu, starts the in-game view, and interacts with circuit objects through the editor; the editor represents gates, wires, and lamps alongside the logic model, while the app renders the result. The README also describes signal propagation as in development and persistence and simplification as planned, but sampled source does not establish those workflows. Edges are limited to relationships visible in excerpts or documented in the README; some runtime wiring remains unsampled.

Main entry points: [`src/editor.c`](https://github.com/semajavoye/virtuallogigate/blob/main/src/editor.c) (Circuit Editor), [`src/main.c`](https://github.com/semajavoye/virtuallogigate/blob/main/src/main.c) (SDL App Loop), [`src/ui.c`](https://github.com/semajavoye/virtuallogigate/blob/main/src/ui.c) (Button UI), [`src/logic.c`](https://github.com/semajavoye/virtuallogigate/blob/main/src/logic.c) (Gate Logic)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_main["SDL App Loop<br/>[main.c]"]
  node_actions["Menu Actions<br/>[actions.c]"]
  node_render_utils["Text Rendering<br/>[render_utils.c]"]
end

subgraph group_interaction["User Interaction"]
  node_ui["Button UI<br/>[ui.c]"]
  node_input["Input Handler<br/>[input.c]"]
  node_camera["View Camera<br/>[camera.c]"]
end

subgraph group_circuit["Circuit Editing"]
  node_editor["Circuit Editor<br/>[editor.c]"]
  node_wire["Wire Placement<br/>[editor.c]"]
  node_objects["Gate and Lamp Tools<br/>[editor.c]"]
  node_selection["Circuit Selection<br/>[editor.c]"]
  node_circuit_render["Circuit Rendering<br/>[editor.c]"]
end

subgraph group_runtime["Logic Runtime"]
  node_logic["Gate Logic<br/>[logic.c]"]
  node_persistence["Circuit Persistence"]
  node_simplification["Logic Simplification"]
  node_signal_flow["Signal Propagation<br/>[editor.c]"]
end

node_user(("User"))

node_user -->|"uses"| node_main
node_main -->|"creates and renders"| node_ui
node_main -->|"renders editor"| node_editor
node_main -->|"transforms input"| node_camera
node_main -->|"registers callbacks"| node_actions
node_main -.-> node_input
node_ui -->|"queries placement modes"| node_editor
node_editor -->|"converts coordinates"| node_camera
node_editor -->|"manages placement"| node_wire
node_editor -->|"creates and connects"| node_objects
node_editor -->|"selects objects"| node_selection
node_editor -->|"renders circuit"| node_circuit_render
node_editor -->|"links logic objects"| node_logic
node_editor -->|"exposes propagation"| node_signal_flow
node_main -.-> node_render_utils
node_editor -.->|"planned save and load"| node_persistence
node_logic -.->|"planned optimization"| node_simplification
node_editor -.->|"planned signal model"| node_signal_flow

click node_main "https://github.com/semajavoye/virtuallogigate/blob/main/src/main.c"
click node_actions "https://github.com/semajavoye/virtuallogigate/blob/main/src/actions.c"
click node_ui "https://github.com/semajavoye/virtuallogigate/blob/main/src/ui.c"
click node_input "https://github.com/semajavoye/virtuallogigate/blob/main/src/input.c"
click node_camera "https://github.com/semajavoye/virtuallogigate/blob/main/src/camera.c"
click node_editor "https://github.com/semajavoye/virtuallogigate/blob/main/src/editor.c"
click node_wire "https://github.com/semajavoye/virtuallogigate/blob/main/src/editor.c"
click node_objects "https://github.com/semajavoye/virtuallogigate/blob/main/src/editor.c"
click node_selection "https://github.com/semajavoye/virtuallogigate/blob/main/src/editor.c"
click node_circuit_render "https://github.com/semajavoye/virtuallogigate/blob/main/src/editor.c"
click node_logic "https://github.com/semajavoye/virtuallogigate/blob/main/src/logic.c"
click node_render_utils "https://github.com/semajavoye/virtuallogigate/blob/main/src/render_utils.c"
click node_persistence "https://github.com/semajavoye/virtuallogigate/tree/main/src"
click node_simplification "https://github.com/semajavoye/virtuallogigate/tree/main/src"
click node_signal_flow "https://github.com/semajavoye/virtuallogigate/blob/main/src/editor.c"

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_actions,node_render_utils,node_user toneBlue
class node_ui,node_input,node_camera toneAmber
class node_editor,node_wire,node_objects,node_selection,node_circuit_render toneMint
class node_logic,node_persistence,node_simplification,node_signal_flow toneRose
```

## Components

### Application

- [SDL App Loop](https://github.com/semajavoye/virtuallogigate/blob/main/src/main.c): `src/main.c`
- [Menu Actions](https://github.com/semajavoye/virtuallogigate/blob/main/src/actions.c): `src/actions.c`
- [Text Rendering](https://github.com/semajavoye/virtuallogigate/blob/main/src/render_utils.c): `src/render_utils.c`

### User Interaction

- [Button UI](https://github.com/semajavoye/virtuallogigate/blob/main/src/ui.c): `src/ui.c`
- [Input Handler](https://github.com/semajavoye/virtuallogigate/blob/main/src/input.c): `src/input.c`
- [View Camera](https://github.com/semajavoye/virtuallogigate/blob/main/src/camera.c): `src/camera.c`

### Circuit Editing

- [Circuit Editor](https://github.com/semajavoye/virtuallogigate/blob/main/src/editor.c): `src/editor.c`
- [Wire Placement](https://github.com/semajavoye/virtuallogigate/blob/main/src/editor.c): `src/editor.c`
- [Gate and Lamp Tools](https://github.com/semajavoye/virtuallogigate/blob/main/src/editor.c): `src/editor.c`
- [Circuit Selection](https://github.com/semajavoye/virtuallogigate/blob/main/src/editor.c): `src/editor.c`
- [Circuit Rendering](https://github.com/semajavoye/virtuallogigate/blob/main/src/editor.c): `src/editor.c`

### Logic Runtime

- [Gate Logic](https://github.com/semajavoye/virtuallogigate/blob/main/src/logic.c): `src/logic.c`
- [Circuit Persistence](https://github.com/semajavoye/virtuallogigate/tree/main/src): `src`
- [Logic Simplification](https://github.com/semajavoye/virtuallogigate/tree/main/src): `src`
- [Signal Propagation](https://github.com/semajavoye/virtuallogigate/blob/main/src/editor.c): `src/editor.c`

### Other components

- **User**

## Connections

- User → SDL App Loop: uses (evidence: `README.md`)
- SDL App Loop → Button UI: creates and renders (evidence: `src/main.c`)
- SDL App Loop → Circuit Editor: renders editor (evidence: `src/main.c`)
- SDL App Loop → View Camera: transforms input (evidence: `src/main.c`)
- SDL App Loop → Menu Actions: registers callbacks (evidence: `src/main.c`)
- SDL App Loop → Input Handler
- Button UI → Circuit Editor: queries placement modes (evidence: `src/ui.c`)
- Circuit Editor → View Camera: converts coordinates (evidence: `src/editor.c`)
- Circuit Editor → Wire Placement: manages placement (evidence: `src/editor.c`)
- Circuit Editor → Gate and Lamp Tools: creates and connects (evidence: `src/editor.c`)
- Circuit Editor → Circuit Selection: selects objects (evidence: `src/editor.c`)
- Circuit Editor → Circuit Rendering: renders circuit (evidence: `src/editor.c`)
- Circuit Editor → Gate Logic: links logic objects (evidence: `src/editor.c`)
- Circuit Editor → Signal Propagation: exposes propagation (evidence: `src/editor.c`)
- SDL App Loop → Text Rendering
- Circuit Editor → Circuit Persistence: planned save and load (evidence: `README.md`)
- Gate Logic → Logic Simplification: planned optimization (evidence: `README.md`)
- Circuit Editor → Signal Propagation: planned signal model (evidence: `README.md`)
