forked from Green-Sky/tomato
add fps reduced mode
This commit is contained in:
parent
845967cf12
commit
a0ba0b39d8
2
external/solanaceae_toxcore
vendored
2
external/solanaceae_toxcore
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 54084b5a53e1617ff9b0c225880b0f1d60fe65ea
|
Subproject commit 08b3d69c159ca93aaaf38b6ee06507aa0eefd403
|
@ -119,6 +119,24 @@ bool MainScreen::handleEvent(SDL_Event& e) {
|
|||||||
return true; // forward?
|
return true; // forward?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
_fps_perf_mode <= 1 && (
|
||||||
|
e.type == SDL_EVENT_MOUSE_MOTION ||
|
||||||
|
e.type == SDL_EVENT_MOUSE_WHEEL ||
|
||||||
|
e.type == SDL_EVENT_MOUSE_BUTTON_DOWN ||
|
||||||
|
e.type == SDL_EVENT_MOUSE_BUTTON_UP ||
|
||||||
|
e.type == SDL_EVENT_TEXT_INPUT ||
|
||||||
|
e.type == SDL_EVENT_KEY_DOWN ||
|
||||||
|
e.type == SDL_EVENT_KEY_UP ||
|
||||||
|
e.type == SDL_EVENT_WINDOW_MOUSE_ENTER ||
|
||||||
|
e.type == SDL_EVENT_WINDOW_MOUSE_LEAVE ||
|
||||||
|
e.type == SDL_EVENT_WINDOW_FOCUS_GAINED ||
|
||||||
|
e.type == SDL_EVENT_WINDOW_FOCUS_LOST
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
_render_interval = 1.f/60.f; // TODO: magic
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,7 +180,7 @@ Screen* MainScreen::render(float time_delta, bool& quit) {
|
|||||||
// ImGui::Separator(); // why do we not need this????
|
// ImGui::Separator(); // why do we not need this????
|
||||||
if (ImGui::BeginMenu("Performance")) {
|
if (ImGui::BeginMenu("Performance")) {
|
||||||
{ // fps
|
{ // fps
|
||||||
const auto targets = "normal\0power save\0";
|
const auto targets = "normal\0reduced\0powersave\0";
|
||||||
ImGui::SetNextItemWidth(ImGui::GetFontSize()*10);
|
ImGui::SetNextItemWidth(ImGui::GetFontSize()*10);
|
||||||
ImGui::Combo("fps mode", &_fps_perf_mode, targets, 4);
|
ImGui::Combo("fps mode", &_fps_perf_mode, targets, 4);
|
||||||
}
|
}
|
||||||
@ -189,7 +207,7 @@ Screen* MainScreen::render(float time_delta, bool& quit) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
_fps_perf_mode == 1 || // TODO: magic
|
_fps_perf_mode >= 1 || // TODO: magic
|
||||||
_window_hidden
|
_window_hidden
|
||||||
) {
|
) {
|
||||||
_render_interval = 1.f/4.f;
|
_render_interval = 1.f/4.f;
|
||||||
|
Loading…
Reference in New Issue
Block a user