Vigilante Game Framework  1.0.0.8
A 2D/3D C++ Game Framework using SFML.
Public Types | Static Public Member Functions | List of all members
sf::XInputDevice Class Reference

Class for directly accessing and managing XInput controls (Windows Only!) More...

#include <XInputDevice.h>

Public Types

enum  : unsigned char { Count = 4 }
 Maximum Amount of Gamepads.
 
enum  XButton : unsigned short {
  DPAD_UP = 0x0001, DPAD_DOWN = 0x0002, DPAD_LEFT = 0x0004, DPAD_RIGHT = 0x0008,
  START = 0x0010, BACK = 0x0020, LEFT_THUMB = 0x0040, RIGHT_THUMB = 0x0080,
  LB = 0x0100, RB = 0x0200, A = 0x1000, B = 0x2000,
  X = 0x4000, Y = 0x8000
}
 All the buttons of a single gamepad and their respective value.
 
enum  XAxis : unsigned char {
  PovX, PovY, Z, V,
  L, R
}
 All the available axis types.
 

Static Public Member Functions

static bool isConnected (unsigned int joystick)
 
static unsigned int getButtonCount (unsigned int joystick)
 
static bool isAnyButtonPressed (unsigned int joystick)
 
static bool isButtonPressed (unsigned int joystick, unsigned short button)
 
static bool isAnyConnected ()
 
static float getAxisPosition (unsigned int joystick, XAxis axis)
 

Detailed Description

Class for directly accessing and managing XInput controls (Windows Only!)

Member Function Documentation

◆ getAxisPosition()

static float sf::XInputDevice::getAxisPosition ( unsigned int  joystick,
XAxis  axis 
)
static

Return the value of a specified axis on a gamepad.

Parameters
joystickPlayer Gamepad Index. Must be less than the XInputDevice::Count value.
axisThe axis you want to test, use XAxis for which axis.
Returns
Returns a float between -1.0f and 1.0f for the axis. Returns 0 if one is not connected.

◆ getButtonCount()

static unsigned int sf::XInputDevice::getButtonCount ( unsigned int  joystick)
static

Returns the amount of available buttons on this gamepad.

Parameters
joystickPlayer Gamepad Index. Must be less than the XInputDevice::Count value.
Returns
Returns number of available buttons on the gamepad.

◆ isAnyButtonPressed()

static bool sf::XInputDevice::isAnyButtonPressed ( unsigned int  joystick)
static

Tests if any button on a gamepad has been pressed.

Parameters
joystickPlayer Gamepad Index. Must be less than the XInputDevice::Count value.
Returns
Returns true if any button has been pressed.

◆ isAnyConnected()

static bool sf::XInputDevice::isAnyConnected ( )
static

Tests if any gamepad is connected at that point.

Returns
Returns true if any gamepad is connected.

◆ isButtonPressed()

static bool sf::XInputDevice::isButtonPressed ( unsigned int  joystick,
unsigned short  button 
)
static

Tests if a specific button on a gamepad has been pressed.

Parameters
joystickPlayer Gamepad Index. Must be less than the XInputDevice::Count value.
buttonThe button you want to test, use XButton for which button.
Returns
Returns true if a specific button at a specific joystick/player index is currently being pressed. Returns false if not connected.

◆ isConnected()

static bool sf::XInputDevice::isConnected ( unsigned int  joystick)
static

Returns true if a specific gamepad is connected.

Parameters
joystickPlayer Gamepad Index. Must be less than the XInputDevice::Count value.
Returns
Returns true if a gamepad is connected.

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