SDLAudio README

This program adds sound to the SDLInput example. Use the arrow keys or the joystick (if you have one plugged in) to move the ship. Move the mouse left to rotate the ship to the left, and move the mouse right to rotate the ship to the right. Click the left mouse button or any button on the joystick to play a sound effect. Close the window to quit the program.

UPDATES

February 9, 2007: Eliminated the use of several unnecessary pointers to simplify the code.

NOTE FOR LINUX AND WINDOWS USERS

The code assumes the texture files (Background.png and PlayerShip.png) and the sound files (Music.mp3 and SoundEffect.ogg) reside in the current working directory. Placing the texture files in the same directory as the executable file should work.

NOTE FOR MAC OS X USERS

The Mac OS X version of SDL sets the working directory to the directory above the application bundle. This means the code to load the texture (Background.png and PlayerShip.png) and sound files (Music.mp3 and SoundEffect.ogg) depends on the application name, which is SDLAudio.app. If you choose a different application name, you must change the code in the functions GameApp::InitApp() and GameApp::InitializeDrawContext(), which are in the file GameApp.cpp

KNOWN ISSUES

Joystick control has a big problem, at least on Mac OS X. The ship will move by itself initially. Moving the joystick left, right, up, and down fixes things. It is a joystick calibration problem that I'm still trying to solve. I decided to post the code rather than waiting until I solve the problem.

The program does not do any bounds checking to keep the ship on the screen. It is possible to move the ship off the screen.

The code does not handle errors gracefully. It exits the programs when problems occur, such as NULL pointers and being unable to load the file.


WHAT YOU NEED TO DO TO COMPILE THE CODE

This program makes use of the SDL, SDL_image, and SDL_mixer libraries. You must download these libraries from the SDL (http://www.libsdl.org), SDL_image (http://www.libsdl.org/projects/SDL_image) and SDL_mixer (http://www.libsdl.org/projects/SDL_mixer) sites and install them on your computer.

Once you install the SDL, SDL_image, and SDL_mixer libraries, you can open your development environment and compile the code. For your code to compile, it will have to link against the OpenGL, GLU, SDL, SDL_image, and SDL_mixer libraries.

MAC OS X USERS

Your code must link against the OpenGL, SDL, SDL_image, and SDL_mixer frameworks. The OpenGL framework contains both the OpenGL and GLU libraries. If you're using Xcode, you should also add the texture files and sound files to your project. Doing so enables Xcode to copy the texture file to your program's application bundle.

WINDOWS USERS

You need to have the Win32 SDK installed on your computer. The Win32 SDK contains the OpenGL (opengl32.lib) and GLU libraries (glu32.lib). If you're using Visual C++ 2005 Express, the Win32 SDK does not get installed with Visual C++. You have to perform a separate installation of the Platform SDK to install the Win32 SDK.


If you have any questions or comments, feel free to email me.

Mark Szymczyk
mark@meandmark.com
