Programming games using SDL 2

pic

Developing video games is not just fun, but it’s a great way to becoming a better programmer. Working on a small project can be an additional motivation for you to keep learning, and improving your skill.

To program a game, you need to get a full access to the screen, the keyboard, the mouse and maybe other devices of your computer. The standard C or C++ don’t provide such a control over your system out of the box. Such system dependent features are usually not a part of the language standard itself, and delegated to graphics libraries, such as SDL, OpenGL, DirectX, or SFML.

Simple DirectMedia Layer (or SDL) is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D. It is used by video playback software, emulators, and popular games including Valve’s award winning catalog and many Humble Bundle games.

Good introduction to using SDL 2 with C++: headerphile blog:

Another good tutorial: LazyFoo’s SDL2 tutorial

A relatively simple shoot em up game

Source code: inv.cpp
To compile: g++ -lSDL2 inv.cpp

shmup