From da0eedbf1733e40613215ecd117e1a4e049089ad Mon Sep 17 00:00:00 2001 From: Matt Kosarek Date: Thu, 19 Feb 2026 16:58:58 -0500 Subject: Removed photo gallery + added cute little grass rendering for the rabbit and a nice gradient background --- themes/src/main_loop.cpp | 48 +++++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 21 deletions(-) (limited to 'themes/src/main_loop.cpp') 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 #include -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(deltaTime) / 1000.f; + return true; + } + + long deltaTime = time - mainLoop->lastTime; + mainLoop->lastTime = time; + mainLoop->elapsedTime += deltaTime; + mainLoop->numFrames++; + float deltaTimeSeconds = static_cast(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; +} -- cgit v1.2.1