1 #import <Cocoa/Cocoa.h>
3 #import "CocoaEcereBridge.h"
8 [[NSAutoreleasePool alloc] init];
9 [NSApplication sharedApplication];
11 [NSOpenGLContext clearCurrentContext];
22 bool CocoaProcessInput(bool processAll)
24 NSEvent *event = NULL;
26 unsigned int eventMask;
28 eventMask = (NSAnyEventMask);
32 NSApp nextEventMatchingMask:eventMask
34 inMode:NSDefaultRunLoopMode
37 [NSApp sendEvent:event];
39 printf("e%i\n", [event type]);
40 } while (event && processAll);
45 bool CocoaLock(WindowHandle handle)
47 EcereView *view = (EcereView*)handle;
54 void CocoaUnlock(WindowHandle handle)
56 EcereView *view = (EcereView*)handle;
61 void CocoaGetCurrentMode(bool * fullScreen, int * resolution, int * colorDepth, int * refreshRate)
69 WindowHandle CocoaCreateRootWindow(EcereWindowRef ecereWindow)
71 NSWindow *window = [[NSWindow alloc]
72 initWithContentRect:NSZeroRect
73 styleMask:( NSResizableWindowMask | NSClosableWindowMask | NSTitledWindowMask)
74 backing:NSBackingStoreBuffered
78 EcereView *view = [[EcereView alloc] initWithEcereWindow:ecereWindow];
79 [window setContentView:view];
82 [window makeKeyAndOrderFront:window];
88 void CocoaDestroyRootWindow(WindowHandle handle)
90 EcereView *view = (EcereView*)handle;
92 [[view window] release];
96 void CocoaSetRootWindowCaption(WindowHandle handle, const char *name)
98 EcereView *view = (EcereView*)handle;
100 NSString *title = [NSString stringWithCString:name];
102 [[view window] setTitle:title];
107 void CocoaPositionRootWindow(WindowHandle handle, int x, int y, int w, int h, bool move, bool resize)
109 EcereView *view = (EcereView*)handle;
111 NSRect frame = [[view window] frame];
119 frame.size.width = w;
120 frame.size.height = h;
123 [[view window] setFrame:frame display:YES];
126 void CocoaOffsetWindow(WindowHandle handle, int *x, int *y)
130 void CocoaGetMousePosition(int *x, int *y)
133 location = [NSEvent mouseLocation];
139 void CocoaOpenGLMakeCurrentContext(WindowHandle handle)
141 EcereView *view = (EcereView*)handle;
143 [view makeCurrentContext];
146 void CocoaOpenGLUpdate(WindowHandle handle)
148 EcereView *view = (EcereView*)handle;
150 [view flushOpenGLBuffer];