SDL Resources

This page brings all our SDL content together. Easily browse through structured courses or standalone lessons.

Complete Courses

We've created a complete SDL courses for structured learning, which provides a clear and complete learning path.

Intermediate Course

Game Development with SDL2
Learn C++ and SDL development by creating hands on, practical projects inspired by classic retro games
Progress0 of 129 Completed
Updated
View

First Lesson

No upcoming lessons available.

Get Started

Full Lesson List

Here's a full list of all our lessons. New content is added often and we make regular improvements and updates to existing lessons.

This Week

Content added or updated in the last 7 days

Game Development with SDL2

Odds and Ends: 10 Useful Techniques

A quick tour of ten useful techniques in C++, covering dates, randomness, attributes and more

• Updated
View
Game Development with SDL2

Creating a Window

Learn how to create and customize windows, covering initialization, window management, and rendering

• Updated
View
Game Development with SDL2

Implementing an Application Loop

Step-by-step guide on creating the SDL2 application and event loops for interactive games

• Updated
View
Game Development with SDL2

Cropping and Positioning Images

Learn to precisely control image display using source and destination rectangles.

• Updated
View
Game Development with SDL2

Rendering Text with SDL_ttf

Learn to render and manipulate text in SDL2 applications using the official SDL_ttf extension

• Updated
View
Game Development with SDL2

Rectangles and SDL_Rect

Learn to create, render, and interact with basic rectangles using the SDL_Rect and SDL_Color types.

• Updated
View
Game Development with SDL2

Structuring SDL Programs

Discover how to organize SDL components using manager classes, inheritance, and polymorphism for cleaner code.

• Updated
View
Game Development with SDL2

Creating SDL2 Buttons

Learn to create interactive buttons in SDL2 and manage communication between different UI components.

• Updated
View

This Month

Content added or updated in the last 30 days

Game Development with SDL2

Installing vcpkg on Windows

An introduction to C++ package managers, and a step-by-step guide to installing vcpkg on Windows and Visual Studio.

• Updated
View
Game Development with SDL2

Ticking

Using Tick() functions to update game objects independently of events

• Updated
View

This Year

Content added or updated in the last 12 months

Game Development with SDL2

The SDL Library and Cross-Platform Development

An introduction to the SDL library, the problem it solves, and why we're using it to learn C++

• New
View
Game Development with SDL2

Snake Movement and Navigation

Learn how to implement core snake game mechanics including movement, controls, and state management

• Updated
View
Game Development with SDL2

Introduction to SDL_Image

Learn to load, manipulate, and save various image formats using SDL_Image.

• Updated
View
Game Development with SDL2

SDL2 Timers and Callbacks

Learn how to use callbacks with SDL_AddTimer() to provide functions that are executed on time-based intervals

• Updated
View
Game Development with SDL2

Creating Custom Events

Learn how to create and manage your own game-specific events using SDL's event system.

• Updated
View
Game Development with SDL2

Ending and Restarting Games

Implement win/loss detection and add a restart feature to complete the game loop

• Updated
View
Game Development with SDL2

Placing Flags

Implement flag placement and tracking to complete your Minesweeper project.

• Updated
View
Game Development with SDL2

Multiple Windows and Utility Windows

Learn how to manage multiple windows, and practical examples using utility windows.

• Updated
View
Game Development with SDL2

Positioning and Rendering Entities

Updating our TransformComponent and ImageComponent to support positioning and rendering

• Updated
View
Game Development with SDL2

Creating a Physics Component

Integrate basic physics simulation into entities using a dedicated component

• Updated
View
Game Development with SDL2

Creating a Collision Component

Enable entities to detect collisions using bounding boxes managed by a dedicated component.

• Updated
View
Game Development with SDL2

Collision Response

Make entities react realistically to collisions, stopping, bouncing, and interacting based on type.

• Updated
View
Game Development with SDL2

Breakout: Project Setup

Begin building a Breakout clone by integrating our level editor and engine into a new game project.

• New
View
Game Development with SDL2

Breakout: The Ball

This lesson focuses on creating the Ball class, customizing our physics engine, and launching the ball.

• New
View
Game Development with SDL2

Breakout: Walls and Collision

We'll add invisible walls around the play area and write the collision response code to make the ball bounce.

• New
View
Game Development with SDL2

Breakout: The Player Paddle

We'll build the player's paddle, hook it up to keyboard controls, and keep it from moving off-screen.

• New
View
Game Development with SDL2

Breakout: Improving Paddle Physics

We'll add detailed collision logic to the paddle, giving the player control over the ball's trajectory.

• New
View
Game Development with SDL2

Breakout: Loading Levels

Add breakable bricks to the game by loading and parsing level files saved from our level editor.

• New
View
Game Development with SDL2

Breakout: Game Progression

