paulgorman.org/technical

Working with SDL in Go

(August 2019)

The Simple DirectMedia Layer library provides low-level, cross-platform access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D for video playback software, emulators, and games. SDL supports Windows, Mac OS X, Linux, iOS, and Android. Although it’s written in C, SDL bindings exist for many languages, including Go.

On Debian-based Linux distributions, install the necessary dependencies:

# apt install libsdl2{,-image,-mixer,-ttf,-gfx}-dev

Or on Red Hat flavors:

# yum install SDL2{,_image,_mixer,_ttf,_gfx}-devel

Then, get the Go packages:

$ go get -v github.com/veandco/go-sdl2/{sdl,img,mix,ttf}

(See https://github.com/veandco/go-sdl2.)