add gameloopthread class, split the game loop into two threads