#import #import "memory.h" void message_box(const char *string) { NSString *cocoaString = [NSString stringWithUTF8String:string]; NSAlert *alert = [[[NSAlert alloc] init] autorelease]; [alert addButtonWithTitle:@"Quit"]; [alert setMessageText:@"Critical Error :("]; [alert setInformativeText:cocoaString]; [alert setAlertStyle:NSWarningAlertStyle]; [alert runModal]; } char *resource_path(char *category, char *file) { NSBundle *mainBundle = [NSBundle mainBundle]; NSString *resourcePath = [mainBundle resourcePath]; NSString *fullPath = [resourcePath stringByAppendingPathComponent:[NSString stringWithUTF8String:file]]; char *c_fullpath = alloc(sizeof(char) * ([fullPath length] + 2)); [fullPath getCString:c_fullpath maxLength:[fullPath length] + 1 encoding:NSUTF8StringEncoding]; char *retval = autorelease(c_fullpath); return retval; }