2
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
3
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
4
Hacked for pygame: Bob Ippolito <bob@redivi.com>
6
Feel free to customize this file to suit your needs
12
#import <Cocoa/Cocoa.h>
13
#import <Carbon/Carbon.h>
16
@interface SDLMain : NSObject
19
/* Create a window menu */
20
void setupWindowMenu(void)
23
NSMenuItem *windowMenuItem;
27
windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
30
menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"];
31
[windowMenu addItem:menuItem];
34
/* Put menu into the menubar */
35
windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""];
36
[windowMenuItem setSubmenu:windowMenu];
37
[[NSApp mainMenu] addItem:windowMenuItem];
39
/* Tell the application object that this is now the window menu */
40
[NSApp setWindowsMenu:windowMenu];
42
/* Finally give up our references to the objects */
44
[windowMenuItem release];
47
/* The main class of the application, the application's delegate */
48
@implementation SDLMain
49
- (void)quit:(id)sender
51
/* Post a SDL_QUIT event */
53
event.type = SDL_QUIT;
54
SDL_PushEvent(&event);
57
- (void)terminate:(id)sender
59
/* Post a SDL_QUIT event */
61
event.type = SDL_QUIT;
62
SDL_PushEvent(&event);
66
NSAutoreleasePool *global_pool;
69
void StartTheDamnApplication (void)
74
global_pool = [[NSAutoreleasePool alloc] init];
75
[NSApplication sharedApplication];
76
if (!CPSGetCurrentProcess(&PSN))
77
if (!CPSSetProcessName(&PSN,"pygame"))
78
if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
79
if (!CPSSetFrontProcess(&PSN))
80
[NSApplication sharedApplication];
81
[NSApp setMainMenu:[[NSMenu alloc] init]];
83
sdlMain = [[SDLMain alloc] init];
84
[NSApp setDelegate:sdlMain];
85
[NSApp finishLaunching];
86
[NSApp requestUserAttention:NSCriticalRequest];
87
[NSApp updateWindows];
88
pygameIcon = [[NSImage alloc] initWithContentsOfFile: @"/Library/Frameworks/Python.framework/Versions/Current/lib/python2.2/site-packages/pygame/pygame_icon.tiff"];
89
[NSApp setApplicationIconImage:pygameIcon];
93
void WeAreDoneFreeSomeMemory(void)
96
[global_pool release];
b'\\ No newline at end of file'