Mercurial > sdl-ios-xcode
comparison src/main/macosx/SDLMain.m @ 58:bd6b0a910a65
* Removed fullscreen menu option from the "Window" menu
* Updated the BUGS file
* Fixed command line parameters when launched from Finder
* Implemented setting the icon window caption
* Implemented frameless style windows
* Added note about SDL_RESIZABLE implementation to SDL_QuartzVideo.m
* Window close requests now go through the event filtering system
author | Sam Lantinga <slouken@lokigames.com> |
---|---|
date | Mon, 11 Jun 2001 06:44:43 +0000 |
parents | 45b1c4303f87 |
children | 4382c38dfbee |
comparison
equal
deleted
inserted
replaced
57:ec550054db3b | 58:bd6b0a910a65 |
---|---|
19 - (void) quit:(id)sender | 19 - (void) quit:(id)sender |
20 { | 20 { |
21 SDL_Event event; | 21 SDL_Event event; |
22 event.type = SDL_QUIT; | 22 event.type = SDL_QUIT; |
23 SDL_PushEvent(&event); | 23 SDL_PushEvent(&event); |
24 } | |
25 | |
26 /* Invoked from the "Make fulllscreen" menu item */ | |
27 - (void) makeFullscreen:(id)sender | |
28 { | |
29 | |
30 } | 24 } |
31 | 25 |
32 /* Set the working directory to the .app's parent directory */ | 26 /* Set the working directory to the .app's parent directory */ |
33 - (void) setupWorkingDirectory | 27 - (void) setupWorkingDirectory |
34 { | 28 { |
51 } | 45 } |
52 | 46 |
53 /* Called when the internal event loop has just started running */ | 47 /* Called when the internal event loop has just started running */ |
54 - (void) applicationDidFinishLaunching: (NSNotification *) note | 48 - (void) applicationDidFinishLaunching: (NSNotification *) note |
55 { | 49 { |
50 int status; | |
51 | |
56 /* Set the working directory to the .app's parent directory */ | 52 /* Set the working directory to the .app's parent directory */ |
57 [ self setupWorkingDirectory ]; | 53 [ self setupWorkingDirectory ]; |
58 | 54 |
59 /* This is passed if we are launched by double-clicking */ | |
60 if ( gArgc >= 2 && strncmp (gArgv[1], "-psn", 4) == 0 ) | |
61 gArgc = 1; | |
62 | |
63 /* Hand off to main application code */ | 55 /* Hand off to main application code */ |
64 SDL_main (gArgc, gArgv); | 56 status = SDL_main (gArgc, gArgv); |
65 exit(0); | 57 |
58 /* We're done, thank you for playing */ | |
59 exit(status); | |
66 } | 60 } |
67 @end | 61 @end |
68 | 62 |
69 #ifdef main | 63 #ifdef main |
70 # undef main | 64 # undef main |
74 int main (int argc, char **argv) { | 68 int main (int argc, char **argv) { |
75 | 69 |
76 /* Copy the arguments into a global variable */ | 70 /* Copy the arguments into a global variable */ |
77 int i; | 71 int i; |
78 | 72 |
79 gArgc = argc; | 73 /* This is passed if we are launched by double-clicking */ |
80 gArgv = (char**) malloc (sizeof(*gArgv) * gArgc); | 74 if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) { |
75 gArgc = 1; | |
76 } else { | |
77 gArgc = argc; | |
78 } | |
79 gArgv = (char**) malloc (sizeof(*gArgv) * (gArgc+1)); | |
81 assert (gArgv != NULL); | 80 assert (gArgv != NULL); |
82 for (i = 0; i < gArgc; i++) { | 81 for (i = 0; i < gArgc; i++) { |
83 gArgv[i] = strdup (argv[i]); | 82 gArgv[i] = argv[i]; |
84 } | 83 } |
85 | 84 gArgv[i] = NULL; |
85 | |
86 NSApplicationMain (argc, argv); | 86 NSApplicationMain (argc, argv); |
87 return 0; | 87 return 0; |
88 } | 88 } |