make background fps a setting checkbox

This commit is contained in:
T1ti
2024-04-29 21:43:01 +02:00
parent 9101c21cc9
commit ec855558a7
3 changed files with 44 additions and 1 deletions

View File

@@ -2816,7 +2816,7 @@ MapView::MapView( math::degrees camera_yaw0
return;
};
if (_main_window->isMinimized())
if (_main_window->isMinimized() && _settings->value("background_fps_limit", true).toBool())
{
_needs_redraw = false;
// return;
@@ -6075,6 +6075,10 @@ void MapView::ShowContextMenu(QPoint pos)
void MapView::onApplicationStateChanged(Qt::ApplicationState state)
{
// auto interval = _update_every_event_loop.interval();
if (!_settings->value("background_fps_limit", true).toBool())
return;
int fps_limit = _settings->value("fps_limit", 60).toInt();
int fps_calcul = (int)((1.f / (float)fps_limit) * 1000.f);

View File

@@ -189,6 +189,7 @@ namespace Noggit
ui->_vsync_cb->setChecked(_settings->value("vsync", false).toBool());
ui->_anti_aliasing_cb->setChecked(_settings->value("anti_aliasing", false).toBool());
ui->_fullscreen_cb->setChecked(_settings->value("fullscreen", false).toBool());
ui->_background_fps_limit_cb->setChecked(_settings->value("background_fps_limit", true).toBool());
ui->_adt_unload_dist->setValue(_settings->value("unload_dist", 5).toInt());
ui->_adt_unload_check_interval->setValue(_settings->value("unload_interval", 5).toInt());
ui->_uid_cb->setChecked(_settings->value("uid_startup_check", true).toBool());
@@ -273,6 +274,7 @@ namespace Noggit
_settings->setValue("vsync", ui->_vsync_cb->isChecked());
_settings->setValue("anti_aliasing", ui->_anti_aliasing_cb->isChecked());
_settings->setValue("fullscreen", ui->_fullscreen_cb->isChecked());
_settings->setValue("background_fps_limit", ui->_background_fps_limit_cb->isChecked());
_settings->setValue("unload_dist", ui->_adt_unload_dist->value());
_settings->setValue("unload_interval", ui->_adt_unload_check_interval->value());
_settings->setValue("uid_startup_check", ui->_uid_cb->isChecked());

View File

@@ -233,6 +233,43 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_14">
<item>
<widget class="QLabel" name="label_13">
<property name="toolTip">
<string>FPS will be halved when Noggit is not the active windows but still visible, FPS will be set to 1 when Noggit is minimized.</string>
</property>
<property name="text">
<string>Limit Background FPS</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_24">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="_background_fps_limit_cb">
<property name="text">
<string/>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>