Skip to content

Commit

Permalink
Platform: opt-in test for Sdl2Application::tickEvent().
Browse files Browse the repository at this point in the history
  • Loading branch information
mosra committed Oct 5, 2024
1 parent 734ddd0 commit f7cdd61
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Magnum/Platform/Test/Sdl2ApplicationTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#include "Magnum/ImageView.h"
#include "Magnum/Math/ConfigurationValue.h"
#include "Magnum/Math/Time.h"
#include "Magnum/Platform/Sdl2Application.h"
#include "Magnum/Trade/AbstractImporter.h"
#include "Magnum/Trade/ImageData.h"
Expand All @@ -46,6 +47,7 @@
#ifdef CORRADE_TARGET_CLANG_CL
#pragma clang diagnostic pop
#endif
#include <SDL_timer.h>

#ifdef MAGNUM_TARGET_GL
#include "Magnum/GL/DefaultFramebuffer.h"
Expand Down Expand Up @@ -174,6 +176,7 @@ Debug& operator<<(Debug& debug, const Application::KeyEvent::Key value) {
}

using namespace Containers::Literals;
using namespace Math::Literals;

struct Sdl2ApplicationTest: Platform::Application {
explicit Sdl2ApplicationTest(const Arguments& arguments);
Expand Down Expand Up @@ -319,6 +322,16 @@ struct Sdl2ApplicationTest: Platform::Application {
if(event.type == SDL_WINDOWEVENT) d << event.window.event;
}

/* Uncomment to test the tick event. It should run at given minimal loop
period even if not redrawing, it should not run at a different period
when redrawing constantly. */
#if 0
void tickEvent() override {
setMinimalLoopPeriod(250);
Debug{} << "tick event:" << Seconds{SDL_GetTicks()*1.0_msec};
}
#endif

private:
#ifdef CORRADE_TARGET_EMSCRIPTEN
bool _fullscreen = false;
Expand Down

0 comments on commit f7cdd61

Please sign in to comment.