aboutsummaryrefslogtreecommitdiff
path: root/src/libui_sdl
diff options
context:
space:
mode:
authorStapleButter <thetotalworm@gmail.com>2018-12-15 00:38:35 +0100
committerGitHub <noreply@github.com>2018-12-15 00:38:35 +0100
commit7fb1c0518cf95a7c92cf83de8bb63593bee40766 (patch)
tree37ded70e14f29e713f19507c579e39287793ba2a /src/libui_sdl
parent0b0dd82968c490627a4c962f9e169e4f7e9bba3e (diff)
parent78c767b69352c8103738adac7159914bad666d31 (diff)
Merge pull request #285 from abcdjdj/limit_fps
Add option to limit framerate from UI
Diffstat (limited to 'src/libui_sdl')
-rw-r--r--src/libui_sdl/main.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp
index b30c81b..ee6b80d 100644
--- a/src/libui_sdl/main.cpp
+++ b/src/libui_sdl/main.cpp
@@ -404,7 +404,6 @@ int EmuThreadFunc(void* burp)
u32 lasttick = starttick;
u32 lastmeasuretick = lasttick;
u32 fpslimitcount = 0;
- bool limitfps = true;
char melontitle[100];
while (EmuRunning != 0)
@@ -516,7 +515,7 @@ int EmuThreadFunc(void* burp)
lasttick = curtick;
u32 wantedtick = starttick + (u32)((float)fpslimitcount * framerate);
- if (curtick < wantedtick && limitfps)
+ if (curtick < wantedtick && Config::LimitFPS)
{
SDL_Delay(wantedtick - curtick);
}
@@ -1533,6 +1532,12 @@ void OnSetScreenFiltering(uiMenuItem* item, uiWindow* window, void* blarg)
else Config::ScreenFilter = 0;
}
+void OnSetLimitFPS(uiMenuItem* item, uiWindow* window, void* blarg)
+{
+ int chk = uiMenuItemChecked(item);
+ if (chk != 0) Config::LimitFPS = true;
+ else Config::LimitFPS = false;
+}
void ApplyNewSettings()
{
@@ -1765,6 +1770,10 @@ int main(int argc, char** argv)
uiMenuItemOnClicked(menuitem, OnSetScreenFiltering, NULL);
uiMenuItemSetChecked(menuitem, Config::ScreenFilter==1);
+ menuitem = uiMenuAppendCheckItem(menu, "Limit framerate");
+ uiMenuItemOnClicked(menuitem, OnSetLimitFPS, NULL);
+ uiMenuItemSetChecked(menuitem, Config::LimitFPS==1);
+
int w = Config::WindowWidth;
int h = Config::WindowHeight;