Implement the core gameplay loop of destroying blocks and advancing through levels using SDL events.

• New
View
Game Development with SDL2

Breakout: Final Touches

Learn to manage game states for winning, losing, and pausing, and prepare the final game for distribution.

• New
View
Game Development with SDL2

Type Objects

Learn to create flexible game entities using the Type Object pattern for data-driven design.

• Updated
View
Game Development with SDL2

Types From Data Files

Learn to load game object types and instances from external text files

• Updated
View
Game Development with SDL2

Level Editor Starting Point

Establish the core structure for our level editor, including window, scene, and asset management.

• New
View
Game Development with SDL2

Building the Actor Menu

This lesson focuses on creating the UI panel for Actors and adding the first concrete Actor type.

• New
View
Game Development with SDL2

Click and Drag Actors

Implement clicking and dragging actors from the menu, showing a tooltip that follows the mouse cursor.

• New
View
Game Development with SDL2

Placing Actors in the Level

Build the level container, add logic for placing actors via drag-and-drop, including visual hints.

• New
View
Game Development with SDL2

Moving, Selecting, and Deleting Actors

Add core interactions: drag actors to reposition them, click to select, and press delete to remove them.

• New
View
Game Development with SDL2

Grid-Based Placement

Convert the freeform placement to a grid-based system with snapping and single-actor cell limits

• New
View
Game Development with SDL2

Saving Your Editor Levels

Implement footer buttons and binary serialization to save and load your custom game levels to disk.

• New
View
Game Development with SDL2

Loading Saved Levels

Complete the save/load cycle by implementing level deserialization using SDL_RWops and actor factories.

• New
View
Game Development with SDL2

Implementing a Component System

Create the C++ framework for adding, retrieving, and removing components from game entities.

• Updated
View
Game Development with SDL2

Mouse Input Basics

Discover how to process mouse input, including position tracking and button presses

• Updated
View
Game Development with SDL2

Setting up SDL2 in Windows (Visual Studio)

A step-by-step tutorial on configuring SDL2, SDL_image and SDL_ttf in a Visual Studio C++ project on Windows

• Updated
View
Game Development with SDL2

Setting up SDL2 in macOS (Xcode or CMake)

This step-by-step guide shows you how to set up SDL2 in an Xcode or CMake project on macOS

• Updated
View
Game Development with SDL2

Building SDL2 from a Subdirectory (CMake)

A step-by-step guide on setting up SDL2 and useful extensions in a project that uses CMake as its build system

• Updated
View
Game Development with SDL2

Building SDL2 from Source (GCC and Make)

This guide walks you through the process of compiling SDL2, SDL_image, and SDL_ttf libraries from source

• Updated
View
Game Development with SDL2

SDL Surfaces and Colors

Explore SDL surfaces, the canvases for drawing, understand pixel formats, colors, and set your window's background.

• New
View
Game Development with SDL2

Detecting and Managing Errors

Discover techniques for detecting and responding to SDL runtime errors

• Updated
View
Game Development with SDL2

Double Buffering

Learn the essentials of double buffering in C++ with practical examples and SDL2 specifics to improve your graphics projects

• Updated
View
Game Development with SDL2

Understanding Screen & World Space

Learn to implement coordinate space conversions in C++ to position game objects correctly on screen.

• Updated
View
Game Development with SDL2

Discrete and Continuous Values

Learn how to handle floating point precision issues when programming game physics and transformations between coordinate spaces.

• Updated
View
Game Development with SDL2

Cameras and View Space

Create camera systems that follow characters, respond to player input, and properly frame your game scenes.

• Updated
View
Game Development with SDL2

Creating an Input Component

Implement player controls and AI actions cleanly using the Command pattern

• Updated
View
Game Development with SDL2

Building with Components

Learn how composition helps build complex objects by combining smaller components

• Updated
View
Game Development with SDL2

Entity and Component Interaction

Explore component communication, dependency management, and specialized entity types within your ECS

• Updated
View
Game Development with SDL2

Creating an Image Component

Display graphics by creating an ImageComponent that loads files and renders them via SDL_image.

• Updated
View
Game Development with SDL2

Asset Management

Optimize image loading using shared pointers and an asset manager for better memory use and simpler code.

• New
View
Game Development with SDL2

Image and Entity Scaling

Add width, height, and scaling modes to our entities and images

• Updated
View
Game Development with SDL2

Bounding Boxes

Discover bounding boxes: what they are, why we use them, and how to create them

• New
View
Game Development with SDL2

Intersections and Relevancy Tests

Optimize games by checking object intersections with functions like SDL_HasIntersection().

• New
View
Game Development with SDL2

Handling Object Collisions

Implement bounding box collision detection and response between game objects

• New
View
Game Development with SDL2

Introduction to Functions

Learn the basics of writing and using functions in C++, including syntax, parameters, return types, and scope rules.

