> while (right == true)
Like has been said already.
If right is false, if never gets into the loop.
If right is true, it never gets out of the loop.
Roughly speaking (5 mins reading the manual), I would try
- SDL_AddTimer to set a timer.
- In the timer callback function, call SDL_PushEvent to send a 'user' event, which in this context will mean that time has elapsed.
Replace the while (right == true) with if (right == true)
You'll now be getting periodic stimulus of the event queue (through the timer).