Thursday, December 27, 2007

Setting Up SDL with Visual C++ 2008 Express

Microsoft recently released Visual Studio Express. I wanted to see if my SDL setup instructions for Visual C++ 2005 Express (PDF) worked with Visual C++ 2008 Express so I installed Visual C++ 2008 Express and went through my instructions. The good news is Microsoft did not make a lot of changes in Visual C++ 2008 Express so most of the instructions still apply. There are two differences.

Visual C++ 2008 Express Contains the Win32 SDK

Unlike Visual C++ 2005 Express, Visual C++ 2008 Express ships with the Windows Platform SDK, also known as the Win32 SDK. Visual C++ 2008 Express's Win32 SDK support means you don't have to install the SDK separately, and you don't have to modify any files to get Win32 support.
 
If you're running Visual C++ 2008 Express, you can skip over the Installing the Windows Platform SDK, Updating the Visual C++ Properties File, and Updating the Application Wizard's Settings File sections in my instructions.

The Path to the Win32 SDK is Slightly Different

In the section Telling Visual C++ Where to Find Your SDL Headers and Libraries, I said the path to the Win32 SDK was the following path:

C:\Program Files\Microsoft Platform SDK

If you install Visual C++ 2008 Express, you'll find the Win32 SDK at the following path:

C:\Program Files\Microsoft SDKs\Windows\v6.0A

The v6.0A is the Win32 SDK version. If you're reading this in the future, the version number may change.

Wednesday, December 26, 2007

I've Installed Xcode 3

I installed Mac OS X 10.5 and Xcode 3 last night so I can now answer Xcode 3 questions. As I spend more time with the new Xcode Tools, I will take note of changes Apple made in Xcode 3 and write about them here.

Tuesday, December 11, 2007

Changing SDL's Working Directory on Mac OS X

The Mac OS X version of SDL sets the working directory to the directory containing the application bundle. This default behavior makes loading images and sounds more difficult because the images and sounds most likely reside in the application bundle's Resources folder. What would be nice would be to set the working directory to the Resources folder. How do you do this?

You change the working directory by modifying the method -setupWorkingDirectory: in the file SDLMain.m. You'll want to change the code in SDLMain.m in SDL's Xcode templates so your changes take effect for any new SDL projects you create. Just to be safe, you should comment out the original code or save a copy of it so you can go back to the original if things go wrong. Enter the following code in the -setupWorkingDirectory: method:


NSString *resourcePath = [[NSBundle mainBundle] resourcePath];
[[NSFileManager defaultManager]
changeCurrentDirectoryPath
:resourcePath];


Thanks to Keith Bauer, aka OneSadCookie, for the source code to change the working directory.

Thursday, December 6, 2007

New Article: Playing Audio Files with QTKit

I have a new article on my website that explains how to load and play audio files using the QTKit framework. It should be especially helpful to any Cocoa developer who wants to loop an audio file because information on looping was hard to find in Apple's QTKit documentation.