src/macosx/SDLMain.mm File Reference

#import <AppKit/AppKit.h>
#import <SDL/SDL.h>
#import "SDLMain.h"
#import <sys/param.h>
#import <unistd.h>
#include "aa_config.h"
#include "tError.h"
#include "tConfiguration.h"
#include "uMenu.h"
#include "AAURLHandler.h"
#include "AAGrowlPlugin.h"

Include dependency graph for SDLMain.mm:

Go to the source code of this file.

Classes

class  NSString(ReplaceSubString)
class  SDLApplication

Defines

#define SDL_USE_NIB_FILE   1

Functions

void MacOSX_SetCWD (char **argv)
 Change to the resource folder of the application bundle.
int main (int argc, char **argv)

Variables

static int gArgc
static char ** gArgv
static BOOL gFinderLaunch
SDL_Event event


Define Documentation

#define SDL_USE_NIB_FILE   1

Definition at line 19 of file SDLMain.mm.


Function Documentation

void MacOSX_SetCWD ( char **  argv  ) 

Change to the resource folder of the application bundle.

Definition at line 51 of file SDLMain.mm.

References buffer.

Referenced by main().

00053                                 {
00054     char buffer;
00055     int count = 2, i;
00056     strcpy(buffer, argv[0]);
00057     
00058     if ( !strstr(buffer, ".app") )
00059     {
00060         //it's not a .app bundle
00061         return;
00062     }
00063 
00064     for ( i = strlen(buffer); i > 0 && count > 0; i-- )
00065     {
00066         if (buffer[i] == '/')
00067             count--;
00068     }
00069     
00070     if ( i == 0 )
00071         return;
00072     
00073     i+=2;
00074     buffer = 0;
00075     strcat( buffer, "Resources");

Here is the caller graph for this function:

int main ( int  argc,
char **  argv 
)

Definition at line 171 of file SDLMain.mm.

References CleanupAAURLHandler(), gArgc, gArgv, gFinderLaunch, MacOSX_SetCWD(), malloc, NULL, SetupAAURLHandler(), AAGrowlPlugin::startGrowling, and tASSERT.

00174 {
00175     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
00176     AAGrowlPlugin *growl = [[AAGrowlPlugin alloc] init];
00177     [growl startGrowling];
00178     SetupAAURLHandler();
00179 
00180     /* This is passed if we are launched by double-clicking */
00181     if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 )
00182     {
00183         gArgc = 1;
00184         gFinderLaunch = YES;
00185     }
00186     else
00187     {
00188         gArgc = argc;
00189         gFinderLaunch = NO;
00190     }
00191 
00192     gArgv = (char**)malloc( sizeof(*gArgv) * (gArgc+1) );
00193     tASSERT (gArgv != NULL);
00194     int i = 0;
00195     for (i; i < gArgc; i++)
00196     {
00197         gArgv = (char *) argv[i];
00198     }
00199 
00200     gArgv = NULL;
00201         MacOSX_SetCWD(gArgv);
00202     
00203 #if SDL_USE_NIB_FILE
00204     [SDLApplication poseAsClass:[NSApplication class]];
00205     NSApplicationMain (argc, (const char **)argv);
00206 #else
00207     CustomApplicationMain (argc, argv);
00208 #endif
00209     CleanupAAURLHandler();
00210     [growl release];

Here is the call graph for this function:


Variable Documentation

SDL_Event event

Definition at line 35 of file SDLMain.mm.

Referenced by uMenu::IdleInput().

int gArgc [static]

Definition at line 21 of file SDLMain.mm.

Referenced by SDLMain::applicationDidFinishLaunching:, and main().

char** gArgv [static]

Definition at line 22 of file SDLMain.mm.

Referenced by SDLMain::applicationDidFinishLaunching:, and main().

BOOL gFinderLaunch [static]

Definition at line 23 of file SDLMain.mm.

Referenced by main().


Generated on Sat Mar 15 23:00:02 2008 for Armagetron Advanced by  doxygen 1.5.4