pub struct Player<'player> { /* private fields */ }Expand description
Represents a console controller type
It’s essentially a wrapper type over HID shared-memory to simplify input detection
Implementations§
Source§impl<'player, 'context: 'player> Player<'player>
impl<'player, 'context: 'player> Player<'player>
Sourcepub fn new(
npad_id: NpadIdType,
supported_style_tags: NpadStyleTag,
shmem: &'context SharedMemoryFormat,
) -> Result<Self>
pub fn new( npad_id: NpadIdType, supported_style_tags: NpadStyleTag, shmem: &'context SharedMemoryFormat, ) -> Result<Self>
Creates a Player from shared-memory information
If using a Context, look for Context::get_player instead (for simplicity)
§Arguments
npad_id: TheNpadIdTypeof the desired controllersupported_style_tags: TheNpadStyleTagflags which will be used by thePlayerto scan for input, etc.shmem_ptr: The address of HID shared-memory
Sourcepub fn get_style_tag_attributes(&self, style_tag: NpadStyleTag) -> NpadAttribute
pub fn get_style_tag_attributes(&self, style_tag: NpadStyleTag) -> NpadAttribute
Gets the NpadAttributes for a certain NpadStyleTag
§Arguments
style_tag: Must be aNpadStyleTagwith a single flag set (otherwise only one will take effect and the rest will be ignored)
Sourcepub fn get_stick_status(
&self,
style_tag: NpadStyleTag,
) -> (AnalogStickState, AnalogStickState)
pub fn get_stick_status( &self, style_tag: NpadStyleTag, ) -> (AnalogStickState, AnalogStickState)
Gets the stick status from a provided style tag (which may or may not be configured)
pub fn get_first_stick_status( &self, deadzone: f32, ) -> Option<(AnalogStickState, AnalogStickState)>
Gets the NpadButtons for a certain NpadStyleTag
§Arguments
style_tag: Must be aNpadStyleTagwith a single flag set (otherwise only one will take effect and the rest will be ignored)
Gets the down NpadButtons for a certain NpadStyleTag
This is similar to get_style_tag_buttons but this only gets the buttons once after they’re down/pressed
§Arguments
style_tag: Must be aNpadStyleTagwith a single flag set (otherwise only one will take effect and the rest will be ignored)
Gets the up NpadButtons for a certain NpadStyleTag
This is similar to get_style_tag_buttons but this only gets the buttons once after they’re up/released
§Arguments
style_tag: Must be aNpadStyleTagwith a single flag set (otherwise only one will take effect and the rest will be ignored)
Gets the NpadButtons for all of the supported NpadStyleTags, combining all of them
This is like combining the result of get_style_tag_buttons with all the supported NpadStyleTag flags
Gets the down NpadButtons for all of the supported NpadStyleTags, combining all of them
This is similar to get_buttons but this only gets the buttons once after they’re down/pressed
Gets the up NpadButtons for all of the supported NpadStyleTags, combining all of them
This is similar to get_buttons but this only gets the buttons once after they’re up/released
Gets the up NpadButtons for all of the supported NpadStyleTags, combining all of them
This only updates the state once, but is otherwise equivalent to (self.get_previous(), self.get_buttons(), self.get_buttons_down(), self.get_buttons_up())
Sourcepub fn get_npad_id(&self) -> NpadIdType
pub fn get_npad_id(&self) -> NpadIdType
Gets the NpadIdType being used with this Player
Gets the supported NpadStyleTag flags being used with this Player