You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In run() method search for "#ifdef EMSCRIPTEN" and add a similar section for iOS to prevent busy-wait gameloop from running:
// ADD:
#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
// On iPhone mainloop is called automatically by CADisplayLinkreturn;
#endif
#ifdef EMSCRIPTEN
/* if you build for Emscripten mainloop would be called automatically outside. see emscripten_set_main_loop below*/return;
#endif
In main() register DisplayLink callback, SDL already supports this:
#ifdef OXYGINE_SDL
#include"SDL_main.h"extern"C"
{
voidone(void *param) { mainloop(); }
intmain(int argc, char* argv[])
{
run();
#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
// If parameter 2 is set to 1, refresh rate will be 60 fps, 2 - 30 fps, 3 - 15 fps.SDL_iPhoneSetAnimationCallback(core::getWindow(), 1, one, nullptr);
#endifreturn0;
}
};
#endif