internal void _HandleEvent(ref SDL.SDL_Event evt) { switch (evt.type) { case SDL.SDL_EventType.SDL_MOUSEBUTTONDOWN: OnMouseButtonDown(new MouseButtonDownEventArgs(evt.button)); break; case SDL.SDL_EventType.SDL_KEYDOWN: OnKeyDown(new KeyDownEventArgs(evt.key)); break; case SDL.SDL_EventType.SDL_MOUSEMOTION: OnMouseMotion(new MouseMotionEventArgs(evt.motion)); break; case SDL.SDL_EventType.SDL_MOUSEWHEEL: OnMouseWheel(new MouseWheelEventArgs(evt.wheel)); break; case SDL.SDL_EventType.SDL_WINDOWEVENT: switch (evt.window.windowEvent) { case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_RESIZED: OnWindowResized(new WindowResizedEventArgs(evt.window)); break; case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_CLOSE: var args = new WindowClosingEventArgs(evt.window); OnWindowClosing(args); break; } break; } }
void OnWindowClosing(WindowClosingEventArgs args) { var handler = WindowClosing; if (handler != null) { handler(this, args); } if (!args.Cancel) { this.Destroy(); } }