SFML community forums

Help => General => Topic started by: capz on May 23, 2012, 01:21:04 am

Title: Mac OS X: possible to access the ViewController?
Post by: capz on May 23, 2012, 01:21:04 am
to elaborate on the topic title:

I am working on a game with SFML2 (fairly recent version) and I need access to a ViewController object.
Needless to say, SFML hides a lot of things from the user. I don't really even know if the OS X port even uses a View (likely does), or a ViewController (no clue), or if it would be possible to add a ViewController so that the API that I'm using can show/hide some dialogs to appear over the game.

I have no idea who to ask, but I sure hope that this is somehow possible  :-\
Title: Re: Mac OS X: possible to access the ViewController?
Post by: Hiura on May 23, 2012, 10:01:10 am
SFML2 doesn't use any NSViewController/NSWindowController. However,  you can get the underlying NSView/NSWindow with sf::Window::getSystemHandle().

sf::[Render]Window sfwin(...);
NSWindow* nswin = sfwin.getSystemHandle(); // will return a NSWindow*

If you create your SFML area inside a NSView/NSWindow (see Cocoa example) you can also get its underlying NSView/NSWindow.
sf::[Render]Window sfwin(nshandle);
NS[View|Window]* nshandle = sfwin.getSystemHandle();