summaryrefslogtreecommitdiff
path: root/themes/src/main_loop.cpp
diff options
context:
space:
mode:
authorMatt Kosarek <matt.kosarek@canonical.com>2026-02-19 16:58:58 -0500
committerMatt Kosarek <matt.kosarek@canonical.com>2026-02-19 16:58:58 -0500
commitda0eedbf1733e40613215ecd117e1a4e049089ad (patch)
treed83d5dc63b50efbd45084d692ae037cbe0f02b25 /themes/src/main_loop.cpp
parent4d1beea73810af4641d074f974ad9c196a7e8d6e (diff)
Removed photo gallery + added cute little grass rendering for the rabbit and a nice gradient backgroundHEADmaster
Diffstat (limited to 'themes/src/main_loop.cpp')
-rw-r--r--themes/src/main_loop.cpp48
1 files changed, 27 insertions, 21 deletions
diff --git a/themes/src/main_loop.cpp b/themes/src/main_loop.cpp
index e5397ca..743892e 100644
--- a/themes/src/main_loop.cpp
+++ b/themes/src/main_loop.cpp
@@ -2,30 +2,36 @@
#include <cstdio>
#include <cstdlib>
-EM_BOOL loop(double time, void* loop) {
- MainLoop* mainLoop = (MainLoop*) loop;
- if (!mainLoop->isRunning) {
- return false;
- }
-
- if (mainLoop->lastTime == 0) {
- mainLoop->lastTime = time;
- return true;
- }
+EM_BOOL loop(double time, void *loop) {
+ MainLoop *mainLoop = (MainLoop *)loop;
+ if (!mainLoop->isRunning) {
+ return false;
+ }
- long deltaTime = time - mainLoop->lastTime;
+ if (mainLoop->lastTime == 0) {
mainLoop->lastTime = time;
- mainLoop->elapsedTime += deltaTime;
- mainLoop->numFrames++;
- float deltaTimeSeconds = static_cast<float>(deltaTime) / 1000.f;
+ return true;
+ }
+
+ long deltaTime = time - mainLoop->lastTime;
+ mainLoop->lastTime = time;
+ mainLoop->elapsedTime += deltaTime;
+ mainLoop->numFrames++;
+ float deltaTimeSeconds = static_cast<float>(deltaTime) / 1000.f;
- if (mainLoop->elapsedTime >= 1000.0) {
- printf("FPS: %d\n", mainLoop->numFrames);
+ if (mainLoop->elapsedTime >= 1000.0) {
+ printf("FPS: %d\n", mainLoop->numFrames);
- mainLoop->elapsedTime = 0.0;
- mainLoop->numFrames = 0;
- }
+ mainLoop->elapsedTime = 0.0;
+ mainLoop->numFrames = 0;
+ }
- mainLoop->updateFunc(deltaTimeSeconds, NULL);
+ // Ignore any update with a greater than 0.1 change. We were
+ // probably tabbed away, so this is uninteresting to us.
+ if (deltaTimeSeconds > 0.1) {
return true;
-} \ No newline at end of file
+ }
+
+ mainLoop->updateFunc(deltaTimeSeconds, NULL);
+ return true;
+}