comparison src/video/cocoa/SDL_cocoawindow.m @ 1936:83946ee0ff1f

Implemented OpenGL support on Mac OS X The OpenGL renderer works without changes, yay! :)
author Sam Lantinga <slouken@libsdl.org>
date Tue, 25 Jul 2006 06:22:42 +0000
parents 7ee5297340f7
children 05e88d266921
comparison
equal deleted inserted replaced
1935:8a9b367a80f3 1936:83946ee0ff1f
29 29
30 #include "SDL_cocoavideo.h" 30 #include "SDL_cocoavideo.h"
31 31
32 static __inline__ void ConvertNSRect(NSRect *r) 32 static __inline__ void ConvertNSRect(NSRect *r)
33 { 33 {
34 /* FIXME: Cache the display used for this window */
34 r->origin.y = CGDisplayPixelsHigh(kCGDirectMainDisplay) - r->origin.y - r->size.height; 35 r->origin.y = CGDisplayPixelsHigh(kCGDirectMainDisplay) - r->origin.y - r->size.height;
35 } 36 }
36 37
37 @implementation Cocoa_WindowListener 38 @implementation Cocoa_WindowListener
38 39
323 NSAutoreleasePool *pool; 324 NSAutoreleasePool *pool;
324 NSWindow *nswindow; 325 NSWindow *nswindow;
325 NSRect rect; 326 NSRect rect;
326 unsigned int style; 327 unsigned int style;
327 NSString *title; 328 NSString *title;
329 int status;
328 330
329 pool = [[NSAutoreleasePool alloc] init]; 331 pool = [[NSAutoreleasePool alloc] init];
330 332
331 if ((window->flags & SDL_WINDOW_FULLSCREEN) || 333 if ((window->flags & SDL_WINDOW_FULLSCREEN) ||
332 window->x == SDL_WINDOWPOS_CENTERED) { 334 window->x == SDL_WINDOWPOS_CENTERED) {
378 380
379 [pool release]; 381 [pool release];
380 382
381 if (SetupWindowData(window, nswindow, YES) < 0) { 383 if (SetupWindowData(window, nswindow, YES) < 0) {
382 [nswindow release]; 384 [nswindow release];
383 [pool release];
384 return -1; 385 return -1;
385 } 386 }
386 #ifdef SDL_VIDEO_OPENGL 387 #ifdef SDL_VIDEO_OPENGL
387 /*
388 if (window->flags & SDL_WINDOW_OPENGL) { 388 if (window->flags & SDL_WINDOW_OPENGL) {
389 if (Cocoa_GL_SetupWindow(_this, window) < 0) { 389 if (Cocoa_GL_SetupWindow(_this, window) < 0) {
390 Cocoa_DestroyWindow(_this, window); 390 Cocoa_DestroyWindow(_this, window);
391 return -1; 391 return -1;
392 } 392 }
393 } 393 }
394 */
395 #endif 394 #endif
396 return 0; 395 return 0;
397 } 396 }
398 397
399 int 398 int
520 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; 519 SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
521 520
522 if (data) { 521 if (data) {
523 NSAutoreleasePool *pool; 522 NSAutoreleasePool *pool;
524 #ifdef SDL_VIDEO_OPENGL 523 #ifdef SDL_VIDEO_OPENGL
525 /*
526 if (window->flags & SDL_WINDOW_OPENGL) { 524 if (window->flags & SDL_WINDOW_OPENGL) {
527 Cocoa_GL_CleanupWindow(_this, window); 525 Cocoa_GL_CleanupWindow(_this, window);
528 } 526 }
529 */
530 #endif 527 #endif
531 pool = [[NSAutoreleasePool alloc] init]; 528 pool = [[NSAutoreleasePool alloc] init];
532 [data->listener close]; 529 [data->listener close];
533 [data->listener release]; 530 [data->listener release];
534 if (data->created) { 531 if (data->created) {