Module ggez::event [] [src]

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 do this, you can write your own mainloop and get the necessary event machinery by calling context.sdl_context.event_pump() on your Context. You can then call whatever SDL event methods you want on that. This is not particularly elegant and is not guarenteed to be stable (if, for instance, we someday get rid of SDL2), but trying to wrap it up more conveniently really ends up with the exact same interface. See issue https://github.com/ggez/ggez/issues/117 for discussion.

Structs

Mod
MouseState

Enums

Axis
Button
Keycode
MouseButton

Traits

EventHandler

A trait defining event callbacks; your primary interface with ggez's event loop. Have a type implement this trait and override at least the update() and draw() methods, then pass it to event::run() to run the game's mainloop.

Functions

run

Runs the game's main loop, calling event callbacks on the given state object as events occur.