This is the most basic SDL2 example. It only requires the base SDL2 library and initializes an empty window with a basic event loop.
This is a simple SDL2 Audio example. It loads in a small .wav
file which can be controlled using some basic keyboard events. Press Up or Down to controller volume and Left or Right to seek forward or backwards in the track. It will automatically loop.
This is a basic demo of the GameController & Joystick functionality. This requires a game controller (e.g. XBox or Switch controller) to be plugged into the computer. The terminal will update to show the on-going input activity for the controller.
This example shows off loading a simple .bmp
and using the renderer to display a background behind it.
This is a basic demo of the linking OpenGL to the GFX Window to render 2D/3D. This requires the OpenGL library to be available on the system.
This demo showcases the SDL Image library by loading in a .jpg
background and the V and SDL logos in a .png
format. This requires the runtime libraries included with SDL Image to run.
On Linux it may be necessary to install the image development libraries to compile:
Ubuntu 14.04+
sudo apt install libjpeg-dev libpng-dev libtiff-dev libwebp-dev
This basic demo showcases the Mixer extension by loading in a couple of .mid
files to play. Use the 1
and 2
keys to switch between music as well as the up
and down
keys to control volume.
On Linux it may be necessary to install the mixer development libraries to compile:
Ubuntu 14.04+
sudo apt install libsdl2-mixer-dev libflac-dev libogg-dev libmpg123-dev libmodplug-dev libopus-dev libopusfile-dev libvorbis-dev
This showcases a very simple example of the Messagebox popups.
This example makes a few basic calls to platform-agnostic functions to get details about the current system.
This demo showcase the SDL TTF library by loading in two different .ttf
files in different sizes and styles.