Trait FetchUserInput

Source
pub trait FetchUserInput {
    // Required methods
    fn read_pressed(&mut self, input: impl Buttonlike) -> bool;
    fn read_button_value(&mut self, input: impl Buttonlike) -> f32;
    fn read_axis_value(&mut self, input: impl Axislike) -> f32;
    fn read_dual_axis_values(&mut self, input: impl DualAxislike) -> Vec2;
}
Expand description

A trait used to quickly fetch the value of a given UserInput.

This can be useful for testing purposes.

Required Methods§

Source

fn read_pressed(&mut self, input: impl Buttonlike) -> bool

Returns true if the given Buttonlike input is currently pressed.

Source

fn read_button_value(&mut self, input: impl Buttonlike) -> f32

Returns the value of the given Buttonlike input.

Source

fn read_axis_value(&mut self, input: impl Axislike) -> f32

Returns the value of the given Axislike input.

Source

fn read_dual_axis_values(&mut self, input: impl DualAxislike) -> Vec2

Returns the value of the given DualAxislike input.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl FetchUserInput for App

Source§

fn read_pressed(&mut self, input: impl Buttonlike) -> bool

Source§

fn read_button_value(&mut self, input: impl Buttonlike) -> f32

Source§

fn read_axis_value(&mut self, input: impl Axislike) -> f32

Source§

fn read_dual_axis_values(&mut self, input: impl DualAxislike) -> Vec2

Source§

impl FetchUserInput for World

Source§

fn read_pressed(&mut self, input: impl Buttonlike) -> bool

Source§

fn read_button_value(&mut self, input: impl Buttonlike) -> f32

Source§

fn read_axis_value(&mut self, input: impl Axislike) -> f32

Source§

fn read_dual_axis_values(&mut self, input: impl DualAxislike) -> Vec2

Implementors§