Publishing excerpts from my 2nd ebook
I’m changing horses in midstream so this won’t appear as it’s been done so far. Rather than let it go to waste, I’ll be publishing it in parts here. My next book will be Learn C Games Programming on the Raspberry Pi.
Installing SDL2 on Ubuntu/Debian
The SDL2 library is an open source library available from the libsdl.org website. However in Ubuntu it’s fairly easy to install. We do need not just the binary files but the headers so we can include them.
On Ubuntu (and Debian system) the apt tool maintains a cache of files. You can search these from a terminal with this command.
apt-cache search libsdl2
On my PC this output.
libsdl2-2.0-0 – Simple DirectMedia Layer
libsdl2-dev – Simple DirectMedia Layer development files
libsdl2-doc – Reference manual for libsdl2
libsdl2-gfx-1.0-0 – drawing and graphical effects extension for SDL2
libsdl2-gfx-dev – development files for SDL2_gfx
libsdl2-gfx-doc – documentation files for SDL2_gfx
libsdl2-image-2.0-0 – Image loading library for Simple DirectMedia Layer 2, libraries
libsdl2-image-dev – Image loading library for Simple DirectMedia Layer 2, development files
libsdl2-mixer-2.0-0 – Mixer library for Simple DirectMedia Layer 2, libraries
libsdl2-mixer-dev – Mixer library for Simple DirectMedia Layer 2, development files
libsdl2-net-2.0-0 – Network library for Simple DirectMedia Layer 2, libraries
libsdl2-net-dev – Network library for Simple DirectMedia Layer 2, development files
libsdl2-ttf-2.0-0 – TrueType Font library for Simple DirectMedia Layer 2, libraries
libsdl2-ttf-dev – TrueType Font library for Simple DirectMedia Layer 2, development files
We’ll eventually need libsdl2, libsdl2-image for graphics support and libsdl2-mixer for sounds. We’ll also need libsdl2-dev so let’s start with that. Run this command . It will probably ask for your password.
sudo apt-get install libsdl2-dev
That downloaded and installed 73 MB of files. More to follow

This was a text mode game, my idea being to do something like the old Star Trek BASIC game but better. I called it Star Empires and it’s on GitHub, just follow the link to GitHub on the C Games sources link.


My Raspberry Pi now has both a 7″ touchscreen and a 24″ monitor working at the same time. Most work is done on the big screen but the smaller display is for testing. I’ve reconfigured it so the menu is on the bigger screen, it makes more sense.
I’m not going to be departing from SDL2 any day soon, but if I were starting from scratch, I would seriously consider
It just shows what you can do in 38,000 lines of code.
There are some subtle differences between it and Visual Studio Code. The main one is the not having access to the VisualStudio market place. The C/C++ template isn’t there but instead is installed by default.
I played with a couple of free packages today. I can recommend hardinfo. (sudo apt install hardinfo to install then hardinfo to run ) though less about the benchmarks than the information it gives on your system.