Added SetFPS() and SetWindowVSync()

This commit is contained in:
n00b
2024-12-20 20:40:10 -05:00
parent 8b8be85dea
commit 94a9bb08fb
15 changed files with 1754 additions and 1698 deletions

View File

@@ -314,14 +314,14 @@ bool rc_windowOpenEx(std::string title, int x, int y, int w, int h, uint32_t win
irr_creation_params.AntiAlias = AntiAlias;
irr_creation_params.OGLES2ShaderPath = ".shaders/";
rc_window_vsync = vsync;
rc_window_setfps = vsync;
if(vsync)
{
SDL_DisplayMode dm;
SDL_GetDesktopDisplayMode(0, &dm);
rc_vsync_refresh_rate = dm.refresh_rate;
rc_vsync_timer = SDL_GetTicks();
rc_setfps_refresh_rate = dm.refresh_rate;
rc_setfps_timer = SDL_GetTicks();
}
device = createDeviceEx(irr_creation_params);
@@ -2131,7 +2131,25 @@ void rc_setMouseRelative(bool flag)
void rc_setWindowVSync(bool flag)
{
//TODO
rc_window_setfps = true;
SDL_DisplayMode dm;
SDL_GetDesktopDisplayMode(0, &dm);
rc_setfps_refresh_rate = dm.refresh_rate;
rc_setfps_timer = SDL_GetTicks();
}
void rc_setFPS(int fps)
{
if(fps < 0)
{
rc_window_setfps = false;
}
else
{
rc_window_setfps = true;
rc_setfps_refresh_rate = fps;
rc_setfps_timer = SDL_GetTicks();
}
}
int rc_openURL(std::string url)