Difference between revisions of "Using SDL with Code::Blocks"

From Code::Blocks
Line 3: Line 3:
 
<br />
 
<br />
  
This article deals with SDL using Code::Blocks with the MinGW compiler, however the same steps will likely work with a different compiler (such as MSVC2003 toolkit) or under Linux, too (Linux users will of course not worry about DirectX).<br />
+
 
  
 
==The Good, the Bad, and the Ugly - Setting up SDL==
 
==The Good, the Bad, and the Ugly - Setting up SDL==
There are many ways to set up [[SDL]] to be used with [[CodeBlocks:About Code::Blocks]], each of them having its own advantages and disadvantages.
+
This article deals with [[SDL]] using [[CodeBlocks:About|Code::Blocks]] with the [[http://www.mingw.org|MinGW compiler]], however the same steps will likely work with a different compiler (such as MSVC2003 toolkit) or under Linux, too (Linux users will of course not worry about DirectX).
First, you have to get the necessary libraries and include files. There are three ways of getting these.
 
  
The uglier variants have the advantage of better configurability, but may take significant time to set up.
+
There are many ways to get the necessary libraries and include files to set up SDL to be used with CodeBlocks::Blocks]], each of them having its own advantages and disadvantages.
 +
The uglier variants have the advantage of better configurability, but may take significantly more time to set up.
  
 
==The Good==
 
==The Good==

Revision as of 13:41, 22 August 2005


( --- article is in work --- )


The Good, the Bad, and the Ugly - Setting up SDL

This article deals with SDL using Code::Blocks with the [compiler], however the same steps will likely work with a different compiler (such as MSVC2003 toolkit) or under Linux, too (Linux users will of course not worry about DirectX).

There are many ways to get the necessary libraries and include files to set up SDL to be used with CodeBlocks::Blocks]], each of them having its own advantages and disadvantages. The uglier variants have the advantage of better configurability, but may take significantly more time to set up.

The Good

The easiest of all possibilities is to just download the SDL binary distribution directly from libsdl.org.
If you are only interested in writing a SDL application, then the pre-built libraries are probably good enough for all your needs, so there is little reason to waste your time compiling your own.

Pro/Con

  • pro: need to download one file, setup time ~20 seconds
  • pro: it works
  • con: not configurable

Prerequisites

  1. Internet Connection
  2. Archiving program (tar, 7z, WinZip, PowerArchiver, ...)

The Process

Download SDL-devel-1.2.8-mingw32.tar.gz from http://www.libsdl.org/download-1.2.php. There

Alternative

Code::Blocks comes with support for reading .DevPak files of late. This allows for an even more comfortable setup. Recent DevPaks (1.2.8) for SDL, SDL-mixer, and SDL-ttf can be found at http://www.devpaks.org/category.php?category=SDL.
Important: Please do note that the packages at devpaks.org are not original packages created by the SDL team. Be aware that devpaks.org theoretically allows anyone to upload anything under the name SDL. Although I know of no case of malware being distributed over this channel, it is still possible.

The Bad

With a little more effort, you can build SDL from sources using Code::Blocks. While this may not be the desirable solution for Joe Everybody writing Hello World for his computer science class, it has certainly its advantages.

Prerequisites

The Code::Blocks IDE
A working Template:MinGW installation
Any archiving program that is capable of decompressing a .tar.gz file.

The Ugly

SDL can be built

The Grave of Arch Stanton - Using SDL

Now that we have the libraries and headers installed, we want to build a SDL application.

Prerequisites

The Code::Blocks IDE