input_actions/action/
behavior.rs

1pub static ACTION_BEHAVIOR_DEFAULT_BUTTON: Behavior = Behavior { digital_axis: None };
2
3#[derive(Debug, Clone)]
4pub struct Behavior {
5	digital_axis: Option<DigitalAxis>,
6}
7
8impl Behavior {
9	pub(crate) fn _digital_axis(&self) -> &Option<DigitalAxis> {
10		&self.digital_axis
11	}
12}
13
14/// For [`Button`](crate::source::Kind::Button) events bound to [`Axis`](crate::source::Kind::Axis) actions.
15#[derive(Debug, Clone)]
16pub struct DigitalAxis {
17	reverse: Option<DigitalAxisReverse>,
18	/// Speed (units/sec) that the axis value falls toward 0.
19	gravity: f32,
20	/// Speed to move toward an axis value of 1.0 in units/sec.
21	sensitivity: f32,
22}
23
24/// Modifier applied when input is received in the opposite direction of the current flow.
25#[derive(Debug, Clone)]
26pub enum DigitalAxisReverse {
27	/// Snap axis value to 0 and continue from there.
28	Snap,
29	/// Reverse the current value to the opposite sign and continue from there.
30	InstantReverse,
31}
32
33impl Default for Behavior {
34	fn default() -> Self {
35		Self { digital_axis: None }
36	}
37}