3#include <cgv/gui/key_event.h>
4#include <cgv/gui/throttle_event.h>
5#include <cgv/gui/stick_event.h>
6#include <cgv/gui/window.h>
7#include <cgv/signal/signal.h>
8#include <cgv/signal/bool_signal.h>
9#include <gamepad/gamepad.h>
31 void stream_out(std::ostream& os)
const;
45 float _x,
float _dx,
unsigned _player_index = 0,
unsigned _controller_index = 0,
unsigned _throttle_index = 0,
double _time = 0);
51 void stream_out(std::ostream& os)
const;
65 StickAction _action,
float _x,
float _y,
float _dx,
float _dy,
66 unsigned _player_index = 0,
unsigned _controller_index = 0,
unsigned _stick_index = 0,
double _time = 0);
68 void* get_device_handle()
const;
72 void stream_out(std::ostream& os)
const;
91 double last_device_scan;
92 double device_scan_interval;
93 std::vector<gamepad::gamepad_state> last_states;
94 std::vector<void*> device_handles;
103 void set_device_scan_interval(
double duration);
105 void check_and_emit_events(
double time);
107 cgv::signal::bool_signal<cgv::gui::event&>
on_event;
120#include <cgv/config/lib_end.h>
gamepad key events use the key codes defined in gamepad::GamepadKeys
const gamepad::gamepad_state & get_state() const
access to current gamepad state
void * get_device_handle() const
return the device id, by default returns 0
const gamepad::gamepad_state & state
public access to game state allows skipping of library dependency
void * device_handle
store id of gamepad
cgv::signal::bool_signal< cgv::gui::event & > on_event
signal emitted to dispatch events
cgv::signal::signal< void *, bool > on_device_change
signal emitted to notify about device changes, first argument is device handle and second whether dev...
GamepadEventTypeFlags get_event_type_flags() const
query the currently set event type flags
gamepad extension of stick events
void * device_handle
store id of gamepad
const gamepad::gamepad_state & state
public access to game state allows skipping of library dependency
gamepad extension of throttle events
const gamepad::gamepad_state & get_state() const
access to current gamepad state
const gamepad::gamepad_state & state
public access to game state allows skipping of library dependency
void * get_device_handle() const
return the device id, by default returns 0
void * device_handle
store id of gamepad
class to represent all possible keyboard events with the EID_KEY
class to represent stick events with the EID_STICK
class to represent events that inform on a change in a one axis controller with the EID_THROTTLE
KeyAction
different actions that a key can perform
gamepad_server & ref_gamepad_server()
return a reference to gamepad server singleton
StickAction
different actions that a stick can perform
GamepadEventTypeFlags
flags to define which events should be generated by server
void connect_gamepad_server(cgv::gui::window_ptr w)
connect the gamepad server to the given window or the first window of the application,...
see https://upload.wikimedia.org/wikipedia/commons/2/2c/360_controller.svg for an explanation of the ...