• Updated
View
Game Development with SDL2

Namespaces, Includes, and the Standard Library

A quick introduction to namespaces in C++, alongside the standard library and how we can access it

• Updated
View
Game Development with SDL2

Conditionals and Loops

Learn the fundamentals of controlling program flow in C++ using if statements, for loops, while loops, continue, and break

• Updated
View
Game Development with SDL2

Classes, Structs and Enums

A crash tour on how we can create custom types in C++ using classes, structs and enums

• Updated
View
Game Development with SDL2

Preprocessor Directives and the Build Process

Learn the fundamentals of the C++ build process, including the roles of the preprocessor, compiler, and linker.

• Updated
View
Game Development with SDL2

Understanding Reference and Pointer Types

Learn the fundamentals of references, pointers, and the const keyword in C++ programming.

• Updated
View
Game Development with SDL2

Operator Overloading

Discover operator overloading, allowing us to define custom behavior for operators when used with our custom types

• Updated
View
Game Development with SDL2

Run-time Polymorphism

Learn how to write flexible and extensible C++ code using polymorphism, virtual functions, and dynamic casting

• Updated
View
Game Development with SDL2

Building a 2D Vector Type

Learn the foundations of vector math to work with positions and movements, and create a custom type to apply these concepts

• Updated
View
Game Development with SDL2

Physical Motion

Create realistic object movement by applying fundamental physics concepts

• New
View
Game Development with SDL2

Force, Drag, and Friction

Learn how to implement realistic forces like gravity, friction, and drag in our physics simulations

• New
View
Game Development with SDL2

Momentum and Impulse Forces

Add explosions and jumping to your game by mastering momentum-based impulse forces

• New
View
Game Development with SDL2

Variables, Types and Operators

Learn the fundamentals of C++ programming: declaring variables, using built-in data types, and performing operations with operators

• Updated
View
Game Development with SDL2

Brightness and Gamma

Learn how to control display brightness and gamma correction using SDL's window management functions

• Updated
View
Game Development with SDL2

Scene Rendering

Create a scene management system that converts world space coordinates to screen space for 2D games.

• New
View
Game Development with SDL2

Moving Objects with Vectors

Explore how to use vectors for representing positions, directions, and implementing speed-limited movement in games.

• Updated
View
Game Development with SDL2

Numeric and Binary Data

Learn how C++ represents numbers and data in memory using binary, decimal, and hexadecimal systems.

• Updated
View
Game Development with SDL2

Exponents and cmath

Understand the math foundations needed for game programming in C++, including power and root functions.

• Updated
View
Game Development with SDL2

Spaces, Vectors and Coordinates

Learn the fundamentals of coordinate systems and vectors to create spatial representations

• Updated
View
Game Development with SDL2

Angles and Distance

Learn key geometry concepts like angles, triangles, and vectors to implement distance calculations.

• Updated
View
Game Development with SDL2

Snake Game Core Components

Introducing the foundational components for our game and setting up the project

• New
View
Game Development with SDL2

Building the Snake Grid

Build the foundational grid structure that will power our Snake game's movement and collision systems.

• New
View
Game Development with SDL2

Snake Growth

Allowing our snake to eat apples, and grow longer each time it does

• New
View
Game Development with SDL2

Pausing and Restarting

Giving our Snake game the ability to pause itself, and adding a clickable button for restarting the game

• New
View
Game Development with SDL2

Win/Loss Logic for Snake

Add game-ending logic to our Snake game with custom events, state management, and visual cues for player feedback.

• New
View
Game Development with SDL2

Building the Score Display

Build a dynamic score counter that tracks the player's progress and displays it with custom graphics and text.

• New
View
Game Development with SDL2

Animating Snake Movement

Learn to animate the snake's movement across cells for a smooth, dynamic visual effect.

• New
View
Game Development with SDL2

Customising Mouse Cursors

Learn how to control cursor visibility, switch between default system cursors, and create custom cursors

• New
View
Game Development with SDL2

Parsing Data using std::string

Learn how to read, parse, and use config files in your game using std::string and SDL_RWops

• New
View
Game Development with SDL2

Writing Data to Files

Learn to write and append data to files using SDL2's I/O functions.

• Updated
View
Game Development with SDL2

Read/Write Offsets and Seeking

Learn how to manipulate the read/write offset of an SDL_RWops object to control stream interactions.

• New
View
Game Development with SDL2

Mouse Capture and Global Mouse State

Learn how to track mouse movements and button states across your entire application, even when the mouse leaves your window.

• Updated
View
Game Development with SDL2

Working with Data

Learn techniques for managing game data, including save systems, configuration, and networked multiplayer.

• New
View
Game Development with SDL2

Byte Order and Endianness

Learn how to handle byte order in using SDL's endianness functions

• New
View
Game Development with SDL2

