One connected (or previously connected) joystick / gamepad device. Gamepad axis/button names follow SDL GameController strings (e.g. "leftx", "a", "dpup"). Hat directions: c/u/d/l/r/lu/ld/ru/rd. 更多...
#include <Pad.h>
Public 成员函数 | |
| virtual | ~Pad ()=default |
| Releases device handles; safe to call when already closed. | |
| virtual bool | open (int deviceindex)=0 |
| Opens the device by SDL joystick device index. | |
| virtual void | close ()=0 |
| Closes joystick and gamecontroller handles. | |
| virtual bool | isConnected () const =0 |
| True while the underlying device is still connected. | |
| virtual std::string | getName () const =0 |
| Human-readable device name from the OS/driver. | |
| virtual int | getAxisCount () const =0 |
| Number of raw joystick axes. | |
| virtual int | getButtonCount () const =0 |
| Number of raw joystick buttons. | |
| virtual int | getHatCount () const =0 |
| Number of hat (D-pad) controls. | |
| virtual float | getAxis (int axisindex) const =0 |
| Normalized axis value in [-1, 1] for a raw axis index. | |
| virtual std::vector< float > | getAxes () const =0 |
| Snapshot of all raw axis values. | |
| virtual std::string | getHat (int hatindex) const =0 |
| Hat direction string for a hat index (see class brief). | |
| virtual bool | isDown (int button) const =0 |
| True if the raw button index is currently pressed. | |
| virtual bool | isDown (const std::vector< int > &buttons) const =0 |
| True if any of the raw button indices is currently pressed. | |
| virtual bool | openGamepad (int deviceindex)=0 |
| Opens the device as an SDL GameController. | |
| virtual bool | isGamepad () const =0 |
| True when a GameController mapping is active for this pad. | |
| virtual float | getGamepadAxis (const std::string &axis) const =0 |
| Named gamepad axis value (SDL GameController axis string). | |
| virtual bool | isGamepadDown (const std::string &button) const =0 |
| True if the named gamepad button is pressed. | |
| virtual bool | isGamepadDown (const std::vector< std::string > &buttons) const =0 |
| True if any of the named gamepad buttons is pressed. | |
| virtual std::string | getGamepadMappingString () const =0 |
| Current SDL GameController mapping string for this device. | |
| virtual void * | getHandle () const =0 |
| Native handle (SDL_Joystick* / implementation-defined). | |
| virtual std::string | getGUID () const =0 |
| Stable GUID string for mapping lookup. | |
| virtual int | getInstanceID () const =0 |
| SDL instance id that stays unique while the device is open. | |
| virtual int | getID () const =0 |
| Engine-side stable pad id assigned at construction. | |
| virtual void | getDeviceInfo (int &vendorID, int &productID, int &productVersion) const =0 |
| USB/HID vendor, product, and version ids when available. | |
| virtual bool | isVibrationSupported ()=0 |
| True when haptic/rumble output is available. | |
| virtual bool | setVibration (float left, float right, float duration=-1.0f)=0 |
| Starts rumble; duration < 0 means until stopped. | |
| virtual bool | setVibration ()=0 |
| Stops active rumble. | |
| virtual void | getVibration (float &left, float &right)=0 |
| Reads the last requested left/right rumble strengths. | |
详细描述
One connected (or previously connected) joystick / gamepad device. Gamepad axis/button names follow SDL GameController strings (e.g. "leftx", "a", "dpup"). Hat directions: c/u/d/l/r/lu/ld/ru/rd.
构造及析构函数说明
◆ ~Pad()
|
virtualdefault |
Releases device handles; safe to call when already closed.
被 eve::joystick::sdl::Pad 重载.
成员函数说明
◆ close()
|
pure virtual |
Closes joystick and gamecontroller handles.
在 eve::joystick::sdl::Pad 内被实现.
◆ getAxes()
|
pure virtual |
Snapshot of all raw axis values.
在 eve::joystick::sdl::Pad 内被实现.
◆ getAxis()
|
pure virtual |
Normalized axis value in [-1, 1] for a raw axis index.
在 eve::joystick::sdl::Pad 内被实现.
◆ getAxisCount()
|
pure virtual |
Number of raw joystick axes.
在 eve::joystick::sdl::Pad 内被实现.
◆ getButtonCount()
|
pure virtual |
Number of raw joystick buttons.
在 eve::joystick::sdl::Pad 内被实现.
◆ getDeviceInfo()
|
pure virtual |
USB/HID vendor, product, and version ids when available.
在 eve::joystick::sdl::Pad 内被实现.
◆ getGamepadAxis()
|
pure virtual |
Named gamepad axis value (SDL GameController axis string).
在 eve::joystick::sdl::Pad 内被实现.
◆ getGamepadMappingString()
|
pure virtual |
Current SDL GameController mapping string for this device.
在 eve::joystick::sdl::Pad 内被实现.
◆ getGUID()
|
pure virtual |
Stable GUID string for mapping lookup.
在 eve::joystick::sdl::Pad 内被实现.
◆ getHandle()
|
pure virtual |
Native handle (SDL_Joystick* / implementation-defined).
在 eve::joystick::sdl::Pad 内被实现.
◆ getHat()
|
pure virtual |
Hat direction string for a hat index (see class brief).
在 eve::joystick::sdl::Pad 内被实现.
◆ getHatCount()
|
pure virtual |
Number of hat (D-pad) controls.
在 eve::joystick::sdl::Pad 内被实现.
◆ getID()
|
pure virtual |
Engine-side stable pad id assigned at construction.
在 eve::joystick::sdl::Pad 内被实现.
◆ getInstanceID()
|
pure virtual |
SDL instance id that stays unique while the device is open.
在 eve::joystick::sdl::Pad 内被实现.
◆ getName()
|
pure virtual |
Human-readable device name from the OS/driver.
在 eve::joystick::sdl::Pad 内被实现.
◆ getVibration()
|
pure virtual |
Reads the last requested left/right rumble strengths.
在 eve::joystick::sdl::Pad 内被实现.
◆ isConnected()
|
pure virtual |
True while the underlying device is still connected.
在 eve::joystick::sdl::Pad 内被实现.
◆ isDown() [1/2]
|
pure virtual |
True if any of the raw button indices is currently pressed.
在 eve::joystick::sdl::Pad 内被实现.
◆ isDown() [2/2]
|
pure virtual |
True if the raw button index is currently pressed.
在 eve::joystick::sdl::Pad 内被实现.
◆ isGamepad()
|
pure virtual |
True when a GameController mapping is active for this pad.
在 eve::joystick::sdl::Pad 内被实现.
◆ isGamepadDown() [1/2]
|
pure virtual |
True if the named gamepad button is pressed.
在 eve::joystick::sdl::Pad 内被实现.
◆ isGamepadDown() [2/2]
|
pure virtual |
True if any of the named gamepad buttons is pressed.
在 eve::joystick::sdl::Pad 内被实现.
◆ isVibrationSupported()
|
pure virtual |
True when haptic/rumble output is available.
在 eve::joystick::sdl::Pad 内被实现.
◆ open()
|
pure virtual |
◆ openGamepad()
|
pure virtual |
◆ setVibration() [1/2]
|
pure virtual |
Stops active rumble.
在 eve::joystick::sdl::Pad 内被实现.
◆ setVibration() [2/2]
|
pure virtual |
Starts rumble; duration < 0 means until stopped.
- 返回
- false if unsupported.
在 eve::joystick::sdl::Pad 内被实现.
该类的文档由以下文件生成:
- src/modules/joystick/Pad.h