# dhustkoder/sdl2 architecture

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

- Interactive diagram: https://gitdiagram.com/dhustkoder/sdl2
- Repository: https://github.com/dhustkoder/sdl2

## Overview

SDL 2.0 is a cross-platform C library exposing low-level multimedia APIs. A typical application uses its public interfaces to create windows and render graphics, play or capture audio, and receive input events; it can also work with surfaces, streams, synchronization, and platform facilities. The supplied tree contains public headers, not runtime implementations, so the graph describes documented API capabilities and visible header/type dependencies rather than internal execution. The README documents hardware access; unsampled implementation relationships are omitted.

Main entry points: [`include/SDL_events.h`](https://github.com/dhustkoder/sdl2/blob/master/include/SDL_events.h) (Event queue API), [`include/SDL_video.h`](https://github.com/dhustkoder/sdl2/blob/master/include/SDL_video.h) (Video and windows), [`include/SDL_audio.h`](https://github.com/dhustkoder/sdl2/blob/master/include/SDL_audio.h) (Audio devices), [`include/SDL_joystick.h`](https://github.com/dhustkoder/sdl2/blob/master/include/SDL_joystick.h) (Joystick input)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_graphics["Graphics and windows"]
  node_video["Video and windows<br/>[SDL_video.h]"]
  node_render["2D rendering<br/>[SDL_render.h]"]
  node_surface["Surfaces and pixels<br/>[SDL_surface.h]"]
  node_opengl["OpenGL interfaces<br/>[SDL_opengl.h]"]
end

subgraph group_media["Audio and input"]
  node_audio["Audio devices<br/>[SDL_audio.h]"]
  node_events["Event queue API<br/>[SDL_events.h]"]
  node_keyboard["Keyboard input<br/>[SDL_keyboard.h]"]
  node_mouse["Mouse input<br/>[SDL_mouse.h]"]
  node_joystick["Joystick input<br/>[SDL_joystick.h]"]
  node_controller["Game controllers"]
  node_touch["Touch input<br/>[SDL_touch.h]"]
  node_haptic["Haptic feedback<br/>[SDL_haptic.h]"]
end

subgraph group_core["Shared runtime APIs"]
  node_streams["Data streams<br/>[SDL_rwops.h]"]
  node_threading["Threads and mutexes<br/>[SDL_thread.h]"]
  node_types["Base types and config<br/>[SDL_stdinc.h]"]
end

subgraph group_platform["Platform interfaces"]
  node_platform["Platform configuration<br/>[SDL_platform.h]"]
end

node_developer(("SDL application"))
node_hardware["Multimedia hardware"]

node_developer -->|"uses API"| node_video
node_developer -->|"uses API"| node_render
node_developer -->|"uses API"| node_audio
node_developer -->|"uses API"| node_keyboard
node_developer -->|"uses API"| node_mouse
node_developer -->|"uses API"| node_joystick
node_video -->|"accesses graphics"| node_hardware
node_audio -->|"accesses audio"| node_hardware
node_keyboard -->|"accesses input"| node_hardware
node_mouse -->|"accesses input"| node_hardware
node_joystick -->|"accesses input"| node_hardware
node_render -->|"uses types"| node_video
node_render -->|"uses rectangles"| node_surface
node_surface -->|"loads from"| node_streams
node_controller -->|"maps controls"| node_joystick
node_events -->|"uses types"| node_video
node_events -->|"uses types"| node_keyboard
node_events -->|"uses types"| node_mouse
node_events -->|"uses types"| node_joystick
node_events -->|"uses types"| node_controller
node_events -->|"uses types"| node_touch
node_audio -->|"uses streams"| node_streams
node_audio -->|"uses synchronization"| node_threading
node_threading -->|"uses base types"| node_types
node_types -->|"includes config"| node_platform
node_video -->|"exposes GL support"| node_opengl

click node_video "https://github.com/dhustkoder/sdl2/blob/master/include/SDL_video.h"
click node_render "https://github.com/dhustkoder/sdl2/blob/master/include/SDL_render.h"
click node_surface "https://github.com/dhustkoder/sdl2/blob/master/include/SDL_surface.h"
click node_opengl "https://github.com/dhustkoder/sdl2/blob/master/include/SDL_opengl.h"
click node_audio "https://github.com/dhustkoder/sdl2/blob/master/include/SDL_audio.h"
click node_events "https://github.com/dhustkoder/sdl2/blob/master/include/SDL_events.h"
click node_keyboard "https://github.com/dhustkoder/sdl2/blob/master/include/SDL_keyboard.h"
click node_mouse "https://github.com/dhustkoder/sdl2/blob/master/include/SDL_mouse.h"
click node_joystick "https://github.com/dhustkoder/sdl2/blob/master/include/SDL_joystick.h"
click node_controller "https://github.com/dhustkoder/sdl2/blob/master/include/SDL_gamecontroller.h"
click node_touch "https://github.com/dhustkoder/sdl2/blob/master/include/SDL_touch.h"
click node_haptic "https://github.com/dhustkoder/sdl2/blob/master/include/SDL_haptic.h"
click node_streams "https://github.com/dhustkoder/sdl2/blob/master/include/SDL_rwops.h"
click node_threading "https://github.com/dhustkoder/sdl2/blob/master/include/SDL_thread.h"
click node_types "https://github.com/dhustkoder/sdl2/blob/master/include/SDL_stdinc.h"
click node_platform "https://github.com/dhustkoder/sdl2/blob/master/include/SDL_platform.h"

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_video,node_render,node_surface,node_opengl toneBlue
class node_audio,node_events,node_keyboard,node_mouse,node_joystick,node_controller,node_touch,node_haptic toneAmber
class node_streams,node_threading,node_types toneMint
class node_platform toneRose
class node_developer,node_hardware toneIndigo
```

## Components

### Graphics and windows

- [Video and windows](https://github.com/dhustkoder/sdl2/blob/master/include/SDL_video.h): `include/SDL_video.h`
- [2D rendering](https://github.com/dhustkoder/sdl2/blob/master/include/SDL_render.h): `include/SDL_render.h`
- [Surfaces and pixels](https://github.com/dhustkoder/sdl2/blob/master/include/SDL_surface.h): `include/SDL_surface.h`
- [OpenGL interfaces](https://github.com/dhustkoder/sdl2/blob/master/include/SDL_opengl.h): `include/SDL_opengl.h`

### Audio and input

- [Audio devices](https://github.com/dhustkoder/sdl2/blob/master/include/SDL_audio.h): `include/SDL_audio.h`
- [Event queue API](https://github.com/dhustkoder/sdl2/blob/master/include/SDL_events.h): `include/SDL_events.h`
- [Keyboard input](https://github.com/dhustkoder/sdl2/blob/master/include/SDL_keyboard.h): `include/SDL_keyboard.h`
- [Mouse input](https://github.com/dhustkoder/sdl2/blob/master/include/SDL_mouse.h): `include/SDL_mouse.h`
- [Joystick input](https://github.com/dhustkoder/sdl2/blob/master/include/SDL_joystick.h): `include/SDL_joystick.h`
- [Game controllers](https://github.com/dhustkoder/sdl2/blob/master/include/SDL_gamecontroller.h): `include/SDL_gamecontroller.h`
- [Touch input](https://github.com/dhustkoder/sdl2/blob/master/include/SDL_touch.h): `include/SDL_touch.h`
- [Haptic feedback](https://github.com/dhustkoder/sdl2/blob/master/include/SDL_haptic.h): `include/SDL_haptic.h`

### Shared runtime APIs

- [Data streams](https://github.com/dhustkoder/sdl2/blob/master/include/SDL_rwops.h): `include/SDL_rwops.h`
- [Threads and mutexes](https://github.com/dhustkoder/sdl2/blob/master/include/SDL_thread.h): `include/SDL_thread.h`
- [Base types and config](https://github.com/dhustkoder/sdl2/blob/master/include/SDL_stdinc.h): `include/SDL_stdinc.h`

### Platform interfaces

- [Platform configuration](https://github.com/dhustkoder/sdl2/blob/master/include/SDL_platform.h): `include/SDL_platform.h`

### Other components

- **SDL application**
- **Multimedia hardware**

## Connections

- SDL application → Video and windows: uses API
- SDL application → 2D rendering: uses API
- SDL application → Audio devices: uses API
- SDL application → Keyboard input: uses API
- SDL application → Mouse input: uses API
- SDL application → Joystick input: uses API
- Video and windows → Multimedia hardware: accesses graphics
- Audio devices → Multimedia hardware: accesses audio
- Keyboard input → Multimedia hardware: accesses input
- Mouse input → Multimedia hardware: accesses input
- Joystick input → Multimedia hardware: accesses input
- 2D rendering → Video and windows: uses types (evidence: `include/SDL_render.h`)
- 2D rendering → Surfaces and pixels: uses rectangles (evidence: `include/SDL_render.h`)
- Surfaces and pixels → Data streams: loads from (evidence: `include/SDL_surface.h`)
- Game controllers → Joystick input: maps controls (evidence: `include/SDL_gamecontroller.h`)
- Event queue API → Video and windows: uses types (evidence: `include/SDL_events.h`)
- Event queue API → Keyboard input: uses types (evidence: `include/SDL_events.h`)
- Event queue API → Mouse input: uses types (evidence: `include/SDL_events.h`)
- Event queue API → Joystick input: uses types (evidence: `include/SDL_events.h`)
- Event queue API → Game controllers: uses types (evidence: `include/SDL_events.h`)
- Event queue API → Touch input: uses types (evidence: `include/SDL_events.h`)
- Audio devices → Data streams: uses streams (evidence: `include/SDL_audio.h`)
- Audio devices → Threads and mutexes: uses synchronization (evidence: `include/SDL_audio.h`)
- Threads and mutexes → Base types and config: uses base types (evidence: `include/SDL_thread.h`)
- Base types and config → Platform configuration: includes config (evidence: `include/SDL_stdinc.h`)
- Video and windows → OpenGL interfaces: exposes GL support (evidence: `include/SDL_video.h`)
