Skip Navigation

How do I cap fps with SDL2 and gsync monitor?

I guess the question is straightforward. I'm creating a simple 2D game with a few animation and 30 or 60 fps are more than enough. I'd like to cap the fps to reduce power consumption on my laptop when testing my own game. I can manage that from the nvidia control panel, but I can do that from ingame code? I can see many games provide a fps cap option. How do they achieve that? Sleeping/calling Sdl_delay doesn't seem a great option and neither is active waiting while checking for passed time. Is there an hardware mechanism I can block to?

1
1 comments