Lazy Foo' Productions

Beginning Game Programming v2.0

Last Updated: May 28th, 2024

Greetings everyone, welcome to the ground up recoding of Beginning Game Programming with SDL. This time we will be coding with SDL 2 which has been released on the SDL website.

These tutorials were designed for C++ programmers who want to move from text based games to real time games with graphics. By the end of these tutorials, you'll know the basics to make your first real video game!
Table of Contents
Hello SDL
Get started making games with your first SDL App.
Getting an Image on the Screen
Show images on the screen with SDL2.
Event Driven Programming
Handle events with SDL2.
Key Presses
Handle keys with SDL2.
Optimized Surface Loading and Soft Stretching
Optimize your loaded surfaces and stretch them with SDL2.
Extension Libraries and Loading Other Image Formats
Use SDL extension libraries like SDL_image, SDL_ttf, and SDL_mixer to add functionality to SDL.
Texture Loading and Rendering
Render Hardware Accelerated Textures With SDL2.
Geometry Rendering
Render hardware accelerated shapes with SDL2.
The Viewport
Control your SDL rendering area with the viewport.
Color Keying
Render images with transparent backgrounds using color keying.
Clip Rendering and Sprite Sheets
Render parts of textures to use sprite sheets.
Color Modulation
Change your texture's color using color modulation.
Alpha Blending
Render transparent textures with SDL2.
Animated Sprites and VSync
Render animations in sync with the monitor refresh rate with SDL2.
Rotation and Flipping
Rotate and flip your textures in SDL2.
True Type Fonts
Render text with TTF fonts in SDL2.
Mouse Events
Handle mouse input with SDL2.
Key States
Query current key state with SDL2.
Gamepads and Joysticks
Use gamepads and joysticks with SDL2.
Force Feedback
Make your controllers rumble with SDL2.
Sound Effects and Music
Play sound with SDL2 and SDL_mixer.
Use time with SDL2.
Advanced Timers
Start, stop, pause, and unpause timers with SDL2.
Calculating Frame Rate
Calculate the frame rate for your SDL 2 applications.
Capping Frame Rate
Manually keep a constant frame rate with SDL2.
Move around game objects in SDL2.
Collision Detection
Check for collision SDL2.
Per-Pixel Collision Detection
Check collision with any image in SDL2.
Circular Collision Detection
Check for collision with circles in SDL2.
Scroll through levels with a camera in SDL2.
Scrolling Backgrounds
Make infinite scrolling backgrounds in SDL2.
Text Input And Clipboard Handling
Use text input and the clipboard in SDL2.
File Reading and Writing
Load and save binary files in SDL2.
Audio Recording
Record and playback audio in SDL2.
Window Events
Handle resizable windows in SDL2.
Multiple Windows
Handle multiple windows in SDL2.
Multiple Displays
Handle multiple monitors in SDL2.
Particle Engines
Make particle effects in SDL2.
Make levels with tiling engines in SDL2.
Texture Manipulation
Get and modify texture pixel data in SDL2.
Bitmap Fonts
Render bitmap fonts in SDL2.
Texture Streaming
Stream to textures in SDL2.
Render to Texture
Render to a texture in SDL2.
Frame Independent Movement
Move around at any frame rate in SDL2.
Timer Callbacks
Run timer callbacks in SDL2.
Run multithreaded applications in SDL2.
Lock data between threads in SDL2.
Atomic Operations
Synchronize your threads at a CPU level in SDL2.
Mutexes and Conditions
Synchronize threads with signaling in SDL2.
SDL and OpenGL 2
Support Legacy OpenGL in SDL2.
SDL and Modern OpenGL
Make modern shader based OpenGL programs in SDL2.
Hello Mobile
Port your Windows/Linux/MacOS games to Android/iOS.
Extensions and Changing Orientation
Use SDL_image/SDL_ttf/SDL_mixer and handle orientation on Android/iOS.
Learn how to handle touch input from an Android/iOS device in SDL2.
Multi Touch
Learn how to handle multi touch gestures on Android/iOS with SDL2.
If you find any bugs or typos in the tutorials please contact me.