21 extern CGV_API
const std::vector<driver_info>& get_driver_infos();
23 extern CGV_API
void set_driver_state(
unsigned i,
bool enabled);
50 extern CGV_API
void scan_devices();
52 extern CGV_API
const std::vector<device_info>& get_device_infos();
54 extern CGV_API
const device_info* get_device_info(
void* device_handle);
56 extern CGV_API
bool is_connected(
void* device_handle);
58 extern CGV_API
bool set_device_state(
void* device_handle,
bool enabled);
68 extern CGV_API
bool get_device_battery_info(
unsigned device_index, BatteryType& battery_type,
float& fill_state);
93 GPK_RIGHT_STICK_PRESS,
99 GPK_LEFT_STICK_UPLEFT,
100 GPK_LEFT_STICK_UPRIGHT,
101 GPK_LEFT_STICK_DOWNRIGHT,
102 GPK_LEFT_STICK_DOWNLEFT,
105 GPK_RIGHT_STICK_DOWN,
106 GPK_RIGHT_STICK_RIGHT,
107 GPK_RIGHT_STICK_LEFT,
108 GPK_RIGHT_STICK_UPLEFT,
109 GPK_RIGHT_STICK_UPRIGHT,
110 GPK_RIGHT_STICK_DOWNRIGHT,
111 GPK_RIGHT_STICK_DOWNLEFT,
127 extern CGV_API
bool query_key_event(
void* device_handle, GamepadKeys& gk, KeyAction& action);
130 enum GamepadButtonStateFlags
132 GBF_DPAD_UP = 0x0001,
133 GBF_DPAD_DOWN = 0x0002,
134 GBF_DPAD_LEFT = 0x0004,
135 GBF_DPAD_RIGHT = 0x0008,
138 GBF_LEFT_STICK = 0x0040,
139 GBF_RIGHT_STICK = 0x0080,
140 GBF_LEFT_BUMPER = 0x0100,
141 GBF_RIGHT_BUMPER = 0x0200,
148 extern CGV_API std::string convert_flags_to_string(GamepadButtonStateFlags flags);
158 float left_stick_position[2];
160 float right_stick_position[2];
162 float trigger_position[2];
168 extern CGV_API
bool get_state(
void* device_handle,
gamepad_state& state);
170 extern CGV_API
bool set_vibration(
void* device_handle,
float low_frequency_strength,
float high_frequency_strength);
173#include <cgv/config/lib_end.h>
std::string get_key_string(unsigned short key)
convert key to string
KeyAction
repeated definition from cgv/gui/key_event.h
information provided per gamepad device
size_t driver_index
index of driver used to access device
bool is_wireless
whether it is wireless
void * device_handle
unique device handle
float vibration_strength[2]
strength values of low and high frequency vibration in the range [0,1]
bool no_menu_buttons
whether menu buttons (start,back) are missing
bool enabled
whether device is enabled
bool force_feedback_support
whether force feedback is supported
std::string name
name in case driver provides this information (not reliable)
information structure for drivers
std::string name
name of driver
bool enabled
state of driver
see https://upload.wikimedia.org/wikipedia/commons/2/2c/360_controller.svg for an explanation of the ...
unsigned time_stamp
time stamp can be used whether a change has happened between two states
unsigned button_flags
combination of flags in GamepadButtonStateFlags combined with the OR operation