SaveTool: remove the FPS cap implementation.
I should port the code from my raycaster engine to here.
This commit is contained in:
parent
c5b4747685
commit
df5fa7a39e
4 changed files with 7 additions and 35 deletions
|
@ -136,10 +136,6 @@ SaveTool::SaveTool(const Arguments& arguments):
|
|||
case Framelimit::HalfVsync:
|
||||
setSwapInterval(2);
|
||||
break;
|
||||
case Framelimit::FpsCap:
|
||||
setSwapInterval(0);
|
||||
setMinimalLoopPeriod(1000/_fpsCap);
|
||||
break;
|
||||
}
|
||||
|
||||
curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||
|
@ -184,9 +180,8 @@ SaveTool::~SaveTool() {
|
|||
case Framelimit::HalfVsync:
|
||||
_conf.setValue("frame_limit"_s, "half_vsync"_s);
|
||||
break;
|
||||
case Framelimit::FpsCap:
|
||||
_conf.setValue<UnsignedInt>("frame_limit"_s, _fpsCap);
|
||||
break;
|
||||
default:
|
||||
_conf.setValue("frame_limit"_s, "vsync"_s);
|
||||
}
|
||||
|
||||
_conf.save();
|
||||
|
|
|
@ -262,10 +262,8 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener
|
|||
|
||||
enum class Framelimit: UnsignedByte {
|
||||
Vsync,
|
||||
HalfVsync,
|
||||
FpsCap
|
||||
HalfVsync
|
||||
} _framelimit{Framelimit::Vsync};
|
||||
UnsignedInt _fpsCap{60};
|
||||
|
||||
bool _skipDisclaimer{false};
|
||||
bool _checkUpdatesOnStartup{true};
|
||||
|
|
|
@ -73,15 +73,11 @@ void SaveTool::initialiseConfiguration() {
|
|||
|
||||
if(_conf.hasValue("frame_limit"_s)) {
|
||||
std::string frame_limit = _conf.value("frame_limit"_s);
|
||||
if(frame_limit == "vsync"_s) {
|
||||
_framelimit = Framelimit::Vsync;
|
||||
}
|
||||
else if(frame_limit == "half_vsync"_s) {
|
||||
if(frame_limit == "half_vsync"_s) {
|
||||
_framelimit = Framelimit::HalfVsync;
|
||||
}
|
||||
else {
|
||||
_framelimit = Framelimit::FpsCap;
|
||||
_fpsCap = std::stoul(frame_limit);
|
||||
_framelimit = Framelimit::Vsync;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -58,11 +58,10 @@ void SaveTool::drawMainMenu() {
|
|||
drawAlignedText("Frame limiter:");
|
||||
ImGui::SameLine();
|
||||
|
||||
static const char* framelimit_labels[3] = {
|
||||
static auto selection = static_cast<UnsignedByte>(_framelimit);
|
||||
static const char* framelimit_labels[2] = {
|
||||
"V-sync",
|
||||
"Half V-sync",
|
||||
"FPS cap, no V-sync"
|
||||
"Half V-sync"
|
||||
};
|
||||
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvailWidth());
|
||||
|
@ -77,26 +76,10 @@ void SaveTool::drawMainMenu() {
|
|||
_framelimit = Framelimit::HalfVsync;
|
||||
setSwapInterval(2);
|
||||
}
|
||||
if(ImGui::Selectable(framelimit_labels[2], _framelimit == Framelimit::FpsCap)) {
|
||||
selection = 2;
|
||||
_framelimit = Framelimit::FpsCap;
|
||||
setSwapInterval(0);
|
||||
setMinimalLoopPeriod(1000 / _fpsCap);
|
||||
}
|
||||
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
if(_framelimit == Framelimit::FpsCap) {
|
||||
static constexpr UnsignedInt min_fps = 15;
|
||||
static constexpr UnsignedInt max_fps = 150;
|
||||
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvailWidth());
|
||||
if(ImGui::SliderScalar("##FpsSlider", ImGuiDataType_U32, &_fpsCap, &min_fps, &max_fps, "%u FPS", ImGuiSliderFlags_AlwaysClamp)) {
|
||||
setMinimalLoopPeriod(1000 / _fpsCap);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::Checkbox("Cheat mode", &_cheatMode);
|
||||
ImGui::SameLine();
|
||||
ImGui::AlignTextToFramePadding();
|
||||
|
|
Loading…
Reference in a new issue