# dhnguyencs/sdl_graphicsengine architecture

> Architecture diagram of the GitHub repository dhnguyencs/sdl_graphicsengine, 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/dhnguyencs/sdl_graphicsengine
- Repository: https://github.com/dhnguyencs/sdl_graphicsengine

## Overview

This tree is primarily the SDL 2 public API headers, with a custom graphics-engine header and a C++ entry point. The visible workflow is an application entry point that includes the graphics engine; the excerpts do not show how it produces a rendered result. The SDL headers describe capabilities including windowing, rendering, input, audio, and shared utilities, but most are declarations rather than implementations. Edges below reflect only shown imports or documented API relationships; the custom engine’s internals and runtime behavior are not evidenced here.

Main entry points: [`include/SDL.h`](https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL.h) (SDL API umbrella), [`include/SDL_events.h`](https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_events.h) (Event queue), [`include/SDL_video.h`](https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_video.h) (Video and windows), [`include/SDL_gamecontroller.h`](https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_gamecontroller.h) (Game controllers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_main["Application entry<br/>[main.cpp]"]
  node_engine["Graphics engine"]
end

subgraph group_graphics["Graphics and media"]
  node_video["Video and windows<br/>[SDL_video.h]"]
  node_render["2D rendering<br/>[SDL_render.h]"]
  node_surface["Pixel surfaces<br/>[SDL_surface.h]"]
  node_pixels["Pixel formats<br/>[SDL_pixels.h]"]
  node_audio["Audio devices<br/>[SDL_audio.h]"]
  node_ttf["SDL_ttf implementation<br/>[SDL_ttf.c]"]
  node_ttfapi["SDL_ttf API<br/>[SDL_ttf.h]"]
end

subgraph group_input["Input and events"]
  node_events["Event queue<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"]
end

subgraph group_core["SDL shared API"]
  node_sdlumbrella["SDL API umbrella<br/>[SDL.h]"]
  node_rwops["Data streams<br/>[SDL_rwops.h]"]
  node_stdinc["Types and utilities<br/>[SDL_stdinc.h]"]
  node_thread["Threading<br/>[SDL_thread.h]"]
  node_atomic["Atomic operations<br/>[SDL_atomic.h]"]
end

node_main -->|"includes"| node_engine
node_sdlumbrella -->|"includes"| node_video
node_sdlumbrella -->|"includes"| node_render
node_sdlumbrella -->|"includes"| node_audio
node_sdlumbrella -->|"includes"| node_events
node_sdlumbrella -->|"includes"| node_keyboard
node_sdlumbrella -->|"includes"| node_mouse
node_sdlumbrella -->|"includes"| node_joystick
node_sdlumbrella -->|"includes"| node_controller
node_sdlumbrella -->|"includes"| node_rwops
node_sdlumbrella -->|"includes"| node_stdinc
node_render -->|"uses window API"| node_video
node_video -->|"uses surfaces"| node_surface
node_surface -->|"uses formats"| node_pixels
node_events -->|"defines input events"| node_keyboard
node_events -->|"defines input events"| node_mouse
node_events -->|"defines device events"| node_joystick
node_events -->|"defines controller events"| node_controller
node_controller -->|"exposes joystick"| node_joystick
node_thread -->|"uses atomics"| node_atomic
node_ttf -->|"implements API"| node_ttfapi
node_ttf -->|"imports SDL API"| node_sdlumbrella
node_ttfapi -->|"includes SDL API"| node_sdlumbrella

click node_main "https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/main.cpp"
click node_engine "https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/SDL_GraphicsEngine.h"
click node_sdlumbrella "https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL.h"
click node_video "https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_video.h"
click node_render "https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_render.h"
click node_surface "https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_surface.h"
click node_pixels "https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_pixels.h"
click node_audio "https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_audio.h"
click node_events "https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_events.h"
click node_keyboard "https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_keyboard.h"
click node_mouse "https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_mouse.h"
click node_joystick "https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_joystick.h"
click node_controller "https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_gamecontroller.h"
click node_rwops "https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_rwops.h"
click node_stdinc "https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_stdinc.h"
click node_thread "https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_thread.h"
click node_atomic "https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_atomic.h"
click node_ttf "https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_ttf.c"
click node_ttfapi "https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_ttf.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_main,node_engine toneBlue
class node_video,node_render,node_surface,node_pixels,node_audio,node_ttf,node_ttfapi toneAmber
class node_events,node_keyboard,node_mouse,node_joystick,node_controller toneMint
class node_sdlumbrella,node_rwops,node_stdinc,node_thread,node_atomic toneRose
```

## Components

### Application

- [Application entry](https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/main.cpp): `main.cpp`
- [Graphics engine](https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/SDL_GraphicsEngine.h): `SDL_GraphicsEngine.h`

### Graphics and media

- [Video and windows](https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_video.h): `include/SDL_video.h`
- [2D rendering](https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_render.h): `include/SDL_render.h`
- [Pixel surfaces](https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_surface.h): `include/SDL_surface.h`
- [Pixel formats](https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_pixels.h): `include/SDL_pixels.h`
- [Audio devices](https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_audio.h): `include/SDL_audio.h`
- [SDL_ttf implementation](https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_ttf.c): `include/SDL_ttf.c`
- [SDL_ttf API](https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_ttf.h): `include/SDL_ttf.h`

### Input and events

- [Event queue](https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_events.h): `include/SDL_events.h`
- [Keyboard input](https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_keyboard.h): `include/SDL_keyboard.h`
- [Mouse input](https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_mouse.h): `include/SDL_mouse.h`
- [Joystick input](https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_joystick.h): `include/SDL_joystick.h`
- [Game controllers](https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_gamecontroller.h): `include/SDL_gamecontroller.h`

### SDL shared API

- [SDL API umbrella](https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL.h): `include/SDL.h`
- [Data streams](https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_rwops.h): `include/SDL_rwops.h`
- [Types and utilities](https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_stdinc.h): `include/SDL_stdinc.h`
- [Threading](https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_thread.h): `include/SDL_thread.h`
- [Atomic operations](https://github.com/dhnguyencs/sdl_graphicsengine/blob/main/include/SDL_atomic.h): `include/SDL_atomic.h`

## Connections

- Application entry → Graphics engine: includes (evidence: `main.cpp`)
- SDL API umbrella → Video and windows: includes (evidence: `include/SDL.h`)
- SDL API umbrella → 2D rendering: includes (evidence: `include/SDL.h`)
- SDL API umbrella → Audio devices: includes (evidence: `include/SDL.h`)
- SDL API umbrella → Event queue: includes (evidence: `include/SDL.h`)
- SDL API umbrella → Keyboard input: includes (evidence: `include/SDL.h`)
- SDL API umbrella → Mouse input: includes (evidence: `include/SDL.h`)
- SDL API umbrella → Joystick input: includes (evidence: `include/SDL.h`)
- SDL API umbrella → Game controllers: includes (evidence: `include/SDL.h`)
- SDL API umbrella → Data streams: includes (evidence: `include/SDL.h`)
- SDL API umbrella → Types and utilities: includes (evidence: `include/SDL.h`)
- 2D rendering → Video and windows: uses window API (evidence: `include/SDL_render.h`)
- Video and windows → Pixel surfaces: uses surfaces (evidence: `include/SDL_video.h`)
- Pixel surfaces → Pixel formats: uses formats (evidence: `include/SDL_surface.h`)
- Event queue → Keyboard input: defines input events (evidence: `include/SDL_events.h`)
- Event queue → Mouse input: defines input events (evidence: `include/SDL_events.h`)
- Event queue → Joystick input: defines device events (evidence: `include/SDL_events.h`)
- Event queue → Game controllers: defines controller events (evidence: `include/SDL_events.h`)
- Game controllers → Joystick input: exposes joystick (evidence: `include/SDL_gamecontroller.h`)
- Threading → Atomic operations: uses atomics (evidence: `include/SDL_thread.h`)
- SDL_ttf implementation → SDL_ttf API: implements API (evidence: `include/SDL_ttf.c`)
- SDL_ttf implementation → SDL API umbrella: imports SDL API (evidence: `include/SDL_ttf.c`)
- SDL_ttf API → SDL API umbrella: includes SDL API (evidence: `include/SDL_ttf.h`)
