I'm working with SDL on Switch and I can't seem to get SDL Timers to work.
When the equivalent code is compiled for PC, the timer works perfectly
my_callbackfunc() should be called every second, but it doesn't even get called once when running on Switch. But when doing the same thing for PC, the timer works fine.
Is there an extra step that needs to be done for Switch SDL timers or is the SDL library buggy?
Thanks
When the equivalent code is compiled for PC, the timer works perfectly
Code:
int testNumber = 0;
Uint32 my_callbackfunc(Uint32 interval, void *param)
{
TRACE("The timer has now called this function");
testNumber++;
return(interval);
}
int main(int argc, char* argv[])
{
SDL_Init(SDL_INIT_TIMER);
SDL_TimerID timer = SDL_AddTimer(1000,my_callbackfunc,NULL);
// Set mesa configuration (useful for debugging)
setMesaConfig();
// Initialize EGL on the default window
if (!initEgl(nwindowGetDefault()))
return EXIT_FAILURE;
// Load OpenGL routines using glad
gladLoadGL();
// Initialize our scene
sceneInit();
// Main graphics loop
while (appletMainLoop())
{
TRACE("%d",narmba);
// Get and process input
hidScanInput();
u32 kDown = hidKeysDown(CONTROLLER_P1_AUTO);
if (kDown & KEY_PLUS)
break;
// Render stuff!
sceneRender();
eglSwapBuffers(s_display, s_surface);
}
// Deinitialize our scene
sceneExit();
// Deinitialize EGL
deinitEgl();
return EXIT_SUCCESS;
}
my_callbackfunc() should be called every second, but it doesn't even get called once when running on Switch. But when doing the same thing for PC, the timer works fine.
Is there an extra step that needs to be done for Switch SDL timers or is the SDL library buggy?
Thanks