SDL joystick/gamepad backend (GameController + optional haptic rumble). 更多...
#include <Pad.h>
Public 成员函数 | |
| Pad (int id) | |
| Creates a closed pad with the given engine id. | |
| Pad (int id, int joyindex) | |
| Creates a pad and opens SDL device joyindex. | |
| ~Pad () override | |
| Closes SDL handles and stops rumble. | |
| bool | open (int deviceindex) override |
| Opens the device by SDL joystick device index. | |
| void | close () override |
| Closes joystick and gamecontroller handles. | |
| bool | isConnected () const override |
| True while the underlying device is still connected. | |
| std::string | getName () const override |
| Human-readable device name from the OS/driver. | |
| int | getAxisCount () const override |
| Number of raw joystick axes. | |
| int | getButtonCount () const override |
| Number of raw joystick buttons. | |
| int | getHatCount () const override |
| Number of hat (D-pad) controls. | |
| float | getAxis (int axisindex) const override |
| Normalized axis value in [-1, 1] for a raw axis index. | |
| std::vector< float > | getAxes () const override |
| Snapshot of all raw axis values. | |
| std::string | getHat (int hatindex) const override |
| Hat direction string for a hat index (see class brief). | |
| bool | isDown (int button) const override |
| True if the raw button index is currently pressed. | |
| bool | isDown (const std::vector< int > &buttons) const override |
| True if the raw button index is currently pressed. | |
| bool | openGamepad (int deviceindex) override |
| Opens the device as an SDL GameController. | |
| bool | isGamepad () const override |
| True when a GameController mapping is active for this pad. | |
| float | getGamepadAxis (const std::string &axis) const override |
| Named gamepad axis value (SDL GameController axis string). | |
| bool | isGamepadDown (const std::string &button) const override |
| True if the named gamepad button is pressed. | |
| bool | isGamepadDown (const std::vector< std::string > &buttons) const override |
| True if the named gamepad button is pressed. | |
| std::string | getGamepadMappingString () const override |
| Current SDL GameController mapping string for this device. | |
| void * | getHandle () const override |
| Native handle (SDL_Joystick* / implementation-defined). | |
| std::string | getGUID () const override |
| Stable GUID string for mapping lookup. | |
| int | getInstanceID () const override |
| SDL instance id that stays unique while the device is open. | |
| int | getID () const override |
| Engine-side stable pad id assigned at construction. | |
| void | getDeviceInfo (int &vendorID, int &productID, int &productVersion) const override |
| USB/HID vendor, product, and version ids when available. | |
| bool | isVibrationSupported () override |
| True when haptic/rumble output is available. | |
| bool | setVibration (float left, float right, float duration=-1.0f) override |
| Starts rumble; duration < 0 means until stopped. | |
| bool | setVibration () override |
| Starts rumble; duration < 0 means until stopped. | |
| void | getVibration (float &left, float &right) override |
| Reads the last requested left/right rumble strengths. | |
详细描述
构造及析构函数说明
◆ Pad() [1/2]
|
explicit |
◆ Pad() [2/2]
| eve::joystick::sdl::Pad::Pad | ( | int | id, |
| int | joyindex | ||
| ) |
◆ ~Pad()
|
overridevirtual |
成员函数说明
◆ close()
|
overridevirtual |
Closes joystick and gamecontroller handles.
实现了 eve::joystick::Pad.
◆ getAxes()
|
overridevirtual |
Snapshot of all raw axis values.
实现了 eve::joystick::Pad.
引用了 eve::joystick::clampAxis(), count, getAxisCount() , 以及 isConnected().
◆ getAxis()
|
overridevirtual |
Normalized axis value in [-1, 1] for a raw axis index.
实现了 eve::joystick::Pad.
引用了 eve::joystick::clampAxis(), getAxisCount() , 以及 isConnected().
◆ getAxisCount()
|
overridevirtual |
◆ getButtonCount()
|
overridevirtual |
◆ getDeviceInfo()
|
overridevirtual |
USB/HID vendor, product, and version ids when available.
实现了 eve::joystick::Pad.
◆ getGamepadAxis()
|
overridevirtual |
Named gamepad axis value (SDL GameController axis string).
实现了 eve::joystick::Pad.
引用了 eve::joystick::clampAxis(), isConnected(), isGamepad() , 以及 value.
◆ getGamepadMappingString()
|
overridevirtual |
Current SDL GameController mapping string for this device.
实现了 eve::joystick::Pad.
◆ getGUID()
|
overridevirtual |
◆ getHandle()
|
overridevirtual |
Native handle (SDL_Joystick* / implementation-defined).
实现了 eve::joystick::Pad.
◆ getHat()
|
overridevirtual |
Hat direction string for a hat index (see class brief).
实现了 eve::joystick::Pad.
引用了 getHatCount() , 以及 isConnected().
◆ getHatCount()
|
overridevirtual |
◆ getID()
|
overridevirtual |
◆ getInstanceID()
|
overridevirtual |
SDL instance id that stays unique while the device is open.
实现了 eve::joystick::Pad.
◆ getName()
|
overridevirtual |
◆ getVibration()
|
overridevirtual |
Reads the last requested left/right rumble strengths.
实现了 eve::joystick::Pad.
引用了 left, right, SDL_TICKS_PASSED , 以及 setVibration().
◆ isConnected()
|
overridevirtual |
True while the underlying device is still connected.
实现了 eve::joystick::Pad.
被这些函数引用 getAxes(), getAxis(), getAxisCount(), getButtonCount(), getGamepadAxis(), getHat(), getHatCount(), isDown(), isGamepadDown() , 以及 open().
◆ isDown() [1/2]
|
overridevirtual |
True if the raw button index is currently pressed.
实现了 eve::joystick::Pad.
引用了 getButtonCount() , 以及 isConnected().
◆ isDown() [2/2]
|
overridevirtual |
True if the raw button index is currently pressed.
实现了 eve::joystick::Pad.
引用了 isDown().
被这些函数引用 isDown().
◆ isGamepad()
|
overridevirtual |
True when a GameController mapping is active for this pad.
实现了 eve::joystick::Pad.
被这些函数引用 getGamepadAxis(), isGamepadDown(), isVibrationSupported(), openGamepad() , 以及 setVibration().
◆ isGamepadDown() [1/2]
|
overridevirtual |
True if the named gamepad button is pressed.
实现了 eve::joystick::Pad.
引用了 isGamepadDown().
被这些函数引用 isGamepadDown().
◆ isGamepadDown() [2/2]
|
overridevirtual |
True if the named gamepad button is pressed.
实现了 eve::joystick::Pad.
引用了 isConnected(), isGamepad() , 以及 name.
◆ isVibrationSupported()
|
overridevirtual |
◆ open()
|
overridevirtual |
Opens the device by SDL joystick device index.
- 返回
- false on failure.
实现了 eve::joystick::Pad.
引用了 close(), isConnected() , 以及 openGamepad().
被这些函数引用 Pad().
◆ openGamepad()
|
overridevirtual |
Opens the device as an SDL GameController.
- 返回
- false on failure.
实现了 eve::joystick::Pad.
引用了 isGamepad().
被这些函数引用 open().
◆ setVibration() [1/2]
|
overridevirtual |
Starts rumble; duration < 0 means until stopped.
- 返回
- false if unsupported.
实现了 eve::joystick::Pad.
被这些函数引用 getVibration() , 以及 setVibration().
◆ setVibration() [2/2]
|
overridevirtual |
Starts rumble; duration < 0 means until stopped.
- 返回
- false if unsupported.
实现了 eve::joystick::Pad.
引用了 duration, isGamepad(), left, length, right, setVibration() , 以及 strength.
该类的文档由以下文件生成: