Mercurial > sdl-ios-xcode
view test/testnativecocoa.m @ 4968:379361d5e425
Jcw87 to Sam
The project files for VS 2005 are still outdated/messed up. I have a patch that will bring the VS 2005 project files up to date with the VS 2008 project files, add the x64 platform to the VS 2005 project files, fix a few issues with x64 in VS 2008, and a few other misc changes that don't really change the output at all.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 09 Jan 2011 08:35:18 -0800 |
parents | 089a77aebb7d |
children |
line wrap: on
line source
#include "testnative.h" #ifdef TEST_NATIVE_COCOA #include <Cocoa/Cocoa.h> static void *CreateWindowCocoa(int w, int h); static void DestroyWindowCocoa(void *window); NativeWindowFactory CocoaWindowFactory = { "cocoa", CreateWindowCocoa, DestroyWindowCocoa }; static void *CreateWindowCocoa(int w, int h) { NSAutoreleasePool *pool; NSWindow *nswindow; NSRect rect; unsigned int style; pool = [[NSAutoreleasePool alloc] init]; rect.origin.x = 0; rect.origin.y = 0; rect.size.width = w; rect.size.height = h; rect.origin.y = CGDisplayPixelsHigh(kCGDirectMainDisplay) - rect.origin.y - rect.size.height; style = (NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask); nswindow = [[NSWindow alloc] initWithContentRect:rect styleMask:style backing:NSBackingStoreBuffered defer:FALSE]; [nswindow makeKeyAndOrderFront:nil]; [pool release]; return nswindow; } static void DestroyWindowCocoa(void *window) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSWindow *nswindow = (NSWindow *)window; [nswindow close]; [pool release]; } #endif