Module conrod::backend::event
[−]
[src]
The backend for conrod's event system.
Conrod's event system looks like this:
RawEvent -> Ui -> UiEvent -> Widget
The Ui receives RawEvents such as Press
and Release
via the Ui::handle_event
method. It interprets these RawEvents to create higher-level UiEvents such as
DoubleClick
, WidgetCapturesKeyboard
, etc. These UiEvents are stored and then fed to
each Widget when Ui::set_widgets
is called. At the end of Ui::set_widgets
the stored
UiEvents are flushed ready for the next incoming RawEvents.
Conrod uses the pistoncore-input
crate's Event
type as the RawEvent
type. There are a few reasons for this:
- This
Event
type already provides a number of useful variants of events that we wish to provide and handle within conrod, and we do not yet see any great need to re-write it and duplicate code. - The
Event
type is already compatible with allpistoncore-window
backends includingglfw_window
,sdl2_window
andglutin_window
. - The
pistoncore-input
crate also provides aGenericEvent
trait which allows us to easily provide a blanket implementation ofToRawEvent
for all event types that already implement this trait.
Because we use the pistoncore-input
Event
type, we also re-export its associated data
types (Button
, ControllerAxisArgs
, Key
, etc).
The ToRawEvent trait should be implemented for event types that
are to be passed to the Ui::handle_event
method. As mentioned above, a blanket implementation
is already provided for all types that implement pistoncore-input::GenericEvent
, so users of
glfw_window
, sdl2_window
and glutin_window
need not concern themselves with this trait.
Modules
keyboard |
Back-end agnostic keyboard keys. |
Structs
ControllerAxisArgs |
Components of a controller axis move event. Not guaranteed consistent across backends. |
ControllerButton |
Components of a controller button event. Not guaranteed consistent across backends. |
ModifierKey |
Enums
Button |
Models different kinds of buttons. |
Event |
Adds render and update events to input events |
Input |
Models input events. |
Key |
Represent a keyboard key. Keycodes follows SDL http://wiki.libsdl.org/SDLKeycodeLookup |
Motion |
Models different kinds of motion. |
MouseButton |
Represent a mouse button. |
Traits
ToRawEvent |
Types that may be converted to the |
Type Definitions
RawEvent |
The event type that is used by conrod to track inputs from the world. This can be thought of as
the event type which is supplied by the window backend to drive the state of the |