Improve game loop.

Instead of a busy loop that eats all of the CPU, sleep in-between frames when possible.