Hey everybody, I have a question about the SDL_GetTicks() function. I know that SDL_GetTicks() gives you the time since the program was started, but I want to make a timer that starts with a press on a button and when I release that button the timer resets. I tried and tried and tried but I just don’t understand how to to it. Thank you in advance.
Just store the GetTicks() when the button was pressed and you compare against this value when you want to check how much time passed (GetTicks() - storedTicks). For resetting you just update the stored value with the GetTicks() you read when the button released.
Hope this helps.
-Cass aka Acry