Skip to content

klukaszek/sdl3-hs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

116 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SDL3 Haskell Bindings λ

Haskell bindings for SDL3.

Project Status

  • Targets SDL3 3.4.0 headers.
  • Includes 59 runnable examples (via Cabal examples flag).
  • 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-hs

If you already cloned without submodules:

git submodule update --init --recursive

2) 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 Windows

On 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 sdl3

Examples

Build all examples:

cabal build -fexamples

List example executables:

cabal run -fexamples

Run a specific example:

cabal run -fexamples init

Build Flags

  • examples: builds all example executables (cabal build -fexamples)
  • static-linking: static SDL linking where supported (cabal build -fstatic-linking)
  • pkgconfig (default on): use pkg-config for 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.sh

Working 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

Input & Interaction

User Input

User Interface

Audio & Media

Audio

  • Audio - Audio playback
  • WAV - WAV file handling

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

  • Time - Time functions
  • Timer - Timer functionality

Process

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/SDL3 against headers in SDL3/include/SDL3.
  • Missing function details are written by binding-checker to broken/.

About

Haskell bindings for the SDL3 library.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •