Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Mac OS X: possible to access the ViewController?  (Read 2010 times)

0 Members and 1 Guest are viewing this topic.

capz

  • Newbie
  • *
  • Posts: 29
    • View Profile
Mac OS X: possible to access the ViewController?
« 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  :-\

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Mac OS X: possible to access the ViewController?
« Reply #1 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();
SFML / OS X developer