Module ggez::event [−][src]
Expand description
The 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
and mouse.
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 eventloop
example.
Re-exports
Modules
winit
events; nested in a module for re-export neatness.
Structs
winit
event loop.
Enums
An analog axis of some device (gamepad thumbstick, joystick…).
A button of some device (gamepad, joystick…).
winit
event loop.
Used in EventHandler::on_error()
to specify where an error originated
Symbolic name for a keyboard key.
A mouse button.
Traits
A trait defining event callbacks. This is your primary interface with
ggez
’s event loop. Implement this trait for a type and
override at least the update()
and
draw()
methods, then pass it to
event::run()
to run the game’s mainloop.
Functions
Feeds an Event
into the Context
so 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.
Terminates the ggez::event::run()
loop by setting
Context.continuing
to false
.
Runs the game’s main loop, calling event callbacks on the given state object as events occur.