[Home] [Credit Search] [Category Browser] [Staff Roll Call] | The LINUX.COM Article Archive |
Originally Published: Monday, 25 June 2001 | Author: Josh Boudreau |
Published to: develop_articles_tutorials/Development Tutorials | Page: 1/4 - [Printable] |
Programming Linux Games: An Introduction to SDL Development
Welcome to Game Week on Linux.com! All this week we'll be featuring and playing games. The game week feature article by Linux.com writer Josh "bitwize" Boudreau is a succinct introduction to programming with the SDL (Simple DirectMedia Layer) library, essential to understanding Linux game development. So all you game programmers or would be game programmers: read up!
|
Page 1 of 4 >> | |
SDL (Simple DirectMedia Layer) is a cross-platform development library providing an API useful to game developers. It gives access to video, audio, timing functions, event handling and threads. SDL supports many platforms; Linux, Windows, MacOS, Solaris, IRIX and FreeBSD are all supported: this means that when your application uses the SDL library functions, they will work when you compile your application on a different supported platform. SDL is written in C and it supports C and C++ out of the box; bindings for Ada, Eifel, ML, Perl, PHP, Perl, Python and Ruby have also been created. This article provides an introduction to a few of the features of the SDL library and will use the C programming language for the source code examples. I will assume the reader has basic knowledge of the C programming language and knows how to work with the GNU programming tools. Installing The SDL LibraryIf your Linux distribution didn't come with SDL you can download the library from www.libsdl.org. SDL's web site has binary packages and also a source code distribution if a package for your distribution is not available. If you downloaded a binary package you can install it with your distribution's package manager tool (for example, RPM on RedHat). I'll give instructions on how to compile and install SDL from source code, in case they didn't provide a package for you. Be sure to download the development version. The runtime version of SDL is only used for running programs that were compiled with SDL. The development version contains the libraries used to compile and link your program but also contains the runtime libraries.
These commands will build and install SDL in Compiling SDL Applications
SDL programs need to be linked with the SDL library and also pthread since the SDL library has thread support. Each application also needs to include the
While this application doesn't really use any SDL function, we still include the
This will compile and link your applications with the appropriate libraries and give you an executable named a.out in the same directory. Take note that the
| |
Page 1 of 4 >> |