private void OnEvent(Event e) { var eventDispatcher = new EventDispatcher(e); eventDispatcher.Dispatch <WindowCloseEvent>(OnWindowClose); eventDispatcher.Dispatch <WindowResizeEvent>(OnWindowResize); eventDispatcher.Dispatch <AppLoadEvent>(OnLoad); eventDispatcher.Dispatch <AppUpdateEvent>(OnUpdate); eventDispatcher.Dispatch <AppRenderEvent>(OnRender); eventDispatcher.Dispatch <KeyPressedEvent>(OnKeyPressed); foreach (Layer layer in _layers.Reverse()) { if (e.Handled) { break; } layer.OnEvent(e); } }