# revmischa/sdl3-rs architecture

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

- Interactive diagram: https://gitdiagram.com/revmischa/sdl3-rs
- Repository: https://github.com/revmischa/sdl3-rs

## Overview

##### Key Components

a) SDL3 Rust Bindings Core Modules (Group these in a central component):
- Video/Graphics System
- Audio System
- Input Systems (Keyboard, Mouse, Joystick, GameController)
- Event System
- Window Management
- File System
- Resource Management

b) Extension Modules (Group these in a separate component):
- GFX Module
- Image Module
- TTF Module
- Mixer Module

##### Integration Points

a) External Dependencies:
- System SDL3 Library
- pkg-config integration
- vcpkg integration
- Build from source system

b) Platform-Specific Components:
- Windows Support
- macOS Support
- Linux Support
- iOS/Android Support

##### Specific Implementation Details

a) Application Interface Layer:
- How Rust applications interact with the bindings
- Example integration points (reference the examples/ directory)

b) Binding Layer (Core):
- src/sdl3/
- video.rs
- audio.rs
- event.rs
- other core modules

c) Extension Modules:
- src/sdl3/
- gfx/
- image/
- ttf/
- mixer/

##### Important Relationships to Highlight

- Relationship between high-level Rust interfaces and low-level SDL3 bindings
- Build configuration options (static/dynamic linking)
- Demonstrate the event flow from SDL3 through the bindings to the Rust application
- Resource management and lifecycle

## Diagram (Mermaid)

```mermaid
graph TB
    %% Main Layers
    subgraph RustApp["Rust Application Layer"]
        APP[Application Code]
        EX[Examples]
        TEST[Test Suite]
    end

    subgraph BindingsLayer["SDL3 Rust Bindings Layer"]
        subgraph CoreModules["Core SDL3 Modules"]
            VIDEO["Video/Graphics System"]:::core
            AUDIO["Audio System"]:::core
            EVENT["Event System"]:::core
            
            subgraph InputSystems["Input Systems"]
                KB["Keyboard"]:::core
                MOUSE["Mouse"]:::core
                JOY["Joystick"]:::core
                GPAD["GameController"]:::core
            end
            
            FS["File System"]:::core
            WIN["Window Management"]:::core
            RES["Resource Management"]:::core
        end

        subgraph ExtModules["Extension Modules"]
            GFX["GFX Module"]:::ext
            IMG["Image Module"]:::ext
            TTF["TTF Module"]:::ext
            MIX["Mixer Module"]:::ext
        end

        BUILD["Build System"]:::build
        CORE["Core Library Entry"]:::core
    end

    subgraph NativeLayer["Native SDL3 Layer"]
        SDL3["System SDL3 Library"]:::native
        
        subgraph PlatformSupport["Platform Support"]
            WIN_P["Windows"]:::platform
            MAC["macOS"]:::platform
            LIN["Linux"]:::platform
            MOB["iOS/Android"]:::platform
        end

        subgraph BuildSys["Build Systems"]
            PKG["pkg-config"]:::build
            VCPKG["vcpkg"]:::build
            SRC["Build from Source"]:::build
        end
    end

    %% Relationships
    APP --> EX
    APP --> TEST
    APP --> CoreModules
    APP --> ExtModules

    CoreModules --> CORE
    ExtModules --> CORE
    CORE --> SDL3

    SDL3 --> PlatformSupport
    SDL3 --> BuildSys

    BUILD --> PKG
    BUILD --> VCPKG
    BUILD --> SRC

    %% Styling
    classDef core fill:#a8d1f0
    classDef ext fill:#90EE90
    classDef build fill:#FFE5B4
    classDef platform fill:#D3D3D3
    classDef native fill:#FFB6C1

    %% Click Events
    click VIDEO "https://github.com/revmischa/sdl3-rs/blob/master/src/sdl3/video.rs"
    click AUDIO "https://github.com/revmischa/sdl3-rs/blob/master/src/sdl3/audio.rs"
    click EVENT "https://github.com/revmischa/sdl3-rs/blob/master/src/sdl3/event.rs"
    click KB "https://github.com/revmischa/sdl3-rs/tree/master/src/sdl3/keyboard/"
    click MOUSE "https://github.com/revmischa/sdl3-rs/tree/master/src/sdl3/mouse/"
    click JOY "https://github.com/revmischa/sdl3-rs/blob/master/src/sdl3/joystick.rs"
    click GPAD "https://github.com/revmischa/sdl3-rs/blob/master/src/sdl3/gamepad.rs"
    click FS "https://github.com/revmischa/sdl3-rs/blob/master/src/sdl3/filesystem.rs"
    click WIN "https://github.com/revmischa/sdl3-rs/blob/master/src/sdl3/raw_window_handle.rs"
    click RES "https://github.com/revmischa/sdl3-rs/blob/master/src/sdl3/properties.rs"
    click GFX "https://github.com/revmischa/sdl3-rs/tree/master/src/sdl3/gfx/"
    click IMG "https://github.com/revmischa/sdl3-rs/tree/master/src/sdl3/image/"
    click TTF "https://github.com/revmischa/sdl3-rs/tree/master/src/sdl3/ttf/"
    click MIX "https://github.com/revmischa/sdl3-rs/tree/master/src/sdl3/mixer/"
    click BUILD "https://github.com/revmischa/sdl3-rs/blob/master/build.rs"
    click TEST "https://github.com/revmischa/sdl3-rs/tree/master/tests/"
    click EX "https://github.com/revmischa/sdl3-rs/tree/master/examples/"
    click CORE "https://github.com/revmischa/sdl3-rs/blob/master/src/sdl3/lib.rs"
```
