Development Environment of Legend of Tux

From LD Smith Games Workshop
Jump to navigation Jump to search

This page defines the process for setting up the development environment for The Legend of Tux. This development environment will be for Cygwin using SDL under Windows. (Yeah... boo Windows... get over it) You should be able to build this same environment under Linux, Solaris, etc if you are ambitious enough. (your mileage may vary) I will try to also provide releases for both Windows and Ubuntu Linux.

Compiler and Game Libraries

Download cygwin:

Run the "setup.exe" installer

Be sure to select the following:

  • vi
  • gcc
  • make
  • g++

Download SDL:

Get the "SDL-1.2.13.tar.gz" file (or whatever the latest version is)

Start cygwin, and extract the file

# gzip -d SDL-1.2.13.tar.gz
# tar xvf SDL-1.2.13.tar

Build the SDL environment

# cd SDL-1.2.13
# ./configure
# make
# make install

Be sure to distribute SDL.dll with Windows builds


Download SDL_mixer-1.2.8.tar.gz: (or whatever the latest version is)

If downloaded with Windows, rename the download

mv SDL_mixer-1.2.8.tar.tar SDL_mixer-1.2.8.tar.gz


gzip -d SDL_mixer-1.2.8.tar.gz

Set permissions if needed

 chmod u+rw SDL_mixer-1.2.8.tar 


tar -xvf SDL_mixer-1.2.8.tar

Without OGG Support

Note: Legend of Tux now requires OOG, since the background music is stored in OGG format

You will only be able to play .wav files, which can be quite huge (50+ Mb for a 2 minute music clip), which in turn makes your distribution package large


 cd SDL_mixer-1.2.8

 make install

Copy the SDL_mixer.h file

cp SDL_mixer.h /usr/local/include/SDL/

Copy the lib files

 cp ./build/.libs/*.a /usr/local/lib

Compile and run the test program

 gcc playwave.c `sdl-config --libs --cflags` -lSDL_mixer
 ./a -f <wavefile.wav>

Remember to copy the SDL_mixer.dll file (./build/.libs/SDL_mixer.dll) to the base directory of your release distribution

With OGG Support

Finally got an OGG to play with the playmus.c program, however it is a Windows only solution.

Download from

Unzip, and put the DLL files in the SDL_mixer-1.2.8 directory, and it should work.

Note: Be sure to "chmod 644" your OGG files. When Audacity exports an OGG file, it will sometimes save it with zero permissions, and you won't be able to play the OGG file from your program.

OGG build testing notes

Font Support

See the SDL ttf page for instructions on how to build the font libraries.

Graphics Tools

Gimp for Windows:

For editing images


For building 3D models


For creating UML diagrams

Site for free stock photos:

Audio Tools


For converting between wav/mp3/ogg

Excellent site for public domain music:

Great for finding free music to include in the game

Level Design


Building Under Linux

First Attempt

I am using Ubuntu 9.04 under Virtual Box 3.06 to build the Linux version. It's easier than setting up a dual boot system, and I doubt any of the Live distributions include SDL compilation libraries.

Dowload the SDL source from


Extract the file (I just used File Roller 2.26.1)

 # cd SDL-1.2.14
 # ./configure
 # sudo bash
 # make
 # make install

Use Synaptic Package Manager to download and install the "libsdl-mixer1.2" package. If you are building under Red Hat/Fedora/Mandriva/etc you can probably use the rpm directly from the libsdl website.

You should get a message about it also installing "libmikmod2" and "libsmpeg0". It is much easier doing it this way, rather than trying to download those packages individually and trying to get it all to work together.

Push the "Mark" button to add the two additional packages, then press the "Apply" button (green check). Press "Apply" on the confirmation screen. Press "Close" on the Changes applied screen. Close Synaptic Package Manager.

 # cd ..
 # cd lotux_v0_4_src
 # chmod u+x go
 # echo "Change lotux.exe to lotux in the go file"
 # vi go
 # ./go
 # ./lotux

For some reason, when I tried running ./lotux, the window would never display. Maybe it's because the resolution of the program window is greater than the desktop window... or maybe it's because the DISPLAY environment variable needs to be exported or something.

Easier Method

Next I tried running my Ubuntu installation that I have on my flash drive, that I installed using Unetbootin. This made the compilation much easier.

I simply started Synaptic Package Manager, selected libsdl1.2-dev and libsdl-mixer1.2-dev, and applied those packages (it will report about 50 dependencies which it will also install). Then I simply changed "lotux.exe" to "lotux" in the "go" script, ran ./go, then ./lotux, and the game and music worked perfectly. I did receive warnings about the implicit declarations of sin, cos, atan, so I should have really #include <math.h> and -lm on the gcc line in the go script.