Tip: When using SDL everything is measured in ms, NOT seconds, hence why I used ms in my explanation. When calculating deltaTime you would do something like:
Uint32 getDeltaTime()
{
Uint32 deltaTime = SDL_GetTicks() - previousFrameTime;
previousFrameTime = SDL_GetTicks();
return deltaTime;
}
This would return 1000 if the time between each frame is 1sec. Doing position += velocity * getDeltaTime() will scale your velocity by 1000 if you defined your velocity as pps. You must either define your velocity as ppms (pixels per milliseconds) or divide deltaTime by 1000:
Uint32 getDeltaTime()
{
Uint32 deltaTime = SDL_GetTicks() - previousFrameTime;
previousFrameTime = SDL_GetTicks();
return deltaTime / 1000; //Seconds instead of milliseconds
}
Division is an expensive operation you might say, but considering the circumstances its a piss in the ocean (as we say in sweden, instead of "it doesn't matter"). Dividing by 1000 once every frame isn't gonna cause your game to meltdown. New game programmers tend to prematurely optimize everything, including myself, and it's easy to think dividing by 1000 every single frame is bad code. It isn't.