Impelemented game loop with constant fps.