Urho3D
Public Member Functions | Public Attributes | List of all members
Dviglo::JoystickState Struct Reference

#include </home/runner/work/Dviglo/Dviglo/DvigloRepository/Source/Urho3D/Input/Input.h>

Public Member Functions

void Initialize (unsigned numButtons, unsigned numAxes, unsigned numHats)
 Initialize the number of buttons, axes and hats and set them to neutral state.
 
void Reset ()
 Reset button, axis and hat states to neutral.
 
bool IsController () const
 
unsigned GetNumButtons () const
 
unsigned GetNumAxes () const
 
unsigned GetNumHats () const
 
bool GetButtonDown (unsigned index) const
 
bool GetButtonPress (unsigned index) const
 
float GetAxisPosition (unsigned index) const
 
int GetHatPosition (unsigned index) const
 

Public Attributes

SDL_Joystick * joystick_ {}
 SDL joystick.
 
SDL_JoystickID joystickID_ {}
 SDL joystick instance ID.
 
SDL_GameController * controller_ {}
 SDL game controller.
 
UIElementscreenJoystick_ {}
 UI element containing the screen joystick.
 
String name_
 Joystick name.
 
PODVector< bool > buttons_
 Button up/down state.
 
PODVector< bool > buttonPress_
 Button pressed on this frame.
 
PODVector< float > axes_
 Axis position from -1 to 1.
 
PODVector< int > hats_
 POV hat bits.
 

Detailed Description

Input state for a joystick.

Member Function Documentation

◆ GetAxisPosition()

float Dviglo::JoystickState::GetAxisPosition ( unsigned  index) const
inline

Return axis position.

◆ GetButtonDown()

bool Dviglo::JoystickState::GetButtonDown ( unsigned  index) const
inline

Check if a button is held down.

◆ GetButtonPress()

bool Dviglo::JoystickState::GetButtonPress ( unsigned  index) const
inline

Check if a button has been pressed on this frame.

◆ GetHatPosition()

int Dviglo::JoystickState::GetHatPosition ( unsigned  index) const
inline

Return hat position.

◆ GetNumAxes()

unsigned Dviglo::JoystickState::GetNumAxes ( ) const
inline

Return number of axes.

◆ GetNumButtons()

unsigned Dviglo::JoystickState::GetNumButtons ( ) const
inline

Return number of buttons.

◆ GetNumHats()

unsigned Dviglo::JoystickState::GetNumHats ( ) const
inline

Return number of hats.

◆ IsController()

bool Dviglo::JoystickState::IsController ( ) const
inline

Return whether is a game controller. Game controllers will use standardized axis and button mappings.


The documentation for this struct was generated from the following files: