Skip to content
Tutorial for libSDL2pp, C++11 bindings/wrapper for SDL2
C++ CMake
Branch: master
Clone or download
Latest commit 199b2f8 Jan 9, 2017
Type Name Latest commit message Commit time
Failed to load latest commit information.
SDL2pp @ ef56aff Update to latest version of libSDL2pp Dec 16, 2015
data Add data Mar 20, 2015
screenshots Add README Mar 20, 2015
.travis.yml Add travis config Mar 20, 2015
CMakeLists.txt Add code Mar 20, 2015
COPYING Add code Mar 20, 2015 Update links Dec 16, 2015 Add code Mar 20, 2015 Add code Mar 20, 2015 Add code Mar 20, 2015 Add code Mar 20, 2015 Fix comment, we don't have transparency in lesson05 Jan 9, 2017 Add code Mar 20, 2015 Add code Mar 20, 2015

libSDL2pp tutorial

Build Status


Here's tutorial for libSDL2pp, C++11 bindings/wrapper for SDL2. It covers core functionality of the library, including initialization and window construction, loading image files, sprite and text rendering, animation, and event handling trying to demonstate library features in as little code as possible.


The tutorial is split into lessons, which demonstrate gradual development of a simple application resembling a platformer game.

  • lesson00: SDL library initialization, window creation, image loading and rendering
  • lesson01: picking specific sprite from an image atlas
  • lesson02: main loop, event processing
  • lesson03: timing and animation
  • lesson04: keyboard control
  • lesson05: texture generation
  • lesson06: alpha blending and color modulation
  • lesson07: text rendering

Each lesson adds some lines to the code and, thus, functionality to the application. You can explore these lessons sequentially starting from the first one (in which you might find e.g. git diff helpful to see what was added by the next lesson), or just jump straight to the last one and see all bits at once.


To build executables from these lessons, you need cmake, SDL2, SDL2_image and SDL2_ttf libraries and corresponding development files.

To build the tutorial, run

cmake . && make

which will produce a set of binaries: lesson00 .. lesson07.



Lesson code is licensed under CC0. Bundled data files have separate licenses, see COPYRIGHT files under data/.

You can’t perform that action at this time.