Struct amethyst_input::InputHandler [−][src]
pub struct InputHandler<AX, AC> where
AX: Hash + Eq,
AC: Hash + Eq, { pub bindings: Bindings<AX, AC>, // some fields omitted }
This struct holds state information about input devices.
For example, if a key is pressed on the keyboard, this struct will record that the key is pressed until it is released again.
Fields
bindings: Bindings<AX, AC>
Maps inputs to actions and axes.
Methods
impl<AX, AC> InputHandler<AX, AC> where
AX: Hash + Eq,
AC: Hash + Eq,
[src]
impl<AX, AC> InputHandler<AX, AC> where
AX: Hash + Eq,
AC: Hash + Eq,
impl<AX, AC> InputHandler<AX, AC> where
AX: Hash + Eq + Clone + Send + Sync + 'static,
AC: Hash + Eq + Clone + Send + Sync + 'static,
[src]
impl<AX, AC> InputHandler<AX, AC> where
AX: Hash + Eq + Clone + Send + Sync + 'static,
AC: Hash + Eq + Clone + Send + Sync + 'static,
pub fn send_event(
&mut self,
event: &Event,
event_handler: &mut EventChannel<InputEvent<AC>>
)
[src]
pub fn send_event(
&mut self,
event: &Event,
event_handler: &mut EventChannel<InputEvent<AC>>
)
Updates the input handler with a new engine event.
The Amethyst game engine will automatically call this if the InputHandler is attached to the world as a resource with id 0.
pub fn send_controller_event(
&mut self,
event: &ControllerEvent,
event_handler: &mut EventChannel<InputEvent<AC>>
)
[src]
pub fn send_controller_event(
&mut self,
event: &ControllerEvent,
event_handler: &mut EventChannel<InputEvent<AC>>
)
Updates the input handler with a new controller event.
Called internally from SdlEventsSystem when using sdl_controller feature. You should invoke it in your system if you provide your own controller input implementation.
pub fn keys_that_are_down(
&self
) -> impl Iterator<Item = VirtualKeyCode> + '_
[src]
pub fn keys_that_are_down(
&self
) -> impl Iterator<Item = VirtualKeyCode> + '_
Returns an iterator over all keys that are down.
pub fn key_is_down(&self, key: VirtualKeyCode) -> bool
[src]
pub fn key_is_down(&self, key: VirtualKeyCode) -> bool
Checks if a key is down.
Returns an iterator over all pressed mouse buttons
Checks if a mouse button is down.
pub fn scan_codes_that_are_down(
&self
) -> impl Iterator<Item = u32> + '_
[src]
pub fn scan_codes_that_are_down(
&self
) -> impl Iterator<Item = u32> + '_
Returns an iterator over all pressed scan codes
pub fn scan_code_is_down(&self, scan_code: u32) -> bool
[src]
pub fn scan_code_is_down(&self, scan_code: u32) -> bool
Checks if the key corresponding to a scan code is down.
Returns an iterator over all pressed controller buttons on all controllers.
Checks if a controller button is down on specific controller.
pub fn connected_controllers(
&self
) -> impl Iterator<Item = u32> + '_
[src]
pub fn connected_controllers(
&self
) -> impl Iterator<Item = u32> + '_
List controller ids of all currently connected controllers. IDs are assigned sequentially in the order of connection starting from 0, always taking the lowest next free number.
pub fn is_controller_connected(&self, controller_id: u32) -> bool
[src]
pub fn is_controller_connected(&self, controller_id: u32) -> bool
pub fn mouse_position(&self) -> Option<(f64, f64)>
[src]
pub fn mouse_position(&self) -> Option<(f64, f64)>
Gets the current mouse position.
this method can return None, either if no mouse is connected, or if no mouse events have been recorded
Returns an iterator over all buttons that are down.
Checks if a button is down.
pub fn axis_value<T: Hash + Eq + ?Sized>(&self, id: &T) -> Option<f64> where
AX: Borrow<T>,
[src]
pub fn axis_value<T: Hash + Eq + ?Sized>(&self, id: &T) -> Option<f64> where
AX: Borrow<T>,
Returns the value of an axis by the string id, if the id doesn't exist this returns None.
pub fn action_is_down<T: Hash + Eq + ?Sized>(&self, action: &T) -> Option<bool> where
AC: Borrow<T>,
[src]
pub fn action_is_down<T: Hash + Eq + ?Sized>(&self, action: &T) -> Option<bool> where
AC: Borrow<T>,
Returns true if any of the action keys are down.
Trait Implementations
Auto Trait Implementations
impl<AX, AC> Send for InputHandler<AX, AC> where
AC: Send,
AX: Send,
impl<AX, AC> Send for InputHandler<AX, AC> where
AC: Send,
AX: Send,
impl<AX, AC> Sync for InputHandler<AX, AC> where
AC: Sync,
AX: Sync,
impl<AX, AC> Sync for InputHandler<AX, AC> where
AC: Sync,
AX: Sync,