SDL Tutorials

Taggidy tag tag

SDL 2.0 Basics and Textures

Tim Jones    |     March 13th, 2014    |     0 comments
I have two repos up on GitHub so far with code for SDL 2.0. You can find them here:

https://github.com/MetaCipher

One is a basic foundation code for getting SDL 2.0 working. The other is for wrapping SDL_Textures into another Texture class. I'll most likely update the Texture code to also include TextureBank class.

Keep checking back for updates.
SDL Tutorials

GitHub and SDL 2.0

Tim Jones    |     March 11th, 2014    |     1 comment
I have begun the process of coding new tutorials for SDL 2.0. I am first going to code the new tutorial series and sync to GitHub here:

https://github.com/MetaCipher

This will allow me to get the code out fairly quickly and allow a majority of the readers to benefit from the new code. Comments, forks, and the like are welcome as the new tutorial serious is put together.

The actual tutorial that explains the code will come at a later date. Also, please note that these tutorials are going to be new and independent of the old SDL 1.2 tutorials. However, the goal of demonstrating how to create games is still going to be the focus.

Have fun!
Announcements
SDL Tutorials

Huh? My Pong clone uses 100% CPU and is still slow?

Jonny D    |     November 9th, 2011    |     10 comments
Your program is being a CPU hog! In some cases, this situation can actually make your program run slowly! Your code needs to give some time back to the OS (i.e. delay or sleep). Use SDL_Delay(Uint32), where the Uint32 is in milliseconds. As a quick fix, you can toss a SDL_Delay(1) call into your loop. That will give up some amount of time, based on the OS and the resolution of SDL_Delay(), which is somewhere around 10ms. If you need better resolution than that, you have to store the time it takes to perform SDL_Delay(1), check that against delay calls, and then burn the rest of the time in an empty loop. Here's a link to some code implementing that.
Blue Dino Code
SDL Tutorials

SDL App States

Tim Jones    |     October 19th, 2011    |     28 comments
In this muchly desired side tutorial we are going to look at how to implement something most commonly called Game States (or as I call them, App States). This tutorial will be based upon the code from the SDL Collision Events tutorial.

To simply explain what an app state is, try to think of your game (or application) as a parent with many child applications. In other words, your primary application can yield control to a single child when needed.
SDL Tutorials
App States
Game States

SDL TTF

Alexander Bock    |     September 8th, 2011    |     14 comments
Text is an important part of almost all games. From informing the player of the awesome combo that they just got, to menu titles, button captions and epic storylines. In this tutorial, we will take a look at SDL_ttf, an addon library for SDL that uses the FreeType library to load fonts and render text.
SDL Tutorials
Fonts

The Ins and Outs (and Overlays) of Alpha-blending

Jonny D    |     August 25th, 2010    |     10 comments
The following tutorial was created by Blue Dino Code, for the purpose of helping people like you learn SDL. This tutorial, though not purposely a part
Blue Dino Code
SDL Tutorials

SDL + OpenGL Tutorial Basics

Tim Jones    |     June 5th, 2010    |     51 comments
In this new tutorial series, we will be looking at using SDL along with OpenGL. SDL as it stands is nice for basic 2D graphics/composition, but when i
SDL Tutorials
SDL + OpenGL Tutorials

A Guide to Graphics with Sprig

Jonny D    |     February 9th, 2010    |     5 comments
The following tutorial was created by Blue Dino Code, for the purpose of helping people like you learn SDL. This tutorial, though not purposely a part
SDL Tutorials
Blue Dino Code

SDL Per Pixel Collision

Jason Norris    |     January 28th, 2010    |     22 comments
Are bounding box and circle collisions just not cutting it? Well, now we're going to dive right down into pixel precision!

Before we start, I'd like to say that this is an advanced SDL tutorial. You should have experience with creating SDL applications and some basic knowledge of getting a program with it's libraries up and running.

First, we'll start off with a very simple Game class to build the foundation of our demo project.
SDL Tutorials

MixBox Quick Guide

Jonny D    |     January 13th, 2010    |     4 comments
MixBox is a set of C++ classes that makes it easy to add sound and music to your games. The MixBox class is the main one. It holds all the sound and music data and has functions that access just about everything you'd want. The other classes, SoundID, MusicID, and ChannelID, are all subclasses of MixID. Each of these classes has functions that roughly duplicate what the MixBox class can do for that type of object, but having them lets you choose how best to work MixBox into your game.
SDL Tutorials
Blue Dino Code
RECENT TUTORIALS

First Foray into SDL/OpenGL

OpenGL handles the drawing of models in a window but it does not provide the window, or handle events; that is why SDL is required. The prime purpose of this tutorial is to set up the SDL window and events mechanism. It also sets up the OpenGL environment that uses the window, the game loop, and a rotating cube.

Huh? My Pong clone uses 100% CPU and is still slow?

Your program is being a CPU hog! In some cases, this situation can actually make your program run slowly! Your code needs to give some time back to the OS (i.e. delay or sleep).

Setting up MonoDevelop to run Tao

A new series from Stephen Jones demonstrating how to use C#, Mono, and Tao to develop SDL / OpenGL games.
Tag.