[SDL] Retrieving Mac window reference

Michael Ryan Bannon mrbannon at swen.uwaterloo.ca
Fri Jul 14 12:58:28 PDT 2006


Thanks for the code.
I really don't know Ojb-C that well...in fact, not at all.  And my project 
is all in C++, so I'll either have to find another solution or learn Obj-C.
Would it be a good idea to add a method that returns the window reference 
associated with a surface?

Thanks,

Ryan


"Martin Storsjö" <martin at martin.st> wrote in message 
news:Pine.LNX.4.64.0607142016070.26398 at localhost.localdomain...
> On Fri, 14 Jul 2006, Michael Ryan Bannon wrote:
>
>> So, my question now is how does one get a reference to the window that 
>> SDL
>> creates?  Is there a method/technique that I missed (probably) or does it
>> have to be done somehow through Mac calls?
>
> I've retreived it using this code snippet:
>
> NSWindow *getMainWindow() {
>         NSWindow *window = [NSApp mainWindow];
>         if (window)
>                 return window;
>         NSArray *windows = [NSApp windows];
>         if ([windows count] > 0)
>                 return [windows objectAtIndex: 0];
>         return nil;
> }
>
>
> // Martin 







More information about the SDL mailing list