put a game loop and some event handling on it