I have a problem with the game I'm developing. My game code is pretty complex (I wrapped everything and made much use of OOP) and written in Ada instead of C/C++, so posting source code might not be that helpful (but I can post some if it helps). Instead, I think I'll explain what's going on that's related to SDL.
I can't remember which version of SDL I'm using and don't know how to check but Windows says 3/15/2014 as the created date. I tried updating to 2.0.5 but then it goes really slowly and finally freezes. (Is 2.0.5 heavier than older versions?)
My draw function is called whenever anything changes (positions of objects, frames of animations, etc). The algorithm is:
Draw stuff with a combination of SDL_SetTextureColorMod and SDL_RenderCopyEX
After calculating stuff and drawing, it will do an SDL_Delay of at least 2ms. Normally it delays by the period of the framerate (17ms) minus the elapsed time of the processing so it keeps a steady 60FPS.
There's also music and sound, using SDL_Mixer, as well as joystick and keyboard input.
The part I think the perpetrator is that loading/freeing resources is handled in a separate thread. The main game code specifies a group of resources to load/free next and the thread uses Mix_LoadMUS, Mix_FreeMusic, Mix_LoadWav, Mix_FreeChunk, SDL_CreateTextureFromSurface, SDL_LoadBMP, sometimes SDL_SetColorKey and SDL_DestroyTexture to manage resources.
I think this is responsible because it only happens sometimes (a red flag for threading problems) and if it does freeze, it's always when stuff is loading or being freed and the SDL_RenderPresent call happens before the call returns.
Thanks in advance for any help. I hope I gave enough information.