README-macosx.txt
changeset 7801 f00cc0a8cd5d
parent 7222 2435b221d77d
child 8191 b50f4ae6d5f2
equal deleted inserted replaced
7800:76e4b6825efc 7801:f00cc0a8cd5d
    26 should compile your application the same way.  A script which wraps
    26 should compile your application the same way.  A script which wraps
    27 gcc to make this easy is provided in test/gcc-fat.sh
    27 gcc to make this easy is provided in test/gcc-fat.sh
    28 
    28 
    29 To use the library once it's built, you essential have two possibilities:
    29 To use the library once it's built, you essential have two possibilities:
    30 use the traditional autoconf/automake/make method, or use Xcode.
    30 use the traditional autoconf/automake/make method, or use Xcode.
       
    31 
       
    32 ==============================================================================
       
    33 Caveats for using SDL with Mac OS X
       
    34 ==============================================================================
       
    35 
       
    36 Some things you have to be aware of when using SDL on Mac OS X:
       
    37 
       
    38 - If you register your own NSApplicationDelegate (using [NSApp setDelegate:]),
       
    39   SDL will not register its own. This means that SDL will not terminate using
       
    40   SDL_Quit if it receives a termination request, it will terminate like a 
       
    41   normal app, and it will not send a SDL_DROPFILE when you request to open a
       
    42   file with the app. To solve these issues, put the following code in your 
       
    43   NSApplicationDelegate implementation:
       
    44 
       
    45   - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
       
    46   {
       
    47       if (SDL_GetEventState(SDL_QUIT) == SDL_ENABLE) {
       
    48           SDL_Event event;
       
    49           event.type = SDL_QUIT;
       
    50           SDL_PushEvent(&event);
       
    51       }
       
    52 
       
    53       return NSTerminateCancel;
       
    54   }
       
    55 
       
    56   - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
       
    57   {
       
    58       if (SDL_GetEventState(SDL_DROPFILE) == SDL_ENABLE) {
       
    59           SDL_Event event;
       
    60           event.type = SDL_DROPFILE;
       
    61           event.drop.file = SDL_strdup([filename UTF8String]);
       
    62           return (SDL_PushEvent(&event) > 0);
       
    63       }
       
    64 
       
    65       return NO;
       
    66   }
    31 
    67 
    32 ==============================================================================
    68 ==============================================================================
    33 Using the Simple DirectMedia Layer with a traditional Makefile
    69 Using the Simple DirectMedia Layer with a traditional Makefile
    34 ==============================================================================
    70 ==============================================================================
    35 
    71