pub trait QueryInput {
    // Required methods
    fn pressed(&self, input: impl Into<UserInput>) -> bool;
    fn pressed_for_gamepad(
        &self,
        input: impl Into<UserInput>,
        gamepad: Option<Gamepad>
    ) -> bool;
}
Expand description

Query [ButtonInput] state directly for testing purposes.

In game code, you should (almost) always be using ActionState methods instead.

Required Methods§

source

fn pressed(&self, input: impl Into<UserInput>) -> bool

Is the provided user_input pressed?

This method is intended as a convenience for testing; check the [ButtonInput] resource directly, or use an InputMap in real code.

source

fn pressed_for_gamepad( &self, input: impl Into<UserInput>, gamepad: Option<Gamepad> ) -> bool

Is the provided user_input pressed for the provided [Gamepad]?

This method is intended as a convenience for testing; check the [ButtonInput] resource directly, or use an InputMap in real code.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl QueryInput for App

source§

fn pressed(&self, input: impl Into<UserInput>) -> bool

source§

fn pressed_for_gamepad( &self, input: impl Into<UserInput>, gamepad: Option<Gamepad> ) -> bool

source§

impl QueryInput for World

source§

fn pressed(&self, input: impl Into<UserInput>) -> bool

source§

fn pressed_for_gamepad( &self, input: impl Into<UserInput>, gamepad: Option<Gamepad> ) -> bool

Implementors§