aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-07-26 17:45:10 +0200
committerdec05eba <dec05eba@protonmail.com>2021-07-26 17:45:10 +0200
commit2394584d9e2916d8a5bdd95ff9f01eccfde1da44 (patch)
tree7ef999ea13a2b9cee9367dfc9e5ed2cd9e1f87fe /src
parenta6bba48faa091932b5a51a3beb8c9d162c377adf (diff)
Limit matrix tasks to 10 per frame to limit lag
Diffstat (limited to 'src')
-rw-r--r--src/plugins/Matrix.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index b0ff9b8..2689d14 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -4412,9 +4412,12 @@ namespace QuickMedia {
}
void Matrix::update() {
+ sf::Clock timer;
std::optional<std::function<void()>> task;
- while((task = ui_thread_tasks.pop_if_available()) != std::nullopt) {
+ int i = 0;
+ while((task = ui_thread_tasks.pop_if_available()) != std::nullopt && i < 10) {
task.value()();
+ ++i;
}
}