1#include "stick_event.h"
17 default:
return "unknown";
23 unsigned _player_index,
unsigned _controller_index,
unsigned _stick_index,
double _time)
24 :
event(
EID_STICK, 0,0,_time), action(_action), position(_x, _y), difference(_dx, _dy),
25 player_index(_player_index), controller_index(_controller_index), stick_index(_stick_index)
36 return controller_index;
55 os <<
"<" << (int)player_index <<
":" << (
int)controller_index <<
":" << (int)stick_index <<
">";
60 std::cout <<
"not implemented" << std::endl;
virtual void stream_out(std::ostream &os) const
write to stream
vec2 difference
change in stick location
unsigned get_stick_index() const
return stick index
const vec2 & get_position() const
return current position
float get_last_x() const
return the last x value of the stick
float get_y() const
return the current y value of the stick
void stream_in(std::istream &is)
read from stream
const vec2 & get_difference() const
return the vector of coordinate differences (dx,dy)
vec2 position
current stick location
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
float get_dy() const
return the current change in y value of the stick
float get_last_y() const
return the last y value of the stick
unsigned get_controller_index() const
return controller index
unsigned char action
store stick action
void stream_out(std::ostream &os) const
write to stream
float get_dx() const
return the current change in x value of the stick
vec2 get_last_position() const
return last position
unsigned get_player_index() const
return player index
StickAction get_action() const
return the stick action
float get_x() const
return the current x value of the stick
std::string get_stick_action_string(StickAction action)
convert a key action into a readable string
StickAction
different actions that a stick can perform
@ SA_DRAG
stick moved in pressed state
@ SA_RELEASE
stick release action
@ SA_PRESS
stick press action
@ SA_TOUCH
stick touch action
@ SA_UNPRESS
stick unpress repeated press action
@ SA_MOVE
stick moved with respect to last event
@ EID_STICK
id of a stick event describing a two axis controller that optionally can be touched and pressed