P-E-R-R-Y
Utilitaires, contrats et vendors du moteur, en une seule doc
Loading...
Searching...
No Matches
SfmlGamepad Class Reference

Unlike raylib's GamepadButton (normalized Xbox-style layout), sf::Joystick exposes raw numbered buttons/axes with no guaranteed meaning across controllers/platforms. This uses the common Xbox- style button ordering (0=A,1=B,2=X,3=Y) most drivers report, but it isn't guaranteed the way raylib's mapping is. More...

#include <SfmlGamepad.hpp>

Inheritance diagram for SfmlGamepad:
Collaboration diagram for SfmlGamepad:

Public Member Functions

 SfmlGamepad (const SfmlWindow &window, unsigned int index=0)
 ~SfmlGamepad () override=default
bool isAvailable () const override
 notice if a gamepad is actually plugged in
bool isButtonPressed (Button button) const override
 notice if the button is pressed
bool isButtonReleased (Button button) const override
 notice if the button is released
bool isButtonDown (Button button) const override
 notice if the button is down
bool isButtonUp (Button button) const override
 notice if the button is up
float getAxisMovement (Axis axis) const override
 the movement of an axis, in [-1, 1]
Public Member Functions inherited from graphic::IGamepad
virtual ~IGamepad ()=default
 Destroy the IGamepad object.

Additional Inherited Members

Public Types inherited from graphic::IGamepad
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
}

Detailed Description

Unlike raylib's GamepadButton (normalized Xbox-style layout), sf::Joystick exposes raw numbered buttons/axes with no guaranteed meaning across controllers/platforms. This uses the common Xbox- style button ordering (0=A,1=B,2=X,3=Y) most drivers report, but it isn't guaranteed the way raylib's mapping is.

Axes are reported as a percentage in [-100, 100] : divided by 100 to yield the contract's [-1, 1], with no dead zone - a dead zone is a gameplay choice and belongs to the game.

Constructor & Destructor Documentation

◆ SfmlGamepad()

SfmlGamepad::SfmlGamepad ( const SfmlWindow & window,
unsigned int index = 0 )
inline

◆ ~SfmlGamepad()

SfmlGamepad::~SfmlGamepad ( )
overridedefault

Member Function Documentation

◆ getAxisMovement()

float SfmlGamepad::getAxisMovement ( Axis axis) const
inlineoverridevirtual

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

Parameters
axis
Returns
float

Implements graphic::IGamepad.

◆ isAvailable()

bool SfmlGamepad::isAvailable ( ) const
inlineoverridevirtual

notice if a gamepad is actually plugged in

Returns
bool

Implements graphic::IGamepad.


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