Struct riddle_input::InputSystemHandle[][src]

pub struct InputSystemHandle { /* fields omitted */ }

Implementations

impl InputSystemHandle[src]

pub fn downgrade(this: &InputSystemHandle) -> InputSystemWeak[src]

Downgrade this handle to a weak handle

pub fn eq(a: &InputSystemHandle, b: &InputSystemHandle) -> bool[src]

Test whether two handles point to the same location in memory

Methods from Deref<Target = InputSystem>

pub fn mouse_pos(&self, window: WindowId) -> LogicalPosition[src]

Query the cursor position with respect to a given window.

If no mouse position infomation is available for the given window, the position will be (0,0)

Example

// The initial mouse position is (0,0)
assert_eq!(LogicalPosition{ x: 0, y: 0}, input_system.mouse_pos(window));

// The platform system emits cursor move events
// [..]

// The reported mouse position has changed
assert_ne!(LogicalPosition{ x: 0, y: 0}, input_system.mouse_pos(window));

pub fn is_mouse_button_down(
    &self,
    window: WindowId,
    button: MouseButton
) -> bool
[src]

Check if the specified mouse button is down with respect to a given window.

If there is no state recorded for the mouse for the given window the result will be false

Example

// The initial mouse position is (0,0)
assert_eq!(false, input_system.is_mouse_button_down(window, MouseButton::Left));

// The platform system emits cursor move events
// [..]

// The reported mouse position has changed
assert_eq!(true, input_system.is_mouse_button_down(window, MouseButton::Left));

pub fn is_key_down(&self, window: WindowId, scancode: Scancode) -> bool[src]

Query the keyboard scancode state with respect to a given window. See Scancode for details on what a scancode represents.

If no keyboard infomation is available for the given window, the button will be considered to not be down.

Example

// The initial key state is that the button is unpressed
assert_eq!(false, input_system.is_key_down(window, Scancode::Escape));

// The platform system emits key press event
// [..]

// The reported key state has changed
assert_eq!(true, input_system.is_key_down(window, Scancode::Escape));

pub fn is_vkey_down(&self, window: WindowId, vkey: VirtualKey) -> bool[src]

Query the keyboard virtual key state with respect to a given window. See VirtualKey for details on what a virtual key represents.

If no keyboard infomation is available for the given window, the button will be considered to not be down.

Example

// The initial key state is that the button is unpressed
assert_eq!(false, input_system.is_vkey_down(window, VirtualKey::Escape));

// The platform system emits key press event
// [..]

// The reported key state has changed
assert_eq!(true, input_system.is_vkey_down(window, VirtualKey::Escape));

pub fn keyboard_modifiers(&self, window: WindowId) -> KeyboardModifiers[src]

The current state of keyboard modifiers with respect to a given window.

If no state has been set all modifiers are considered unset.

Example

// The initial mouse position is (0,0)
assert_eq!(false, input_system.keyboard_modifiers(window).ctrl);

// The platform system emits key down event for Ctrl key
// [..]

// The reported mouse position has changed
assert_eq!(true, input_system.keyboard_modifiers(window).ctrl);

pub fn last_active_gamepad(&self) -> Option<GamePadId>[src]

Get the GamePadId of the last gamepad which issued any event.

Can be used a very simple way to pick a gamepad to consider the “active” gamepad. Handling InputEvent::GamePadConnected and similar events allows for more fine grained control.

Example

// The initial gamepad is None
assert_eq!(None, input_system.last_active_gamepad());

// Controller button press events are processed
// [..]

// The reported active controller has changed
assert_ne!(None, input_system.last_active_gamepad());

pub fn is_gamepad_button_down(
    &self,
    gamepad: GamePadId,
    button: GamePadButton
) -> bool
[src]

Check if a specific button is pressed for a given gamepad.

If no state has been set all buttons are considered not to be down.

// The initial button state is false
assert_eq!(false, input_system.is_gamepad_button_down(gamepad, GamePadButton::North));

// Controller button press events are processed
// [..]

// The reported button state has changed
assert_eq!(true, input_system.is_gamepad_button_down(gamepad, GamePadButton::North));

pub fn gamepad_axis_value(&self, gamepad: GamePadId, axis: GamePadAxis) -> f32[src]

Get the value of a specific axis for a specific gamepad

If no state has been set all axes are considered to have value 0.0.

// The initial button state is false
assert_eq!(0.0, input_system.gamepad_axis_value(gamepad, GamePadAxis::LeftStickX));

// Controller axis events are processed
// [..]

// The reported axis value has changed
assert_ne!(0.0, input_system.gamepad_axis_value(gamepad, GamePadAxis::LeftStickX));

Trait Implementations

impl Clone for InputSystemHandle[src]

impl Deref for InputSystemHandle[src]

type Target = InputSystem

The resulting type after dereferencing.

Auto Trait Implementations

impl RefUnwindSafe for InputSystemHandle

impl Send for InputSystemHandle

impl Sync for InputSystemHandle

impl Unpin for InputSystemHandle

impl UnwindSafe for InputSystemHandle

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.