Since you’re using the main-callbacks functionality in SDL3, you might want to consider setting the callback rate of SDL_AppIterate, instead of doing manual frame limiting.
Code example:
SDL_AppResult SDL_AppInit(void** appState, int argc, char* argv)
{
if(!SDL_Init(SDL_INIT_VIDEO))
return SDL_AppResult::SDL_APP_FAILURE;
SDL_Window* window = nullptr;
SDL_Renderer* renderer = nullptr;
if(!SDL_CreateWindowAndRenderer("Window", WINDOW_WIDTH, WINDOW_HEIGHT, SDL_WINDOW_HIDDEN, &window, &renderer))
return SDL_AppResult::SDL_APP_FAILURE;
/**
* "0" = SDL_AppIterate will be called as often as possible
* "30" = SDL_AppIterate will be called 30 times per seconds (30 FPS)
* "60" = SDL_AppIterate will be called 60 times per seconds (60 FPS)
* "120" = SDL_AppIterate will be called 120 times per seconds (120 FPS)
* Other integer values, in quotes
* "59.94" = SDL doesn't round values, so 59.94 will be respected and used
* "waitevent" = SDL_AppIterate will not be called until new event(s) have arrived (and been processed by SDL_AppEvent)
*/
if(!SDL_SetHint(SDL_HINT_MAIN_CALLBACK_RATE, "0"))
return SDL_AppResult::SDL_APP_FAILURE;
return SDL_APP_CONTINUE;
}