cgv
Loading...
Searching...
No Matches
cgv::gui::stick_event Class Reference

class to represent stick events with the EID_STICK More...

#include <stick_event.h>

Inheritance diagram for cgv::gui::stick_event:
cgv::gui::event cgv::gui::gamepad_stick_event cgv::gui::vr_stick_event

Public Member Functions

 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
Public Member Functions inherited from cgv::gui::event
 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

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
Protected Attributes inherited from cgv::gui::event
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

Detailed Description

class to represent stick events with the EID_STICK

Definition at line 28 of file stick_event.h.

Constructor & Destructor Documentation

◆ stick_event()

cgv::gui::stick_event::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

Definition at line 22 of file stick_event.cxx.

References action, difference, cgv::gui::EID_STICK, cgv::gui::event::event(), and position.

Referenced by cgv::gui::gamepad_stick_event::gamepad_stick_event(), and cgv::gui::vr_stick_event::vr_stick_event().

Member Function Documentation

◆ get_action()

StickAction cgv::gui::stick_event::get_action ( ) const

return the stick action

Definition at line 63 of file stick_event.cxx.

References action.

Referenced by vr_test::handle().

◆ get_controller_index()

unsigned cgv::gui::stick_event::get_controller_index ( ) const

return controller index

Definition at line 34 of file stick_event.cxx.

Referenced by vr_test::handle().

◆ get_difference()

const vec2 & cgv::gui::stick_event::get_difference ( ) const

return the vector of coordinate differences (dx,dy)

Definition at line 95 of file stick_event.cxx.

References difference.

◆ get_dx()

float cgv::gui::stick_event::get_dx ( ) const

return the current change in x value of the stick

Definition at line 79 of file stick_event.cxx.

References difference.

◆ get_dy()

float cgv::gui::stick_event::get_dy ( ) const

return the current change in y value of the stick

Definition at line 84 of file stick_event.cxx.

References difference.

◆ get_last_position()

vec2 cgv::gui::stick_event::get_last_position ( ) const

return last position

Definition at line 101 of file stick_event.cxx.

References difference, and position.

◆ get_last_x()

float cgv::gui::stick_event::get_last_x ( ) const

return the last x value of the stick

Definition at line 107 of file stick_event.cxx.

References difference, and position.

Referenced by vr_test::handle().

◆ get_last_y()

float cgv::gui::stick_event::get_last_y ( ) const

return the last y value of the stick

Definition at line 112 of file stick_event.cxx.

References difference, and position.

Referenced by vr_test::handle().

◆ get_player_index()

unsigned cgv::gui::stick_event::get_player_index ( ) const

return player index

Definition at line 29 of file stick_event.cxx.

◆ get_position()

const vec2 & cgv::gui::stick_event::get_position ( ) const

return current position

Definition at line 89 of file stick_event.cxx.

References position.

◆ get_stick_index()

unsigned cgv::gui::stick_event::get_stick_index ( ) const

return stick index

Definition at line 39 of file stick_event.cxx.

Referenced by vr_test::handle().

◆ get_x()

float cgv::gui::stick_event::get_x ( ) const

return the current x value of the stick

Definition at line 69 of file stick_event.cxx.

References position.

Referenced by vr_test::handle().

◆ get_y()

float cgv::gui::stick_event::get_y ( ) const

return the current y value of the stick

Definition at line 74 of file stick_event.cxx.

References position.

Referenced by vr_test::handle().

◆ stream_in()

void cgv::gui::stick_event::stream_in ( std::istream & is)
virtual

read from stream

Reimplemented from cgv::gui::event.

Definition at line 58 of file stick_event.cxx.

◆ stream_out()

void cgv::gui::stick_event::stream_out ( std::ostream & os) const
virtual

Member Data Documentation

◆ action

unsigned char cgv::gui::stick_event::action
protected

store stick action

Definition at line 34 of file stick_event.h.

Referenced by get_action(), stick_event(), and stream_out().

◆ controller_index

unsigned char cgv::gui::stick_event::controller_index
protected

Definition at line 32 of file stick_event.h.

◆ difference

vec2 cgv::gui::stick_event::difference
protected

change in stick location

Definition at line 38 of file stick_event.h.

Referenced by get_difference(), get_dx(), get_dy(), get_last_position(), get_last_x(), get_last_y(), stick_event(), and stream_out().

◆ player_index

unsigned char cgv::gui::stick_event::player_index
protected

Definition at line 32 of file stick_event.h.

◆ position

vec2 cgv::gui::stick_event::position
protected

current stick location

Definition at line 36 of file stick_event.h.

Referenced by get_last_position(), get_last_x(), get_last_y(), get_position(), get_x(), get_y(), stick_event(), and stream_out().

◆ stick_index

unsigned char cgv::gui::stick_event::stick_index
protected

Definition at line 32 of file stick_event.h.


The documentation for this class was generated from the following files: