# parmaja/tyro architecture

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

- Interactive diagram: https://gitdiagram.com/parmaja/tyro
- Repository: https://github.com/parmaja/tyro

## Overview

Tyro is a graphical environment for running Lua-based `.tyro`/`.lua` programs, with an interactive console, in-window editing tools, drawing, input, and sound. The documented workflow is to launch a script (or start an interactive session), run it in the graphical environment, and use engine controls and APIs to interact with it. The README establishes the user-facing capabilities, but no runtime implementation excerpts were supplied; uncertain internal calls are therefore omitted or shown as unverified dashed links.

Main entry points: [`src/tyrolib/TyroLua.pas`](https://github.com/parmaja/tyro/blob/master/src/tyrolib/TyroLua.pas) (Lua Runtime), [`src/TyroApp.pas`](https://github.com/parmaja/tyro/blob/master/src/TyroApp.pas) (Tyro Application), [`src/TyroEngines.pas`](https://github.com/parmaja/tyro/blob/master/src/TyroEngines.pas) (Engine Loop), [`src/tyrolib/TyroScripts.pas`](https://github.com/parmaja/tyro/blob/master/src/tyrolib/TyroScripts.pas) (Script Handling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Application Runtime"]
  node_app["Tyro Application<br/>[TyroApp.pas]"]
  node_engines["Engine Loop<br/>[TyroEngines.pas]"]
  node_entry["Program Entry<br/>[tyro.dpr]"]
end

subgraph group_language["Language and Scripts"]
  node_lua["Lua Runtime<br/>[TyroLua.pas]"]
  node_scripts["Script Handling<br/>[TyroScripts.pas]"]
  node_models["Runtime Models<br/>[TyroModels.pas]"]
end

subgraph group_interaction["User Interaction"]
  node_editor["Script Editor<br/>[TyroEditors.pas]"]
  node_terminal["Console and Terminal<br/>[TyroTerminal.pas]"]
  node_controls["Input Controls<br/>[TyroControls.pas]"]
  node_input["Input APIs<br/>[TyroInput.pas]"]
end

subgraph group_media["Graphics and Audio"]
  node_sprites["Sprite Rendering<br/>[TyroSprites.pas]"]
  node_tiles["Tile Rendering<br/>[TyroTiles.pas]"]
  node_particles["Particle Effects<br/>[TyroParticles.pas]"]
  node_audio["Sound and Music<br/>[TyroSounds.pas]"]
end

subgraph group_engine["Engine Integration"]
  node_raylib["Raylib Binding<br/>[RayLib.pas]"]
  node_fuse["Fuse Integration<br/>[TyroFuse.pas]"]
end

node_user(("Tyro User"))
node_workspace[("Script Workspace")]

node_user -->|"launches"| node_entry
node_entry -.->|"starts"| node_app
node_app -.->|"loads scripts"| node_scripts
node_app -.->|"runs environment"| node_engines
node_scripts -.->|"executes Lua"| node_lua
node_user -->|"edits scripts"| node_editor
node_editor -->|"saves and reruns"| node_scripts
node_user -->|"uses console"| node_terminal
node_user -->|"uses shortcuts"| node_controls
node_lua -->|"reads input APIs"| node_input
node_lua -.->|"draws sprites"| node_sprites
node_lua -.->|"draws tiles"| node_tiles
node_lua -.->|"creates effects"| node_particles
node_lua -->|"plays sound"| node_audio
node_user -->|"selects scripts"| node_workspace
node_app -->|"resolves assets"| node_workspace
node_engines -.->|"uses graphics engine"| node_raylib
node_engines -.->|"integrates Fuse"| node_fuse

click node_app "https://github.com/parmaja/tyro/blob/master/src/TyroApp.pas"
click node_engines "https://github.com/parmaja/tyro/blob/master/src/TyroEngines.pas"
click node_entry "https://github.com/parmaja/tyro/blob/master/src/tyro.dpr"
click node_lua "https://github.com/parmaja/tyro/blob/master/src/tyrolib/TyroLua.pas"
click node_scripts "https://github.com/parmaja/tyro/blob/master/src/tyrolib/TyroScripts.pas"
click node_models "https://github.com/parmaja/tyro/blob/master/src/tyrolib/TyroModels.pas"
click node_editor "https://github.com/parmaja/tyro/blob/master/src/tyrolib/TyroEditors.pas"
click node_terminal "https://github.com/parmaja/tyro/blob/master/src/tyrolib/TyroTerminal.pas"
click node_controls "https://github.com/parmaja/tyro/blob/master/src/tyrolib/TyroControls.pas"
click node_input "https://github.com/parmaja/tyro/blob/master/src/tyrolib/TyroInput.pas"
click node_sprites "https://github.com/parmaja/tyro/blob/master/src/tyrolib/TyroSprites.pas"
click node_tiles "https://github.com/parmaja/tyro/blob/master/src/tyrolib/TyroTiles.pas"
click node_particles "https://github.com/parmaja/tyro/blob/master/src/tyrolib/TyroParticles.pas"
click node_audio "https://github.com/parmaja/tyro/blob/master/src/tyrolib/TyroSounds.pas"
click node_raylib "https://github.com/parmaja/tyro/blob/master/src/raylib/RayLib.pas"
click node_fuse "https://github.com/parmaja/tyro/blob/master/src/TyroFuse.pas"

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_app,node_engines,node_entry,node_user toneBlue
class node_lua,node_scripts,node_models,node_workspace toneAmber
class node_editor,node_terminal,node_controls,node_input toneMint
class node_sprites,node_tiles,node_particles,node_audio toneRose
class node_raylib,node_fuse toneIndigo
```

## Components

### Application Runtime

- [Tyro Application](https://github.com/parmaja/tyro/blob/master/src/TyroApp.pas): `src/TyroApp.pas`
- [Engine Loop](https://github.com/parmaja/tyro/blob/master/src/TyroEngines.pas): `src/TyroEngines.pas`
- [Program Entry](https://github.com/parmaja/tyro/blob/master/src/tyro.dpr): `src/tyro.dpr`

### Language and Scripts

- [Lua Runtime](https://github.com/parmaja/tyro/blob/master/src/tyrolib/TyroLua.pas): `src/tyrolib/TyroLua.pas`
- [Script Handling](https://github.com/parmaja/tyro/blob/master/src/tyrolib/TyroScripts.pas): `src/tyrolib/TyroScripts.pas`
- [Runtime Models](https://github.com/parmaja/tyro/blob/master/src/tyrolib/TyroModels.pas): `src/tyrolib/TyroModels.pas`

### User Interaction

- [Script Editor](https://github.com/parmaja/tyro/blob/master/src/tyrolib/TyroEditors.pas): `src/tyrolib/TyroEditors.pas`
- [Console and Terminal](https://github.com/parmaja/tyro/blob/master/src/tyrolib/TyroTerminal.pas): `src/tyrolib/TyroTerminal.pas`
- [Input Controls](https://github.com/parmaja/tyro/blob/master/src/tyrolib/TyroControls.pas): `src/tyrolib/TyroControls.pas`
- [Input APIs](https://github.com/parmaja/tyro/blob/master/src/tyrolib/TyroInput.pas): `src/tyrolib/TyroInput.pas`

### Graphics and Audio

- [Sprite Rendering](https://github.com/parmaja/tyro/blob/master/src/tyrolib/TyroSprites.pas): `src/tyrolib/TyroSprites.pas`
- [Tile Rendering](https://github.com/parmaja/tyro/blob/master/src/tyrolib/TyroTiles.pas): `src/tyrolib/TyroTiles.pas`
- [Particle Effects](https://github.com/parmaja/tyro/blob/master/src/tyrolib/TyroParticles.pas): `src/tyrolib/TyroParticles.pas`
- [Sound and Music](https://github.com/parmaja/tyro/blob/master/src/tyrolib/TyroSounds.pas): `src/tyrolib/TyroSounds.pas`

### Engine Integration

- [Raylib Binding](https://github.com/parmaja/tyro/blob/master/src/raylib/RayLib.pas): `src/raylib/RayLib.pas`
- [Fuse Integration](https://github.com/parmaja/tyro/blob/master/src/TyroFuse.pas): `src/TyroFuse.pas`

### Other components

- **Tyro User**
- **Script Workspace**

## Connections

- Tyro User → Program Entry: launches (evidence: `README.md`)
- Program Entry → Tyro Application: starts
- Tyro Application → Script Handling: loads scripts
- Tyro Application → Engine Loop: runs environment
- Script Handling → Lua Runtime: executes Lua
- Tyro User → Script Editor: edits scripts (evidence: `README.md`)
- Script Editor → Script Handling: saves and reruns (evidence: `README.md`)
- Tyro User → Console and Terminal: uses console (evidence: `README.md`)
- Tyro User → Input Controls: uses shortcuts (evidence: `README.md`)
- Lua Runtime → Input APIs: reads input APIs (evidence: `README.md`)
- Lua Runtime → Sprite Rendering: draws sprites
- Lua Runtime → Tile Rendering: draws tiles
- Lua Runtime → Particle Effects: creates effects
- Lua Runtime → Sound and Music: plays sound (evidence: `README.md`)
- Tyro User → Script Workspace: selects scripts (evidence: `README.md`)
- Tyro Application → Script Workspace: resolves assets (evidence: `README.md`)
- Engine Loop → Raylib Binding: uses graphics engine
- Engine Loop → Fuse Integration: integrates Fuse
