Skip to content

Instantly share code, notes, and snippets.

View icculus's full-sized avatar

Ryan C. Gordon icculus

View GitHub Profile
@icculus
icculus / sdl-gpu-pitch.md
Last active October 20, 2026 14:52
This is the Epic MegaGrant pitch I wrote for the SDL GPU API, in case anyone is interested.

Describe your project:

Simple Directmedia Layer (SDL) is the gold standard for low-level, cross-platform game development. It is an open source library that is used at the layer where one might use DirectX, so it's useful both for from-scratch development and for powering game engines. It provides abstractions for video, audio, input, and various system-provided functionality. In many cases, if you're building a cross-platform game, SDL is extremely good at helping you delete a large number of #ifdefs in your project...and entire directories full of code.

SDL is used in the Steam Client, is crucial to the Linux game development ecosystem, and has been used for various platforms in every generation of the Unreal Engine, idTech, Source Engine, etc.

A game written to use SDL might work with almost no code changes across all major desktop operating systems, mobile phones, web browsers, and even the Raspberry Pi. Nintendo shipped SDL in over 7.5 million NES and SNES Classic devices. There are SDL-based games

@icculus
icculus / sdl3-threadsafety-docs-todo.txt
Last active February 20, 2026 16:27
SDL3 functions that don't currently have `\threadsafety` tags...
SDL_AcquireGPUCommandBuffer
SDL_BeginGPUComputePass
SDL_BeginGPUCopyPass
SDL_BeginGPURenderPass
SDL_BindGPUComputePipeline
SDL_BindGPUComputeSamplers
SDL_BindGPUComputeStorageBuffers
SDL_BindGPUComputeStorageTextures
SDL_BindGPUFragmentSamplers
SDL_BindGPUFragmentStorageBuffers
@icculus
icculus / main.rb
Created March 24, 2020 07:22
Tetris in DragonRuby, code at the end of Part 2
$gtk.reset
class TetrisGame
def initialize args
@args = args
@next_piece = nil
@next_move = 30
@score = 0
@gameover = false
@grid_w = 10
@icculus
icculus / coreaudio-3.1.2-to-main.diff
Created December 27, 2024 21:33
Changes to CoreAudio target between SDL 3.1.2 and main
diff --git a/src/audio/coreaudio/SDL_coreaudio.h b/src/audio/coreaudio/SDL_coreaudio.h
index cd64e3038..e00d835b0 100644
--- a/src/audio/coreaudio/SDL_coreaudio.h
+++ b/src/audio/coreaudio/SDL_coreaudio.h
@@ -60,7 +60,7 @@ struct SDL_PrivateAudioData
#ifdef MACOSX_COREAUDIO
AudioDeviceID deviceID;
#else
- SDL_bool interrupted;
+ bool interrupted;
@icculus
icculus / sdl-wikiheaders-coverage-gaps.txt
Last active December 22, 2024 07:01
Output of wikiheaders.pl --report-coverage-gaps with red herrings like SDL_oldnames.h, SDL_test*, and SDL_opengl*, etc, trimmed out.
Completely done! All public symbols in SDL3 are now documented!
@icculus
icculus / all-sdl3-documented-macros.h
Created December 9, 2024 21:10
All currently-documented SDL3 macros...
#define SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED ... // Specify the behavior of Alt+Tab while the keyboard is grabbed.
#define SDL_HINT_ANDROID_ALLOW_RECREATE_ACTIVITY ... // A variable to control whether the SDL activity is allowed to be re-created.
#define SDL_HINT_ANDROID_BLOCK_ON_PAUSE ... // A variable to control whether the event loop will block itself when the app is paused.
#define SDL_HINT_ANDROID_LOW_LATENCY_AUDIO ... // A variable to control whether low latency audio should be enabled.
#define SDL_HINT_ANDROID_TRAP_BACK_BUTTON ... // A variable to control whether we trap the Android back button to handle it manually.
#define SDL_HINT_APP_ID ... // A variable setting the app ID string.
#define SDL_HINT_APP
@icculus
icculus / sdl3quickref-attempt2.md
Created December 9, 2024 20:08
SDL3 Quick Reference attempt, wikified version

Based on SDL version 3.1.7

(If you'd rather have something you can copy/paste into an IDE, for searching and syntax highlighting, check out QuickReferenceC or QuickReferenceCNoUnicode instead.)

Init

@icculus
icculus / sdl3quickref.md
Created December 9, 2024 00:03
SDL3 Quick Reference test
// SDL3 API Quick Reference
//
// https://libsdl.org/
//
// The latest version of this document can be found at https://wiki.libsdl.org/SDL3/QuickReference
// When this document was written: 2024-12-09 00:00:45 GMT
// Based on SDL version 3.1.7
@icculus
icculus / basicgorillas.rb
Last active October 9, 2024 10:23
DragonRuby Basic Gorillas
# This is the complete source code to Basic Gorillas:
# https://dragonruby.itch.io/basicgorillas
#
# You can tinker with this by getting a copy of DragonRuby Game Toolkit:
# https://dragonruby.org/
#
# Amir Rajan wrote this game, catch him at https://twitter.com/amirrajan !
class YouSoBasicGorillas
attr_accessor :outputs, :grid, :game, :inputs
@icculus
icculus / coreaudio-replug-problem.m
Created August 5, 2024 02:50
Standalone reproduction case for CoreAudio hotplugging issue
// This is only intended for macOS; I cut out the iOS-specific pieces when pulling this code out of SDL for a reproduction case!
// clang -Wall -O0 -ggdb3 -fobjc-arc -o coreaudio-replug-problem coreaudio-replug-problem.m -framework AudioToolbox
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <math.h>
#include <pthread.h>
#include <signal.h>