cgv
|
gamepad extension of stick events More...
#include <gamepad_server.h>
Public Member Functions | |
gamepad_stick_event (void *_device_handle, gamepad::gamepad_state &_state, StickAction _action, float _x, float _y, float _dx, float _dy, unsigned _player_index=0, unsigned _controller_index=0, unsigned _stick_index=0, double _time=0) | |
construct a key event from its textual description | |
void * | get_device_handle () const |
return the device id, by default returns 0 | |
const gamepad::gamepad_state & | get_state () const |
access to current gamepad state | |
void | stream_out (std::ostream &os) const |
write to stream | |
![]() | |
stick_event (StickAction _action, float _x, float _y, float _dx, float _dy, unsigned _player_index=0, unsigned _controller_index=0, unsigned _stick_index=0, double _time=0) | |
construct a key event from its textual description | |
void | stream_out (std::ostream &os) const |
write to stream | |
void | stream_in (std::istream &is) |
read from stream | |
StickAction | get_action () const |
return the stick action | |
unsigned | get_player_index () const |
return player index | |
unsigned | get_controller_index () const |
return controller index | |
unsigned | get_stick_index () const |
return stick index | |
float | get_x () const |
return the current x value of the stick | |
float | get_y () const |
return the current y value of the stick | |
const vec2 & | get_position () const |
return current position | |
float | get_dx () const |
return the current change in x value of the stick | |
float | get_dy () const |
return the current change in y value of the stick | |
const vec2 & | get_difference () const |
return the vector of coordinate differences (dx,dy) | |
float | get_last_x () const |
return the last x value of the stick | |
float | get_last_y () const |
return the last y value of the stick | |
vec2 | get_last_position () const |
return last position | |
![]() | |
event (unsigned int _kind=EID_NONE, unsigned char _modifiers=0, unsigned char _toggle_keys=0, double _time=0) | |
construct event from its kind | |
virtual | ~event () |
virtual destructor for events | |
virtual void * | get_device_id () const |
return the device id, by default returns 0 | |
void | set_kind (unsigned char _kind) |
set the kind of the event | |
unsigned | get_kind () const |
return, what kind of event this is, typically a value from the EventId enum | |
void | set_flags (unsigned char _flags) |
return the set the event flags | |
unsigned | get_flags () const |
return the event flags | |
void | set_modifiers (unsigned char _modifiers) |
set the modifiers | |
unsigned char | get_modifiers () const |
return the active modifiers as values from EventModifier combined with a logical or-operation | |
void | set_toggle_keys (unsigned char _toggle_keys) |
set the state of the toggle keys | |
unsigned char | get_toggle_keys () const |
return the state of the toggle keys as values from EventToggleKeys combined with a logical or-operation | |
void | set_time (const double &_time) |
set the time of the event | |
double | get_time () const |
return the time of the event in seconds | |
Protected Attributes | |
void * | device_handle |
store id of gamepad | |
const gamepad::gamepad_state & | state |
public access to game state allows skipping of library dependency | |
![]() | |
unsigned char | player_index |
unsigned char | controller_index |
unsigned char | stick_index |
unsigned char | action |
store stick action | |
vec2 | position |
current stick location | |
vec2 | difference |
change in stick location | |
![]() | |
unsigned char | kind |
store which kind of event we have | |
unsigned char | flags |
store event flags | |
unsigned char | modifiers |
store the active modifiers | |
unsigned char | toggle_keys |
store the active toggle keys | |
double | time |
store the time of the event in seconds | |
gamepad extension of stick events
Definition at line 55 of file gamepad_server.h.
cgv::gui::gamepad_stick_event::gamepad_stick_event | ( | void * | _device_handle, |
gamepad::gamepad_state & | _state, | ||
StickAction | _action, | ||
float | _x, | ||
float | _y, | ||
float | _dx, | ||
float | _dy, | ||
unsigned | _player_index = 0 , |
||
unsigned | _controller_index = 0 , |
||
unsigned | _stick_index = 0 , |
||
double | _time = 0 |
||
) |
construct a key event from its textual description
Definition at line 52 of file gamepad_server.cxx.
References cgv::gui::EF_PAD, and cgv::gui::event::flags.
void * cgv::gui::gamepad_stick_event::get_device_handle | ( | ) | const |
return the device id, by default returns 0
Definition at line 61 of file gamepad_server.cxx.
References device_handle.
const gamepad::gamepad_state & cgv::gui::gamepad_stick_event::get_state | ( | ) | const |
|
virtual |
write to stream
Reimplemented from cgv::gui::event.
Definition at line 66 of file gamepad_server.cxx.
References device_handle, and cgv::gui::stick_event::stream_out().
|
protected |
store id of gamepad
Definition at line 59 of file gamepad_server.h.
Referenced by get_device_handle(), and stream_out().
|
protected |
public access to game state allows skipping of library dependency
Definition at line 61 of file gamepad_server.h.
Referenced by get_state().