Event Handling - JayhawkZombie/EECS581Project GitHub Wiki

Event Handling


How to properly react to events

There are different kinds of events, and different ways in which those should be handled.

User Events

User events are considered to be any event that would reasonably be initiated by a user. Those include MousePress, MouseRelease, KeyboardPress, KeyboardRelease, MouseMovement, and MouseScrolled. Touch events are also included in this.
See Reacting to User Events for more details on User Events.

Window resizing is almost always initiated by the user, but the logical response to those are very different. You wouldn't very well move your actor if the window got resized. As such, Levels have a specific function that can be overridden to handle this: HandleWindowResized

You can override this function to react appropriately to window resizing, be it changing the view, or whatever.

OS Events

These include losing focus of the window, the window being closed, etc.
Generally speaking, the level need not worry about these events incoming and reacting to them.
The level is never informed of the window being closed. Rather, the engine just shuts down and the level is exited as normal.