Ever looked at FinalCut or Unreal Tournament and thought cool interface? Ever wanted to make your program or game look as good?


By using themes you can without any work! You can use Apple's wonderful Cocoa APIs, and Interface Builder just as you would building an Aqua application. You could even use Carbon.

How to

What you need
My supporting
A theme

How to do it

Then in your main file have something like this:

#import <Cocoa/Cocoa.h>
#import "APELite.h"
typedef CFBundleRef (*CFProcPtr)(CFStringRef ref);
CFProcPtr gOldRef = NULL;
CFBundleRef PatchCF(CFStringRef duration);

CFBundleRef PatchCF(CFStringRef ref)
    // slip in our own fake HIToolbox framework
    if(CFStringCompare(ref, CFSTR(""), 0) == kCFCompareEqualTo)
        CFBundleRef mainBundle = CFBundleGetMainBundle ();
        CFURLRef    url = CFBundleCopyResourceURL(mainBundle, CFSTR("HIToolbox"), CFSTR("framework"), NULL);

        return CFBundleCreate(NULL, url);
    // call-through the original CFBundleGetBundleWithIdentifier()
    return gOldRef(ref);

int main(int argc, char *argv[])
    gOldRef = APEPatchCreate(&CFBundleGetBundleWithIdentifier, &PatchCF);

    return NSApplicationMain(argc, argv);

This code patches the CFBundleGetBundleWithIdentifier function and replaces it with your own function PatchCF. The new function PatchCF then catches any attempt to load the HIToolbox framework and passes back your own fake framework.

The results

Before and after shots of an old adventure game I wrote, using applewood2 guiKit by Andrew Leipurts to theme my game. Very little effort and a huge difference.

Getting themes

Often themes come packaged as GuiKits for ShapeShifter, without any direct access to Extras.rsrc. But you can access them with a little trouble.