P-E-R-R-Y
Utilitaires, contrats et vendors du moteur, en une seule doc
Loading...
Searching...
No Matches
graphic::IGamepad Interface Referenceabstract

Gamepad interface. Not every window can hand one out (a terminal backend has no controller) - IWindow::createGamepad() returns nullptr in that case, this type itself stays complete. More...

#include <IGamepad.hpp>

Inheritance diagram for graphic::IGamepad:

Public Types

enum  Button {
  BUTTON_UNKNOWN = -1 , BUTTON_A , BUTTON_B , BUTTON_X ,
  BUTTON_Y , BUTTON_LEFT_BUMPER , BUTTON_RIGHT_BUMPER , BUTTON_BACK ,
  BUTTON_START , BUTTON_LEFT_THUMB , BUTTON_RIGHT_THUMB , BUTTON_DPAD_UP ,
  BUTTON_DPAD_RIGHT , BUTTON_DPAD_DOWN , BUTTON_DPAD_LEFT , BUTTON_LENGTH
}
enum  Axis {
  AXIS_LEFT_X , AXIS_LEFT_Y , AXIS_RIGHT_X , AXIS_RIGHT_Y ,
  AXIS_LEFT_TRIGGER , AXIS_RIGHT_TRIGGER , AXIS_LENGTH
}

Public Member Functions

virtual ~IGamepad ()=default
 Destroy the IGamepad object.
virtual bool isAvailable () const =0
 notice if a gamepad is actually plugged in
virtual bool isButtonPressed (Button button) const =0
 notice if the button is pressed
virtual bool isButtonDown (Button button) const =0
 notice if the button is down
virtual bool isButtonReleased (Button button) const =0
 notice if the button is released
virtual bool isButtonUp (Button button) const =0
 notice if the button is up
virtual float getAxisMovement (Axis axis) const =0
 the movement of an axis, in [-1, 1]

Detailed Description

Gamepad interface. Not every window can hand one out (a terminal backend has no controller) - IWindow::createGamepad() returns nullptr in that case, this type itself stays complete.

Same rules as IKeyboard : isButtonPressed / isButtonReleased are true for one frame, isButtonDown / isButtonUp for as long as it lasts, and all four are read anywhere in the frame, as is getAxisMovement().

Member Enumeration Documentation

◆ Axis

Enumerator
AXIS_LEFT_X 
AXIS_LEFT_Y 
AXIS_RIGHT_X 
AXIS_RIGHT_Y 
AXIS_LEFT_TRIGGER 
AXIS_RIGHT_TRIGGER 
AXIS_LENGTH 

◆ Button

Enumerator
BUTTON_UNKNOWN 
BUTTON_A 
BUTTON_B 
BUTTON_X 
BUTTON_Y 
BUTTON_LEFT_BUMPER 
BUTTON_RIGHT_BUMPER 
BUTTON_BACK 
BUTTON_START 
BUTTON_LEFT_THUMB 
BUTTON_RIGHT_THUMB 
BUTTON_DPAD_UP 
BUTTON_DPAD_RIGHT 
BUTTON_DPAD_DOWN 
BUTTON_DPAD_LEFT 
BUTTON_LENGTH 

Constructor & Destructor Documentation

◆ ~IGamepad()

virtual graphic::IGamepad::~IGamepad ( )
virtualdefault

Destroy the IGamepad object.

Member Function Documentation

◆ getAxisMovement()

virtual float graphic::IGamepad::getAxisMovement ( Axis axis) const
pure virtual

the movement of an axis, in [-1, 1]

Parameters
axis
Returns
float

Implemented in RayGamepad, SdlGamepad, SdlGamepad, and SfmlGamepad.

◆ isAvailable()

virtual bool graphic::IGamepad::isAvailable ( ) const
pure virtual

notice if a gamepad is actually plugged in

Returns
bool

Implemented in RayGamepad, SdlGamepad, SdlGamepad, and SfmlGamepad.

◆ isButtonDown()

virtual bool graphic::IGamepad::isButtonDown ( Button button) const
pure virtual

notice if the button is down

Parameters
button
Returns
bool

Implemented in RayGamepad, SdlGamepad, SdlGamepad, and SfmlGamepad.

◆ isButtonPressed()

virtual bool graphic::IGamepad::isButtonPressed ( Button button) const
pure virtual

notice if the button is pressed

Parameters
button
Returns
bool

Implemented in RayGamepad, SdlGamepad, SdlGamepad, and SfmlGamepad.

◆ isButtonReleased()

virtual bool graphic::IGamepad::isButtonReleased ( Button button) const
pure virtual

notice if the button is released

Parameters
button
Returns
bool

Implemented in RayGamepad, SdlGamepad, SdlGamepad, and SfmlGamepad.

◆ isButtonUp()

virtual bool graphic::IGamepad::isButtonUp ( Button button) const
pure virtual

notice if the button is up

Parameters
button
Returns
bool

Implemented in RayGamepad, SdlGamepad, SdlGamepad, and SfmlGamepad.


The documentation for this interface was generated from the following file: