got the game loop working using a thread