diff --git a/src/input.rs b/src/input.rs index 977fbb0..2b8887d 100644 --- a/src/input.rs +++ b/src/input.rs @@ -189,6 +189,48 @@ impl Input { } } + /// Get the origin(s) for a digital action within an action set. + pub fn get_digital_action_origins( + &self, + input_handle: sys::InputHandle_t, + action_set_handle: sys::InputActionSetHandle_t, + digital_action_handle: sys::InputDigitalActionHandle_t, + ) -> Vec { + unsafe { + let mut origins = Vec::with_capacity(sys::STEAM_INPUT_MAX_ORIGINS as usize); + let len = sys::SteamAPI_ISteamInput_GetDigitalActionOrigins( + self.input, + input_handle, + action_set_handle, + digital_action_handle, + origins.as_mut_ptr(), + ); + origins.set_len(len as usize); + origins + } + } + + /// Get the origin(s) for an analog action within an action set. + pub fn get_analog_action_origins( + &self, + input_handle: sys::InputHandle_t, + action_set_handle: sys::InputActionSetHandle_t, + analog_action_handle: sys::InputAnalogActionHandle_t, + ) -> Vec { + unsafe { + let mut origins = Vec::with_capacity(sys::STEAM_INPUT_MAX_ORIGINS as usize); + let len = sys::SteamAPI_ISteamInput_GetAnalogActionOrigins( + self.input, + input_handle, + action_set_handle, + analog_action_handle, + origins.as_mut_ptr(), + ); + origins.set_len(len as usize); + origins + } + } + pub fn get_motion_data(&self, input_handle: sys::InputHandle_t) -> sys::InputMotionData_t { unsafe { sys::SteamAPI_ISteamInput_GetMotionData(self.input, input_handle) } }