# bitbranchi/sdl-skeleton architecture

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

- Interactive diagram: https://gitdiagram.com/bitbranchi/sdl-skeleton
- Repository: https://github.com/bitbranchi/sdl-skeleton

## Overview

SDL-Skeleton is reusable SDL2 game boilerplate: the application initializes SDL and its renderer, advances input and UI state each frame, updates the camera, and presents the frame. Its reusable capabilities include camera and input helpers, cached texture and audio resources, and a stateful immediate-mode UI with widgets, themes, animation, text, and drawing. The README describes the project only at a high level; several subsystem relationships below are supported by the source index rather than inspected implementations.

Main entry points: [`src/game.cpp`](https://github.com/bitbranchi/sdl-skeleton/blob/main/src/game.cpp) (Game Loop), [`src/ui/ImState.h`](https://github.com/bitbranchi/sdl-skeleton/blob/main/src/ui/ImState.h) (Widget State), [`src/ui/core/UIDraw.h`](https://github.com/bitbranchi/sdl-skeleton/blob/main/src/ui/core/UIDraw.h) (UI Drawing), [`src/ui/core/UIText.h`](https://github.com/bitbranchi/sdl-skeleton/blob/main/src/ui/core/UIText.h) (Text Textures)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Game Runtime"]
  node_launcher["Application Entry<br/>[main.cpp]"]
  node_game["Game Loop<br/>[game.cpp]"]
  node_input["Input State<br/>[input.h]"]
  node_camera["Camera<br/>[camera.h]"]
end

subgraph group_resources["Resources and Audio"]
  node_resource["Texture Cache<br/>[resource_manager.h]"]
  node_textureids["Texture Definitions<br/>[texture.h]"]
  node_soundmanager["Sound Manager<br/>[sound_manager.h]"]
  node_sounddefs["Sound Definitions<br/>[sound.h]"]
end

subgraph group_ui["UI Framework"]
  node_widgets["UI Widgets<br/>[ImWidgets.h]"]
  node_uistate["Widget State<br/>[ImState.h]"]
  node_theme["UI Themes<br/>[Theme.h]"]
  node_draw["UI Drawing<br/>[UIDraw.h]"]
  node_uiinput["UI Input<br/>[UIInput.h]"]
  node_context["UI Context<br/>[UIContext.h]"]
  node_text["Text Textures<br/>[UIText.h]"]
  node_fonts["Font Cache<br/>[UIFont.h]"]
  node_fontdefs["Font Definitions<br/>[font.h]"]
  node_tween["UI Animation<br/>[Tween.h]"]
  node_types["UI Geometry<br/>[UITypes.h]"]
end

subgraph group_utility["Utilities"]
  node_randomizer["Random Helpers<br/>[randomizer.h]"]
  node_vectors["Vector Math<br/>[vector2.hpp]"]
end

node_launcher -->|"starts"| node_game
node_game -->|"updates"| node_input
node_game -->|"updates"| node_camera
node_game -->|"initializes"| node_resource
node_game -->|"initializes"| node_soundmanager
node_game -->|"begins frame"| node_uistate
node_game -.->|"presents via"| node_draw
node_resource -->|"loads definitions"| node_textureids
node_soundmanager -->|"loads definitions"| node_sounddefs
node_widgets -->|"uses state"| node_uistate
node_uistate -->|"reads theme"| node_theme
node_uistate -->|"advances animation"| node_tween
node_uistate -->|"caches text"| node_text
node_uistate -->|"resets drawing"| node_draw
node_draw -->|"gets textures"| node_resource
node_draw -->|"uses styles"| node_theme
node_draw -->|"uses renderer"| node_context
node_draw -->|"draws text"| node_text
node_context -->|"clears fonts"| node_fonts
node_text -->|"uses renderer"| node_context
node_text -->|"gets fonts"| node_fonts
node_fonts -->|"reads paths"| node_fontdefs
node_uiinput -->|"reads input"| node_input
node_camera -->|"uses geometry"| node_types
node_camera -->|"uses vectors"| node_vectors
node_input -->|"uses vectors"| node_vectors
node_randomizer -->|"uses vectors"| node_vectors

click node_launcher "https://github.com/bitbranchi/sdl-skeleton/blob/main/src/main.cpp"
click node_game "https://github.com/bitbranchi/sdl-skeleton/blob/main/src/game.cpp"
click node_input "https://github.com/bitbranchi/sdl-skeleton/blob/main/src/input.h"
click node_camera "https://github.com/bitbranchi/sdl-skeleton/blob/main/src/camera.h"
click node_resource "https://github.com/bitbranchi/sdl-skeleton/blob/main/src/resource_manager.h"
click node_textureids "https://github.com/bitbranchi/sdl-skeleton/blob/main/src/texture.h"
click node_soundmanager "https://github.com/bitbranchi/sdl-skeleton/blob/main/src/sound_manager.h"
click node_sounddefs "https://github.com/bitbranchi/sdl-skeleton/blob/main/src/sound.h"
click node_widgets "https://github.com/bitbranchi/sdl-skeleton/blob/main/src/ui/ImWidgets.h"
click node_uistate "https://github.com/bitbranchi/sdl-skeleton/blob/main/src/ui/ImState.h"
click node_theme "https://github.com/bitbranchi/sdl-skeleton/blob/main/src/ui/core/Theme.h"
click node_draw "https://github.com/bitbranchi/sdl-skeleton/blob/main/src/ui/core/UIDraw.h"
click node_uiinput "https://github.com/bitbranchi/sdl-skeleton/blob/main/src/ui/core/UIInput.h"
click node_context "https://github.com/bitbranchi/sdl-skeleton/blob/main/src/ui/core/UIContext.h"
click node_text "https://github.com/bitbranchi/sdl-skeleton/blob/main/src/ui/core/UIText.h"
click node_fonts "https://github.com/bitbranchi/sdl-skeleton/blob/main/src/ui/core/UIFont.h"
click node_fontdefs "https://github.com/bitbranchi/sdl-skeleton/blob/main/src/ui/core/font.h"
click node_tween "https://github.com/bitbranchi/sdl-skeleton/blob/main/src/ui/core/Tween.h"
click node_types "https://github.com/bitbranchi/sdl-skeleton/blob/main/src/ui/core/UITypes.h"
click node_randomizer "https://github.com/bitbranchi/sdl-skeleton/blob/main/src/util/randomizer.h"
click node_vectors "https://github.com/bitbranchi/sdl-skeleton/blob/main/src/util/vector2.hpp"

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_launcher,node_game,node_input,node_camera toneBlue
class node_resource,node_textureids,node_soundmanager,node_sounddefs toneAmber
class node_widgets,node_uistate,node_theme,node_draw,node_uiinput,node_context,node_text,node_fonts,node_fontdefs,node_tween,node_types toneMint
class node_randomizer,node_vectors toneRose
```

## Components

### Game Runtime

- [Application Entry](https://github.com/bitbranchi/sdl-skeleton/blob/main/src/main.cpp): `src/main.cpp`
- [Game Loop](https://github.com/bitbranchi/sdl-skeleton/blob/main/src/game.cpp): `src/game.cpp`
- [Input State](https://github.com/bitbranchi/sdl-skeleton/blob/main/src/input.h): `src/input.h`
- [Camera](https://github.com/bitbranchi/sdl-skeleton/blob/main/src/camera.h): `src/camera.h`

### Resources and Audio

- [Texture Cache](https://github.com/bitbranchi/sdl-skeleton/blob/main/src/resource_manager.h): `src/resource_manager.h`
- [Texture Definitions](https://github.com/bitbranchi/sdl-skeleton/blob/main/src/texture.h): `src/texture.h`
- [Sound Manager](https://github.com/bitbranchi/sdl-skeleton/blob/main/src/sound_manager.h): `src/sound_manager.h`
- [Sound Definitions](https://github.com/bitbranchi/sdl-skeleton/blob/main/src/sound.h): `src/sound.h`

### UI Framework

- [UI Widgets](https://github.com/bitbranchi/sdl-skeleton/blob/main/src/ui/ImWidgets.h): `src/ui/ImWidgets.h`
- [Widget State](https://github.com/bitbranchi/sdl-skeleton/blob/main/src/ui/ImState.h): `src/ui/ImState.h`
- [UI Themes](https://github.com/bitbranchi/sdl-skeleton/blob/main/src/ui/core/Theme.h): `src/ui/core/Theme.h`
- [UI Drawing](https://github.com/bitbranchi/sdl-skeleton/blob/main/src/ui/core/UIDraw.h): `src/ui/core/UIDraw.h`
- [UI Input](https://github.com/bitbranchi/sdl-skeleton/blob/main/src/ui/core/UIInput.h): `src/ui/core/UIInput.h`
- [UI Context](https://github.com/bitbranchi/sdl-skeleton/blob/main/src/ui/core/UIContext.h): `src/ui/core/UIContext.h`
- [Text Textures](https://github.com/bitbranchi/sdl-skeleton/blob/main/src/ui/core/UIText.h): `src/ui/core/UIText.h`
- [Font Cache](https://github.com/bitbranchi/sdl-skeleton/blob/main/src/ui/core/UIFont.h): `src/ui/core/UIFont.h`
- [Font Definitions](https://github.com/bitbranchi/sdl-skeleton/blob/main/src/ui/core/font.h): `src/ui/core/font.h`
- [UI Animation](https://github.com/bitbranchi/sdl-skeleton/blob/main/src/ui/core/Tween.h): `src/ui/core/Tween.h`
- [UI Geometry](https://github.com/bitbranchi/sdl-skeleton/blob/main/src/ui/core/UITypes.h): `src/ui/core/UITypes.h`

### Utilities

- [Random Helpers](https://github.com/bitbranchi/sdl-skeleton/blob/main/src/util/randomizer.h): `src/util/randomizer.h`
- [Vector Math](https://github.com/bitbranchi/sdl-skeleton/blob/main/src/util/vector2.hpp): `src/util/vector2.hpp`

## Connections

- Application Entry → Game Loop: starts (evidence: `src/main.cpp`)
- Game Loop → Input State: updates (evidence: `src/game.cpp`)
- Game Loop → Camera: updates (evidence: `src/game.cpp`)
- Game Loop → Texture Cache: initializes (evidence: `src/game.cpp`)
- Game Loop → Sound Manager: initializes (evidence: `src/game.cpp`)
- Game Loop → Widget State: begins frame (evidence: `src/game.cpp`)
- Game Loop → UI Drawing: presents via (evidence: `src/game.cpp`)
- Texture Cache → Texture Definitions: loads definitions (evidence: `src/resource_manager.h`)
- Sound Manager → Sound Definitions: loads definitions (evidence: `src/sound_manager.h`)
- UI Widgets → Widget State: uses state (evidence: `src/ui/ImWidgets.h`)
- Widget State → UI Themes: reads theme (evidence: `src/ui/ImState.h`)
- Widget State → UI Animation: advances animation (evidence: `src/ui/ImState.h`)
- Widget State → Text Textures: caches text (evidence: `src/ui/ImState.h`)
- Widget State → UI Drawing: resets drawing (evidence: `src/ui/ImState.h`)
- UI Drawing → Texture Cache: gets textures (evidence: `src/ui/core/UIDraw.h`)
- UI Drawing → UI Themes: uses styles (evidence: `src/ui/core/UIDraw.h`)
- UI Drawing → UI Context: uses renderer (evidence: `src/ui/core/UIDraw.h`)
- UI Drawing → Text Textures: draws text (evidence: `src/ui/core/UIDraw.h`)
- UI Context → Font Cache: clears fonts (evidence: `src/ui/core/UIContext.h`)
- Text Textures → UI Context: uses renderer (evidence: `src/ui/core/UIText.h`)
- Text Textures → Font Cache: gets fonts (evidence: `src/ui/core/UIText.h`)
- Font Cache → Font Definitions: reads paths (evidence: `src/ui/core/UIFont.h`)
- UI Input → Input State: reads input (evidence: `src/ui/core/UIInput.h`)
- Camera → UI Geometry: uses geometry (evidence: `src/camera.h`)
- Camera → Vector Math: uses vectors (evidence: `src/camera.h`)
- Input State → Vector Math: uses vectors (evidence: `src/input.h`)
- Random Helpers → Vector Math: uses vectors (evidence: `src/util/randomizer.h`)
