Lazy Foo' Productions

SDL Forums external link SDL Tutorials 🐰SDL3 Tutorials🥚 Articles OpenGL Tutorials OpenGL Forums external link
Follow BlueSky Follow Facebook Follow Twitter Follow Threads
Donate
News FAQs Contact Bugs

Beginning Game Programming v3.0

Last Updated: Nov 26th, 2024

Hey, you're not supposed to be here 😉.

Anyway, you are currently looking at the pre-alpha version of the SDL3 tutorials. This page will become fully public once SDL3 has its first official stable release. For now, updates will be paused until SDL3 has its first official release. If you want more SDL3 code to play around with, check out the SDL3 ports at the bottom of each page of the SDL2 tutorials provided by the creator of SDL Sam Lantinga.

Since SDL3 is not officially released yet, there are changes being made to the final API and that might cause tutorial code to break. Here are the current sha values of the git commits I am using:
  • SDL3 - bbc9c75618fbc60583123e03f31f4e856f2654bf
  • SDL3_image - 0d418a2a2dc562699854d9c2fc264304ec404e2c
  • SDL3_ttf - 582c6957161d6cc4d3b09cae37744bdfe3700368
  • SDL3_mixer - 3a272cdbac0eac4be5cbe3da2ed2a4d3afefcf19

These tutorials were designed for beginner C++ programmers (with some stuff thrown in for the more experienced) who want to move from text based applications to real time games with graphics. By the end of these tutorials, you'll know the basics so you can really start digging into lower level game programming.
Table of Contents
Introduction
A little intro before we start coding.
Hello SDL3
Get started making games with your first SDL3 App.
Textures and Extension Libraries
Load PNGs and render textures.
Key Presses and Key States
Learn how to handle keyboard input.
Color Keying
Give your textures transparent backgrounds.
Sprite Clipping and Stretching
Clip sprites from a sprite sheet and resize them.
Rotation and Flipping
Learn to rotate and flip your images.
Color Modulation and Alpha Blending
Modify your texture colors and make your images transparent with alpha blending.
True Type Fonts
Render True Type fonts with SDL_ttf.
Mouse Events
Learn how to handle mouse input.
Timing
Learn the basics of application time.
Advanced Timers
Make a timer that can start/stop/pause/unpause.
Frame Rate and VSync
Learn how to manage frame rate.
Motion
Learn how to manage frame rate.
Animation
Learn to animate a sprite.
Sound Effects and Music
Play music and sound effects with SDL_mixer.
Collision Detection
Learn how to check collision between collision boxes.
Text Input and Clipboard Handling
Input strings and handle copying and pasting.
Scrolling
Draw levels larger than the screen with a scrolling camera.
State Machines
Manage your game states with state machines.
If you find any bugs or typos in the tutorials please contact me wait until SDL3 is officially released because upstream code is going to be buggier than officially released code.