Blue Dino Code

Category

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

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

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

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.