pub struct Input { /* private fields */ }
Expand description
The main struct for the input system.
Accessed via basalt.input_ref()
.
Implementations
sourceimpl Input
impl Input
sourcepub fn hook(&self) -> InputHookBuilder<'_>
pub fn hook(&self) -> InputHookBuilder<'_>
Returns a builder to add a hook.
let hook_id = basalt
.input_ref()
.hook()
.bin(&bin)
.on_press()
.keys(Qwerty::W)
.call(move |_target, _global, local| {
assert!(local.is_pressed(Qwerty::W));
println!("Pressed W on Bin");
Default::default()
})
.finish()
.unwrap();
sourcepub fn remove_hook(&self, id: InputHookID)
pub fn remove_hook(&self, id: InputHookID)
Remove a hook from Input
.
Notes
- Hooks on a
Bin
orWindow
are automatically removed when they are dropped.
sourcepub fn set_bin_focused(&self, bin: &Arc<Bin>)
pub fn set_bin_focused(&self, bin: &Arc<Bin>)
Manually set the Bin
that is focused.
Useful for dialogs/forms that require text input.
sourcepub fn send_event(&self, event: InputEvent)
pub fn send_event(&self, event: InputEvent)
Send an InputEvent
to Input
.
Notes
- This method should only be used externally when using a custom window implementation.
Auto Trait Implementations
impl RefUnwindSafe for Input
impl Send for Input
impl Sync for Input
impl Unpin for Input
impl UnwindSafe for Input
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more