A game loop modified from deWiTTERS' game loop.