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

Author Topic: CVDisplayLink and CADisplay link for osx and ios  (Read 2543 times)

0 Members and 1 Guest are viewing this topic.

izackp

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
CVDisplayLink and CADisplay link for osx and ios
« on: August 25, 2014, 05:41:08 pm »
It would be nice if you didn't have to use a timer to run your game loop.

I tried modifying the source to give me the NSOpenGLView in order to set up the SVDisplayLink, but its been a huge pain since everything was designed to provide an os independent abstraction. I don't think its bad design to provide the developer with an OSXWindow in osx only objects, but, if you're completely against it, an option to set a VSYNC callback would be nice then again I don't think all OSs support that.

Anyways, I've decided to leave it be until a later time for my game.

Thanks for you time!
Meh Blog: iDevStudio

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: CVDisplayLink and CADisplay link for osx and ios
« Reply #1 on: August 25, 2014, 05:43:41 pm »
I tried modifying the source to give me the NSOpenGLView in order to set up the SVDisplayLink, but its been a huge pain since everything was designed to provide an os independent abstraction.
Yes, that's the whole point of a portable multimedia library ;)

Why do you need platform-specific access? What is the problem with sf::Clock?
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: CVDisplayLink and CADisplay link for osx and ios
« Reply #2 on: August 25, 2014, 06:09:27 pm »
I've no idea what you want to do but SFML already provide sf::Window::getSystemHandle which gives you either a NSWindow or a NSView and therefore access to the NSOpenGLView subview (on os x).
« Last Edit: August 25, 2014, 06:17:31 pm by Hiura »
SFML / OS X developer

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: CVDisplayLink and CADisplay link for osx and ios
« Reply #3 on: August 25, 2014, 06:11:48 pm »
On iOS, DisplayLink is the only way to implement v-sync. It is also mandatory to use the refresh callback (and let iOS run the main loop) to be compliant with the game center: SDL has an ugly hack that allows iOS developers to run their game loop like this instead of the manual game loop.

So yes, I guess it's an important topic, but don't expect it to be addressed soon, the iOS port has still not been released publicly ;)
Laurent Gomila - SFML developer

izackp

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: CVDisplayLink and CADisplay link for osx and ios
« Reply #4 on: August 25, 2014, 06:28:28 pm »
I've no idea what you want to do but SFML already provide sf::Window::getSystemHandle which gives you either a NSWindow or a NSView and therefore access to the NSOpenGLView subview (on os x).

I can't believe I missed that. Thanks lol.

I mostly want it in because its the 'right' way of doing things when it comes to OSX/iOS. I also have a bad feeling it's going to mess with my game's interpolation (http://www.danielborgmann.eu/2010/09/fixed-timestep-with-interpolation-part.html) on high hz monitors. It also helps me avoid hard coding in a 'refresh rate' for the screen (or doing extensive research on how to get/estimate the refresh rate).
Meh Blog: iDevStudio