private void PollEvents() { while (SDL.SDL_PollEvent(out SDL.SDL_Event evt) != 0) { switch (evt.type) { case SDL.SDL_EventType.SDL_QUIT: state = State.Quit; break; case SDL.SDL_EventType.SDL_KEYUP: HandleInputs(); break; case SDL.SDL_EventType.SDL_KEYDOWN: switch (evt.key.keysym.sym) { case SDL.SDL_Keycode.SDLK_q: case SDL.SDL_Keycode.SDLK_ESCAPE: state = State.Quit; break; case SDL.SDL_Keycode.SDLK_n: Step(); break; case SDL.SDL_Keycode.SDLK_SPACE: state = state == State.Stop ? State.Running : State.Stop; break; case SDL.SDL_Keycode.SDLK_p: printDebug = !printDebug; break; case SDL.SDL_Keycode.SDLK_b: state = State.SetBreakpoint; PrintDebugger(); break; case SDL.SDL_Keycode.SDLK_m: state = State.SetMemoryRead; PrintDebugger(); break; case SDL.SDL_Keycode.SDLK_1: ppu.PrintBackgroundTileNumbers(); break; case SDL.SDL_Keycode.SDLK_2: ppu.PrintBackgroundTileAddresses(); break; default: HandleInputs(); break; } break; } } }