SDL3 Haskell Bindings λ
Haskell bindings for SDL3.
Project Status
- Targets SDL3
3.4.0headers. - Includes
59runnable examples (via Cabalexamplesflag). - Binding status is auto-generated in this README.
Quick Start
1) Clone
git clone --recurse-submodules https://github.com/klukaszek/sdl3-hs.git
cd sdl3-hsIf you already cloned without submodules:
git submodule update --init --recursive2) Install SDL3 (if needed)
If your system already provides SDL3 development files, use that.
Otherwise build from the bundled SDL3/ submodule:
cd SDL3
mkdir -p build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -GNinja ..
cmake --build . --config Release --parallel
sudo cmake --install . --config Release # omit sudo on WindowsOn Windows, ensure SDL3.dll is available in
PATH (or next to your exe). If pkg-config
cannot find SDL3, set:
set PKG_CONFIG_PATH=path\to\SDL3\lib\pkgconfig
# or
$env:PKG_CONFIG_PATH="path\to\SDL3\lib\pkgconfig"3) Build
cabal build sdl3Examples
Build all examples:
cabal build -fexamplesList example executables:
cabal run -fexamplesRun a specific example:
cabal run -fexamples initBuild Flags
examples: builds all example executables (cabal build -fexamples)static-linking: static SDL linking where supported (cabal build -fstatic-linking)pkgconfig(default on): usepkg-configfor SDL3 discovery
Static linking is not supported on macOS. See
DISTRIBUTION.md for full distribution guidance and platform
details.
Refresh the generated binding-status block in this README:
./.github/update-readme.shWorking Examples
All current examples are listed below (59 total), and
each one maps to a buildable executable in sdl3.cabal.
Core Functionality
Initialization & System
- Init - Basic SDL initialization
- System - System information and capabilities
- Platform - Platform-specific functionality
- CPU Info - Processor information
- Power - Power state monitoring
- Hints - SDL configuration hints
Window & Rendering
Rendering
- Render - 2D rendering basics
Misc
- Rect - Rectangle basics (no rendering here)
GPU & Graphics
These examples are based off of the original SDL3 GPU Examples
- GPU Triangle - Raw triangle rendering
- GPU Clear - Basic screen clearing
- GPU
Vertex Buffer - Vertex buffer usage (matches
gpu-vbuf) - GPU Textured Quad - Texture mapping
- GPU Custom Sampling - Implementing custom texture sampling logic
- GPU Animated Quad - Animation basics
- GPU Instanced - Instanced rendering
- GPU Stencil - Stencil buffer operations
- GPU Cull - Culling techniques
- GPU Multi-Window - Multiple window rendering
- GPU Draw Indirect - Leveraging indirect draw commands for GPU-driven rendering
- GPU Basic Compute - Basic compute shader usage
- GPU Clear 3D Slice - Clearing a slice of a 3D texture
- GPU Compute Uniforms - Using uniforms with compute shaders
- GPU Compute Sampler - Using samplers within compute shaders
- GPU Compute Tonemapping - Using compute pipelines for HDRI texture tonemapping.
- GPU Copy Consistency - Copy a texture to the GPU, alter it, and draw it to the framebuffer.
- GPU Copy & Readback - Write texture to GPU and read it back, verifying data integrity.
- GPU Texture 2D Array - Rendering with 2D texture arrays
- GPU Texture Type Test - Testing various texture types and formats
- GPU Compressed Textures - BCn and ASTC texture loading
- GPU Generate Mipmaps - On-the-fly mipmap generation
- GPU Blit 2D Array - Blitting 2D texture array layers
- GPU Blit Cube - Blitting cubemap faces
- GPU Blit Mirror - Mirroring blit operations
- GPU Latency - Measuring and managing input-to-display latency
- GPU Window Resize - Efficiently handling window resizing with GPU resources
- GPU Triangle MSAA - Multi-sample anti-aliasing basics
- GPU Cubemap - Cubemap rendering and skybox
- GPU Depth Sampler - Depth buffer sampling and post-processing
- GPU Compute Sprite Batch - GPU-driven sprite batching with compute
- GPU Pull Sprite Batch - Pull-based vertex shader sprite batching
Input & Interaction
User Input
- Events - Event handling
- Gamepad - Controller input
- Touch Device - Touch input handling
- Haptic - Force feedback
User Interface
- Dialog - Dialog boxes
- Message Box - Simple message dialogs
- Clipboard - Clipboard manipulation
- Tray - System tray integration
Audio & Media
Audio
Camera
- Camera - Camera device access (tested on macOS)
System Integration
File & Data
- Filesystem - File system operations
- Storage - Persistent storage
- GUID - Globally unique identifier handling
Internationalization
- Locale - Localization support
Time & Process Management
Time
Process
- Process - Process management
Sensors
Hardware
- Sensor - Hardware sensor access
Note: touch/haptic/sensor examples are harder to validate in CI and may need real hardware for full runtime verification.
Binding Status
Summary
- Total Modules: 55
- Modules with Bindings: 55
- Complete Bindings: 55
- Missing Functions: 0
- Completion Rate: 100%
Non-complete Modules
- None
Notes
- Generated from
src/SDL3against headers inSDL3/include/SDL3. - Missing function details are written by
binding-checkertobroken/.