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

vr key events use the key codes defined in vr::VRKeys More...

#include <vr_events.h>

Inheritance diagram for cgv::gui::vr_key_event:
cgv::gui::key_event cgv::gui::vr_event_extension cgv::gui::event

Public Member Functions

 vr_key_event (void *_device_handle, unsigned _player_index, unsigned _controller_index, const vr::vr_kit_state &_state, unsigned short _key=0, KeyAction _action=KA_PRESS, unsigned char _char=0, unsigned char _modifiers=0, double _time=0)
 construct a key event from given parameters
 
void * get_device_id () const
 return the device id, by default returns 0
 
unsigned get_controller_index () const
 return controller index (0 .. vr::max_nr_controllers-1), controllers with left and right hand role are sorted to indices 0 and 1
 
unsigned get_player_index () const
 return player index
 
void stream_out (std::ostream &os) const
 write to stream
 
void stream_in (std::istream &is)
 read from stream
 
- Public Member Functions inherited from cgv::gui::key_event
 key_event (unsigned short _key=0, KeyAction _action=KA_PRESS, unsigned char _char=0, unsigned char _modifiers=0, unsigned char _toggle_keys=0, double _time=0, int _x=0, int _y=0)
 construct a key event from its textual description
 
unsigned short get_key () const
 return the key being a capital letter, digit or a value from the Keys enum
 
void set_key (unsigned short _key)
 set the key
 
KeyAction get_action () const
 return the key event action
 
void set_action (KeyAction _action)
 set the key event action
 
unsigned char get_char () const
 return the key as a character
 
void set_char (unsigned char _char)
 set the alpha numeric character
 
short get_x () const
 current mouse x position (origin is top-left of window)
 
short get_y () const
 current mouse y position (origin is top-left of window)
 
- 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
 
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
 
- Public Member Functions inherited from cgv::gui::vr_event_extension
 vr_event_extension (void *_device_handle, const vr::vr_kit_state &_state)
 construct extension from device handle and vr state
 
void * get_device_handle () const
 return the device id, by default returns 0
 
const vr::vr_kit_stateget_state () const
 return the state of vr kit
 

Protected Attributes

unsigned short controller_index
 store index of controller (0 .. vr::max_nr_controllers-1), controllers with left and right hand role are sorted to indices 0 and 1
 
unsigned short player_index
 store player index
 
- Protected Attributes inherited from cgv::gui::key_event
unsigned short key
 store the pressed key
 
unsigned char action
 store whether
 
unsigned char character
 store the corresponding ascii character
 
short x
 x position of mouse pointer
 
short y
 y position of mouse pointer
 
- 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
 
- Protected Attributes inherited from cgv::gui::vr_event_extension
void * device_handle
 store device handle
 
const vr::vr_kit_statestate
 access to current vr state
 

Detailed Description

vr key events use the key codes defined in vr::VRKeys

Definition at line 39 of file vr_events.h.

Constructor & Destructor Documentation

◆ vr_key_event()

cgv::gui::vr_key_event::vr_key_event ( void *  _device_handle,
unsigned  _player_index,
unsigned  _controller_index,
const vr::vr_kit_state _state,
unsigned short  _key = 0,
KeyAction  _action = KA_PRESS,
unsigned char  _char = 0,
unsigned char  _modifiers = 0,
double  _time = 0 
)

construct a key event from given parameters

construct a key event from its textual description

Definition at line 13 of file vr_events.cxx.

References cgv::gui::EF_VR, and cgv::gui::event::flags.

Member Function Documentation

◆ get_controller_index()

unsigned cgv::gui::vr_key_event::get_controller_index ( ) const
inline

return controller index (0 .. vr::max_nr_controllers-1), controllers with left and right hand role are sorted to indices 0 and 1

Definition at line 54 of file vr_events.h.

Referenced by vr_test::handle().

◆ get_device_id()

void * cgv::gui::vr_key_event::get_device_id ( ) const
inlinevirtual

return the device id, by default returns 0

Reimplemented from cgv::gui::event.

Definition at line 52 of file vr_events.h.

◆ get_player_index()

unsigned cgv::gui::vr_key_event::get_player_index ( ) const
inline

return player index

Definition at line 56 of file vr_events.h.

◆ stream_in()

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

read from stream

Reimplemented from cgv::gui::key_event.

Definition at line 45 of file vr_events.cxx.

References cgv::gui::key_event::stream_in().

◆ stream_out()

Member Data Documentation

◆ controller_index

unsigned short cgv::gui::vr_key_event::controller_index
protected

store index of controller (0 .. vr::max_nr_controllers-1), controllers with left and right hand role are sorted to indices 0 and 1

Definition at line 43 of file vr_events.h.

Referenced by stream_out().

◆ player_index

unsigned short cgv::gui::vr_key_event::player_index
protected

store player index

Definition at line 45 of file vr_events.h.

Referenced by stream_out().


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