Function bevy_ui_navigation::systems::generic_default_mouse_input
source · [−]pub fn generic_default_mouse_input<T: ScreenSize + Component, M: Component>(
input_mapping: Res<'_, InputMapping>,
windows: Res<'_, Windows>,
mouse: Res<'_, Input<MouseButton>>,
touch: Res<'_, Touches>,
focusables: NodePosQuery<'_, '_, T, M>,
focused: Query<'_, '_, Entity, With<Focused>>,
nav_cmds: EventWriter<'_, '_, NavRequest>,
last_pos: Local<'_, Vec2>
)
Expand description
A generic system to send mouse control events to the focus system
T
must be a component assigned to Focusable
elements that implements
the ScreenSize
trait. M
is simply a marker component for your camera
entity, if no entities has the M
component, we assume the screen space
is not offset from the GlobalTransform
of focusable elements.
Which button to press to cause an action event is specified in the
InputMapping
resource.
You may however need to customize the behavior of this system (typically
when integrating in the game) in this case, you should write your own
system that sends NavRequest
events. You may use
ui_focusable_at
to tell which focusable is currently being hovered.