event module contains traits and structs to actually run your game mainloop
and handle top-level state, as well as handle input events such as keyboard
If you don’t want to use
ggez’s built in event loop, you can
write your own mainloop and check for events on your own. This is
not particularly hard, there’s nothing special about the
EventHandler trait. It just tries to simplify the process a
little. For examples of how to write your own main loop, see the
source code for this module, or the
pub use crate::input::gamepad::GamepadId;
winitevents; nested in a module for re-export neatness.
winitevent loop. Provides a way to retrieve events from the system and from the windows that were registered to the events loop.
- An analog axis of some device (gamepad thumbstick, joystick…). Gamepad’s elements which state can be represented by value from -1.0 to 1.0.
- A button of some device (gamepad, joystick…). Gamepad’s elements which state can be represented by value from 0.0 to 1.0.
winitevent loop. Set by the user callback given to the
- Used in
EventHandler::on_error()to specify where an error originated
- A mouse button. Describes a button of a mouse controller.
- Feeds an
Contextso it can update any internal state it needs to, such as detecting window resizes. If you are rolling your own event loop, you should call this on the events you receive before processing them yourself.
- Runs the game’s main loop, calling event callbacks on the given state object as events occur.
- A mouse button. Hardware-dependent keyboard scan code.