# wozt/proto-pso-menu architecture

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

- Interactive diagram: https://gitdiagram.com/wozt/proto-pso-menu
- Repository: https://github.com/wozt/proto-pso-menu

## Overview

PSO Menu is a host-integrated C11 immediate-mode UI library: the host owns the SDL window, renderer, event loop, and final presentation. Its main workflow is to create a UI context, deliver input and declare widgets each frame, then draw into the host renderer. Separate capabilities cover validated configuration, layout and text editing, Cyber backgrounds, CRT effects, optional GLES composition, and an optional shell terminal. The graph follows documented API boundaries; unsampled implementation details are not treated as confirmed call relationships.

Main entry points: [`src/widgets.c`](https://github.com/wozt/proto-pso-menu/blob/main/src/widgets.c) (Widgets), [`src/core.c`](https://github.com/wozt/proto-pso-menu/blob/main/src/core.c) (UI context), [`src/retro_fx.inc.c`](https://github.com/wozt/proto-pso-menu/blob/main/src/retro_fx.inc.c) (Retro effects), [`src/gles.c`](https://github.com/wozt/proto-pso-menu/blob/main/src/gles.c) (GLES renderer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["UI runtime"]
  node_context["UI context<br/>[core.c]"]
  node_render["SDL drawing<br/>[render.c]"]
  node_image["Image support<br/>[image.c]"]
end

subgraph group_interaction["Input and components"]
  node_widgets["Widgets<br/>[widgets.c]"]
  node_input["Input adapter<br/>[input.c]"]
  node_layout["Layout geometry<br/>[layout.c]"]
  node_extras["Extended widgets<br/>[extra.c]"]
  node_text["Text editing<br/>[text.c]"]
  node_advanced["Advanced controls<br/>[advanced.c]"]
  node_filter["Filtering<br/>[filter.c]"]
end

subgraph group_visual["Visual systems"]
  node_crt["Legacy CRT<br/>[crt.c]"]
  node_retro["Retro effects<br/>[retro_fx.inc.c]"]
  node_retro_settings["Effect settings<br/>[retro_settings.c]"]
  node_shader_sources["Shader sources"]
  node_gles["GLES renderer<br/>[gles.c]"]
  node_gles_stub["GLES stub<br/>[gles_stub.c]"]
  node_cyber["Cyber background<br/>[cyber.c]"]
end

subgraph group_services["Configuration and terminal"]
  node_config["Profiles<br/>[config.c]"]
  node_terminal["Shell terminal<br/>[terminal.c]"]
  node_terminal_stub["Terminal stub<br/>[terminal_stub.c]"]
end

node_host(("Host application"))

node_host -->|"creates context"| node_context
node_host -->|"routes events"| node_input
node_host -->|"declares widgets"| node_widgets
node_host -->|"ends frame"| node_render
node_host -.->|"may composite"| node_gles
node_context -.->|"frames UI"| node_widgets
node_widgets -.->|"draws UI"| node_render
node_host -->|"uses geometry"| node_layout
node_host -->|"loads profiles"| node_config
node_host -->|"may render background"| node_cyber
node_host -->|"may poll and draw"| node_terminal
node_gles -->|"uses effects"| node_retro
node_retro -->|"includes shaders"| node_shader_sources
node_gles_stub -.->|"provides fallback API"| node_host
node_terminal_stub -.->|"provides fallback API"| node_host

click node_context "https://github.com/wozt/proto-pso-menu/blob/main/src/core.c"
click node_render "https://github.com/wozt/proto-pso-menu/blob/main/src/render.c"
click node_widgets "https://github.com/wozt/proto-pso-menu/blob/main/src/widgets.c"
click node_input "https://github.com/wozt/proto-pso-menu/blob/main/src/input.c"
click node_layout "https://github.com/wozt/proto-pso-menu/blob/main/src/layout.c"
click node_extras "https://github.com/wozt/proto-pso-menu/blob/main/src/extra.c"
click node_text "https://github.com/wozt/proto-pso-menu/blob/main/src/text.c"
click node_config "https://github.com/wozt/proto-pso-menu/blob/main/src/config.c"
click node_crt "https://github.com/wozt/proto-pso-menu/blob/main/src/crt.c"
click node_retro "https://github.com/wozt/proto-pso-menu/blob/main/src/retro_fx.inc.c"
click node_retro_settings "https://github.com/wozt/proto-pso-menu/blob/main/src/retro_settings.c"
click node_shader_sources "https://github.com/wozt/proto-pso-menu/blob/main/src/retro_shaders.inc.h"
click node_gles "https://github.com/wozt/proto-pso-menu/blob/main/src/gles.c"
click node_gles_stub "https://github.com/wozt/proto-pso-menu/blob/main/src/gles_stub.c"
click node_cyber "https://github.com/wozt/proto-pso-menu/blob/main/src/cyber.c"
click node_image "https://github.com/wozt/proto-pso-menu/blob/main/src/image.c"
click node_terminal "https://github.com/wozt/proto-pso-menu/blob/main/src/terminal.c"
click node_terminal_stub "https://github.com/wozt/proto-pso-menu/blob/main/src/terminal_stub.c"
click node_advanced "https://github.com/wozt/proto-pso-menu/blob/main/src/advanced.c"
click node_filter "https://github.com/wozt/proto-pso-menu/blob/main/src/filter.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_context,node_render,node_image toneBlue
class node_widgets,node_input,node_layout,node_extras,node_text,node_advanced,node_filter toneAmber
class node_crt,node_retro,node_retro_settings,node_shader_sources,node_gles,node_gles_stub,node_cyber toneMint
class node_config,node_terminal,node_terminal_stub toneRose
class node_host toneIndigo
```

## Components

### UI runtime

- [UI context](https://github.com/wozt/proto-pso-menu/blob/main/src/core.c): `src/core.c`
- [SDL drawing](https://github.com/wozt/proto-pso-menu/blob/main/src/render.c): `src/render.c`
- [Image support](https://github.com/wozt/proto-pso-menu/blob/main/src/image.c): `src/image.c`

### Input and components

- [Widgets](https://github.com/wozt/proto-pso-menu/blob/main/src/widgets.c): `src/widgets.c`
- [Input adapter](https://github.com/wozt/proto-pso-menu/blob/main/src/input.c): `src/input.c`
- [Layout geometry](https://github.com/wozt/proto-pso-menu/blob/main/src/layout.c): `src/layout.c`
- [Extended widgets](https://github.com/wozt/proto-pso-menu/blob/main/src/extra.c): `src/extra.c`
- [Text editing](https://github.com/wozt/proto-pso-menu/blob/main/src/text.c): `src/text.c`
- [Advanced controls](https://github.com/wozt/proto-pso-menu/blob/main/src/advanced.c): `src/advanced.c`
- [Filtering](https://github.com/wozt/proto-pso-menu/blob/main/src/filter.c): `src/filter.c`

### Visual systems

- [Legacy CRT](https://github.com/wozt/proto-pso-menu/blob/main/src/crt.c): `src/crt.c`
- [Retro effects](https://github.com/wozt/proto-pso-menu/blob/main/src/retro_fx.inc.c): `src/retro_fx.inc.c`
- [Effect settings](https://github.com/wozt/proto-pso-menu/blob/main/src/retro_settings.c): `src/retro_settings.c`
- [Shader sources](https://github.com/wozt/proto-pso-menu/blob/main/src/retro_shaders.inc.h): `src/retro_shaders.inc.h`
- [GLES renderer](https://github.com/wozt/proto-pso-menu/blob/main/src/gles.c): `src/gles.c`
- [GLES stub](https://github.com/wozt/proto-pso-menu/blob/main/src/gles_stub.c): `src/gles_stub.c`
- [Cyber background](https://github.com/wozt/proto-pso-menu/blob/main/src/cyber.c): `src/cyber.c`

### Configuration and terminal

- [Profiles](https://github.com/wozt/proto-pso-menu/blob/main/src/config.c): `src/config.c`
- [Shell terminal](https://github.com/wozt/proto-pso-menu/blob/main/src/terminal.c): `src/terminal.c`
- [Terminal stub](https://github.com/wozt/proto-pso-menu/blob/main/src/terminal_stub.c): `src/terminal_stub.c`

### Other components

- **Host application**

## Connections

- Host application → UI context: creates context (evidence: `README.md`)
- Host application → Input adapter: routes events (evidence: `README.md`)
- Host application → Widgets: declares widgets (evidence: `README.md`)
- Host application → SDL drawing: ends frame (evidence: `README.md`)
- Host application → GLES renderer: may composite (evidence: `README.md`)
- UI context → Widgets: frames UI
- Widgets → SDL drawing: draws UI
- Host application → Layout geometry: uses geometry (evidence: `README.md`)
- Host application → Profiles: loads profiles (evidence: `README.md`)
- Host application → Cyber background: may render background (evidence: `README.md`)
- Host application → Shell terminal: may poll and draw (evidence: `README.md`)
- GLES renderer → Retro effects: uses effects (evidence: `src/gles.c`)
- Retro effects → Shader sources: includes shaders (evidence: `src/retro_fx.inc.c`)
- GLES stub → Host application: provides fallback API (evidence: `README.md`)
- Terminal stub → Host application: provides fallback API (evidence: `README.md`)
