mdsteele / azimuth

A metroidvania with vector graphics
https://mdsteele.games/azimuth/
GNU General Public License v3.0
51 stars 15 forks source link

Switch to SDL timers #20

Closed genpfault closed 3 years ago

genpfault commented 3 years ago

This should remove the last major bit of platform-specific code.

Had to reduce az_sleep_until() to only millisecond-resolution due to using SDL_Delay() (mildly annoyed SDL doesn't have a SDL_Nanodelay()) but I wasn't seeing any animation smoothness issues on Linux, macOS, or Windows from doing so.

Also slightly modified az_sleep_until() to return az_current_time_nanos() which has the nice side-effect of making the system converge to a delay-less state (no SDL_Delay() calls, only 'long' vsync'd SDL_GL_SwapWindow() calls) in 20-30 frames. Vsync-off also still works.

mdsteele commented 3 years ago

Thanks again!