basic event handling and game loop structure.