Support getting current vsync status in app

This commit is contained in:
Nikita Lisitsa 2021-10-31 13:18:32 +03:00
parent 249ca33aab
commit 35de0993d2
2 changed files with 6 additions and 0 deletions

View file

@ -41,6 +41,7 @@ namespace psemek::app
std::unique_ptr<scene> pop_scene() override;
void show_cursor(bool show);
bool vsync() const;
void vsync(bool on);
float time() const;

View file

@ -274,6 +274,11 @@ namespace psemek::app
return std::chrono::duration_cast<std::chrono::duration<float>>(clock::now() - impl().start_time).count();
}
bool app::vsync() const
{
return SDL_GL_GetSwapInterval() != 0;
}
void app::vsync(bool on)
{
if (on)