Padding and Alignment

Learn how memory alignment affects data serialization and how to handle it safely

• New
View
Game Development with SDL2

Fullscreen Windows

Learn how to create and manage fullscreen windows in SDL, including desktop and exclusive fullscreen modes.

• New
View
Game Development with SDL2

Display Modes

Learn how to manage screen resolutions and refresh rates in SDL games using display modes.

• New
View
Game Development with SDL2

Pixel Density and High-DPI Displays

Learn how to create SDL applications that look great on modern displays across different platforms

• New
View
Game Development with SDL2

Window Decorations and Borders

An introduction to managing SDL2 window decorations, borders, and client areas.

• Updated
View
Game Development with SDL2

Window Titles

Learn how to set, get, and update window titles dynamically

• Updated
View
Game Development with SDL2

Window Opacity

Discover how to use SDL2 functions for controlling and retrieving window transparency settings.

• Updated
View
Game Development with SDL2

Video Displays

Learn how to handle multiple monitors in SDL, including creating windows on specific displays.

• New
View
Game Development with SDL2

Window Configuration

Explore window creation, configuration, and event handling using SDL's windowing system

• Updated
View
Game Development with SDL2

Window Events and Window IDs

Discover how to monitor and respond to window state changes in SDL applications

• Updated
View
Game Development with SDL2

Managing Window Position

Learn how to control and monitor the position of SDL windows on screen

• Updated
View
Game Development with SDL2

Window Sizing

Learn how to resize, constrain, and manage SDL2 windows

• Updated
View
Game Development with SDL2

Window Visibility

Learn how to control the visibility of SDL2 windows, including showing, hiding, minimizing, and more

• Updated
View
Game Development with SDL2

Mouse Input Constraints

Implement mouse constraints in SDL2 to control cursor movement using window grabs and rectangular bounds

• Updated
View
Game Development with SDL2

Relative Mouse Mode

Learn how to restrict cursor movement to a window whilst capturing mouse motion continuously.

• Updated
View
Game Development with SDL2

Handling Keyboard Input

Learn how to detect and respond to keyboard input events in your SDL-based applications. This lesson covers key events, key codes, and modifier keys.

• Updated
View
Game Development with SDL2

Managing Window Input Focus

Learn how to manage and control window input focus in SDL applications, including how to create, detect, and manipulate window focus states.

• Updated
View
Game Development with SDL2

Understanding Keyboard State

Learn how to detect and handle keyboard input in SDL2 using both event-driven and polling methods. This lesson covers obtaining and interpreting the keyboard state array.

• Updated
View
Game Development with SDL2

Handling Mouse Scrolling

Learn how to detect and handle mouse scroll wheel events in SDL2, including vertical and horizontal scrolling, as well as scroll wheel button events.

• Updated
View
Game Development with SDL2

Managing Mouse Focus with SDL2

Learn how to track and respond to mouse focus events in SDL2, including handling multiple windows and customizing focus-related click behavior.

• Updated
View
Game Development with SDL2

Mouse State

Learn how to monitor mouse position and button states in real-time using SDL's state query functions

• Updated
View
Game Development with SDL2

Delegates and the Observer Pattern

An overview of the options we have for building flexible notification systems between game components

• New
View
Game Development with SDL2

Tick Rate and Time Deltas

Learn how to create smooth, time-aware game loops that behave consistently across different hardware configurations

• New
View
Game Development with SDL2

High-Resolution Timers

Learn to measure time intervals with high accuracy in your games

• New
View
Game Development with SDL2

Callbacks and Function Pointers

Learn to create flexible and modular code with function pointers

• New
View
Game Development with SDL2

Member Function Pointers and Binding

Explore advanced techniques for working with class member functions

• New
View

Older

Content added or updated in previous years

Game Development with SDL2

Reading Data from Files

Learn how to read and parse game data stored in external files using SDL_RWops

• New
View
Game Development with SDL2

Engine Overview

An introduction to the generic engine classes we'll use to create the game

• Updated
View
Game Development with SDL2

Loading and Displaying Images

Learn how to load, display, and optimize image rendering in your applications

• Updated
View
Game Development with SDL2

Image Scaling and Aspect Ratios

Learn techniques for scaling images and working with aspect ratios

• Updated
View
Game Development with SDL2

Text Performance, Fitting and Wrapping

Explore advanced techniques for optimizing and controlling text rendering when using SDL_ttf

• Updated
View
Game Development with SDL2

Creating the Grid

Building a two-dimensional grid of interactive minesweeper cells

• New
View
Game Development with SDL2

Adding Bombs to the Grid

Updating the game to to place bombs randomly in the grid and render them when cells are cleared.

• New
View
Game Development with SDL2

Adjacent Cells and Bomb Counting

Implement the techniques for detecting nearby bombs and clearing empty cells automatically.

• New
View