# adsgames/asw architecture

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

- Interactive diagram: https://gitdiagram.com/adsgames/asw
- Repository: https://github.com/adsgames/asw

## Overview

ASW is a C++ SDL3 wrapper for game developers, with support for browser builds. A game initializes the runtime, handles input and actions, loads assets, and uses display/drawing and audio APIs to present interactive content. The library also provides lighting, particles, scene/game helpers, dialogs, and a widget-based UI. The source index shows several runtime call sites; other capability links below are documented by the README or are left dashed where implementation connections were not sampled.

Main entry points: [`src/modules/core.cpp`](https://github.com/adsgames/asw/blob/main/src/modules/core.cpp) (Core lifecycle), [`src/modules/ui/root.cpp`](https://github.com/adsgames/asw/blob/main/src/modules/ui/root.cpp) (UI root), [`src/modules/input.cpp`](https://github.com/adsgames/asw/blob/main/src/modules/input.cpp) (Input devices), [`src/modules/display.cpp`](https://github.com/adsgames/asw/blob/main/src/modules/display.cpp) (Window display)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and Configuration"]
  node_core["Core lifecycle<br/>[core.cpp]"]
  node_config["Runtime config<br/>[config.cpp]"]
  node_web["Browser runtime hooks<br/>[asw-web.js]"]
end

subgraph group_render["Graphics and Assets"]
  node_display["Window display<br/>[display.cpp]"]
  node_draw["2D drawing<br/>[draw.cpp]"]
  node_assets["Asset loading<br/>[assets.cpp]"]
  node_camera["Camera<br/>[camera.cpp]"]
  node_geometry["Geometry types<br/>[geometry.cpp]"]
  node_color["Color utilities<br/>[color.h]"]
  node_lighting["Lighting<br/>[lighting.cpp]"]
end

subgraph group_interaction["Input and UI"]
  node_input["Input devices<br/>[input.cpp]"]
  node_actions["Action mapping<br/>[action.cpp]"]
  node_uiroot["UI root<br/>[root.cpp]"]
  node_uicontext["Focus context<br/>[context.cpp]"]
  node_widget["Widget base<br/>[widget.cpp]"]
  node_layout["UI layout<br/>[layout.cpp]"]
  node_theme["UI theme<br/>[theme.cpp]"]
  node_widgets["UI controls"]
end

subgraph group_gameplay["Game Services"]
  node_sound["Sound playback<br/>[sound.cpp]"]
  node_particles["Particles<br/>[particles.cpp]"]
  node_scene["Scene helpers<br/>[scene.h]"]
  node_gamehelpers["Game helpers<br/>[game.h]"]
  node_dialogs["Dialogs<br/>[dialog.cpp]"]
end

node_developer(("Game developer"))
node_game["Game application"]
node_browser(("Browser"))

node_developer -->|"builds with"| node_game
node_game -.->|"initializes"| node_core
node_core -->|"loads"| node_config
node_core -->|"initializes"| node_display
node_core -->|"initializes"| node_input
node_core -->|"clears"| node_assets
node_core -->|"initializes"| node_sound
node_game -.->|"reads"| node_input
node_game -.->|"maps"| node_actions
node_input -->|"queries"| node_display
node_assets -->|"uses renderer"| node_display
node_draw -->|"draws through"| node_display
node_lighting -->|"loads assets"| node_assets
node_lighting -->|"renders with"| node_draw
node_game -.->|"positions view"| node_camera
node_game -.->|"uses"| node_lighting
node_game -.->|"uses"| node_particles
node_game -.->|"organizes scenes"| node_scene
node_game -.->|"uses"| node_gamehelpers
node_game -.->|"opens"| node_dialogs
node_game -.->|"plays audio"| node_sound
node_uiroot -->|"reads events"| node_input
node_uiroot -->|"renders with"| node_draw
node_uiroot -->|"uses audio"| node_sound
node_uiroot -->|"manages focus"| node_uicontext
node_uiroot -.->|"traverses tree"| node_widget
node_uicontext -->|"holds theme"| node_theme
node_uicontext -->|"focuses"| node_widget
node_layout -->|"lays out"| node_widget
node_widgets -.->|"extends"| node_widget
node_game -.->|"presents UI"| node_uiroot
node_developer -->|"sets options"| node_config
node_developer -->|"configures build"| node_web
node_web -->|"reports status"| node_browser

click node_core "https://github.com/adsgames/asw/blob/main/src/modules/core.cpp"
click node_config "https://github.com/adsgames/asw/blob/main/src/modules/config.cpp"
click node_display "https://github.com/adsgames/asw/blob/main/src/modules/display.cpp"
click node_draw "https://github.com/adsgames/asw/blob/main/src/modules/draw.cpp"
click node_assets "https://github.com/adsgames/asw/blob/main/src/modules/assets.cpp"
click node_camera "https://github.com/adsgames/asw/blob/main/src/modules/camera.cpp"
click node_geometry "https://github.com/adsgames/asw/blob/main/src/modules/geometry.cpp"
click node_color "https://github.com/adsgames/asw/blob/main/include/asw/modules/color.h"
click node_lighting "https://github.com/adsgames/asw/blob/main/src/modules/lighting.cpp"
click node_input "https://github.com/adsgames/asw/blob/main/src/modules/input.cpp"
click node_actions "https://github.com/adsgames/asw/blob/main/src/modules/action.cpp"
click node_uiroot "https://github.com/adsgames/asw/blob/main/src/modules/ui/root.cpp"
click node_uicontext "https://github.com/adsgames/asw/blob/main/src/modules/ui/context.cpp"
click node_widget "https://github.com/adsgames/asw/blob/main/src/modules/ui/widget.cpp"
click node_layout "https://github.com/adsgames/asw/blob/main/src/modules/ui/layout.cpp"
click node_theme "https://github.com/adsgames/asw/blob/main/src/modules/ui/theme.cpp"
click node_widgets "https://github.com/adsgames/asw/tree/main/include/asw/modules/ui"
click node_sound "https://github.com/adsgames/asw/blob/main/src/modules/sound.cpp"
click node_particles "https://github.com/adsgames/asw/blob/main/src/modules/particles.cpp"
click node_scene "https://github.com/adsgames/asw/blob/main/include/asw/modules/scene.h"
click node_gamehelpers "https://github.com/adsgames/asw/blob/main/include/asw/modules/game.h"
click node_dialogs "https://github.com/adsgames/asw/blob/main/src/modules/dialog.cpp"
click node_web "https://github.com/adsgames/asw/blob/main/web/asw-web.js"

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_core,node_config,node_web,node_browser toneBlue
class node_display,node_draw,node_assets,node_camera,node_geometry,node_color,node_lighting toneAmber
class node_input,node_actions,node_uiroot,node_uicontext,node_widget,node_layout,node_theme,node_widgets toneMint
class node_sound,node_particles,node_scene,node_gamehelpers,node_dialogs toneRose
class node_developer,node_game toneIndigo
```

## Components

### Runtime and Configuration

- [Core lifecycle](https://github.com/adsgames/asw/blob/main/src/modules/core.cpp): `src/modules/core.cpp`
- [Runtime config](https://github.com/adsgames/asw/blob/main/src/modules/config.cpp): `src/modules/config.cpp`
- [Browser runtime hooks](https://github.com/adsgames/asw/blob/main/web/asw-web.js): `web/asw-web.js`

### Graphics and Assets

- [Window display](https://github.com/adsgames/asw/blob/main/src/modules/display.cpp): `src/modules/display.cpp`
- [2D drawing](https://github.com/adsgames/asw/blob/main/src/modules/draw.cpp): `src/modules/draw.cpp`
- [Asset loading](https://github.com/adsgames/asw/blob/main/src/modules/assets.cpp): `src/modules/assets.cpp`
- [Camera](https://github.com/adsgames/asw/blob/main/src/modules/camera.cpp): `src/modules/camera.cpp`
- [Geometry types](https://github.com/adsgames/asw/blob/main/src/modules/geometry.cpp): `src/modules/geometry.cpp`
- [Color utilities](https://github.com/adsgames/asw/blob/main/include/asw/modules/color.h): `include/asw/modules/color.h`
- [Lighting](https://github.com/adsgames/asw/blob/main/src/modules/lighting.cpp): `src/modules/lighting.cpp`

### Input and UI

- [Input devices](https://github.com/adsgames/asw/blob/main/src/modules/input.cpp): `src/modules/input.cpp`
- [Action mapping](https://github.com/adsgames/asw/blob/main/src/modules/action.cpp): `src/modules/action.cpp`
- [UI root](https://github.com/adsgames/asw/blob/main/src/modules/ui/root.cpp): `src/modules/ui/root.cpp`
- [Focus context](https://github.com/adsgames/asw/blob/main/src/modules/ui/context.cpp): `src/modules/ui/context.cpp`
- [Widget base](https://github.com/adsgames/asw/blob/main/src/modules/ui/widget.cpp): `src/modules/ui/widget.cpp`
- [UI layout](https://github.com/adsgames/asw/blob/main/src/modules/ui/layout.cpp): `src/modules/ui/layout.cpp`
- [UI theme](https://github.com/adsgames/asw/blob/main/src/modules/ui/theme.cpp): `src/modules/ui/theme.cpp`
- [UI controls](https://github.com/adsgames/asw/tree/main/include/asw/modules/ui): `include/asw/modules/ui`

### Game Services

- [Sound playback](https://github.com/adsgames/asw/blob/main/src/modules/sound.cpp): `src/modules/sound.cpp`
- [Particles](https://github.com/adsgames/asw/blob/main/src/modules/particles.cpp): `src/modules/particles.cpp`
- [Scene helpers](https://github.com/adsgames/asw/blob/main/include/asw/modules/scene.h): `include/asw/modules/scene.h`
- [Game helpers](https://github.com/adsgames/asw/blob/main/include/asw/modules/game.h): `include/asw/modules/game.h`
- [Dialogs](https://github.com/adsgames/asw/blob/main/src/modules/dialog.cpp): `src/modules/dialog.cpp`

### Other components

- **Game developer**
- **Game application**
- **Browser**

## Connections

- Game developer → Game application: builds with
- Game application → Core lifecycle: initializes
- Core lifecycle → Runtime config: loads (evidence: `src/modules/core.cpp`)
- Core lifecycle → Window display: initializes (evidence: `src/modules/core.cpp`)
- Core lifecycle → Input devices: initializes (evidence: `src/modules/core.cpp`)
- Core lifecycle → Asset loading: clears (evidence: `src/modules/core.cpp`)
- Core lifecycle → Sound playback: initializes (evidence: `src/modules/core.cpp`)
- Game application → Input devices: reads
- Game application → Action mapping: maps
- Input devices → Window display: queries (evidence: `src/modules/input.cpp`)
- Asset loading → Window display: uses renderer (evidence: `src/modules/assets.cpp`)
- 2D drawing → Window display: draws through (evidence: `src/modules/draw.cpp`)
- Lighting → Asset loading: loads assets (evidence: `src/modules/lighting.cpp`)
- Lighting → 2D drawing: renders with (evidence: `src/modules/lighting.cpp`)
- Game application → Camera: positions view
- Game application → Lighting: uses
- Game application → Particles: uses
- Game application → Scene helpers: organizes scenes
- Game application → Game helpers: uses
- Game application → Dialogs: opens
- Game application → Sound playback: plays audio
- UI root → Input devices: reads events (evidence: `src/modules/ui/root.cpp`)
- UI root → 2D drawing: renders with (evidence: `src/modules/ui/root.cpp`)
- UI root → Sound playback: uses audio (evidence: `src/modules/ui/root.cpp`)
- UI root → Focus context: manages focus
- UI root → Widget base: traverses tree
- Focus context → UI theme: holds theme
- Focus context → Widget base: focuses
- UI layout → Widget base: lays out
- UI controls → Widget base: extends (evidence: `src/modules/ui/widget.cpp`)
- Game application → UI root: presents UI
- Game developer → Runtime config: sets options
- Game developer → Browser runtime hooks: configures build
- Browser runtime hooks → Browser: reports status
