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/pose_event.h>
7#include <cgv/gui/event_handler.h>
9#include <cgv/gui/window.h>
10#include <cgv/signal/signal.h>
11#include <cgv/signal/bool_signal.h>
46 VRF_GRAB_EXCLUSIVE = 3,
48 VRF_GRAB_PERMANENT = 5,
49 VRF_GRAB_PERMANENT_AND_EXCLUSIVE = 7
138 double last_device_scan;
139 double device_scan_interval;
140 std::vector<void*> vr_kit_handles;
141 std::vector<vr::vr_kit_state> last_states;
142 std::vector<unsigned> last_time_stamps;
146 std::unordered_map<int, cgv::data::ref_ptr<vr::vr_log>> log_data;
165 void check_device_changes(
double time);
167 void check_and_emit_events(
double time);
169 bool check_new_state(
void* kit_handle,
const vr::vr_kit_state& new_state,
double time);
179 cgv::signal::bool_signal<cgv::gui::event&>
on_event;
186 void enable_log(
const std::string fn=
"",
const bool in_memory_log =
true,
const int filter=vr::vr_log::F_ALL,
const int kit_index = 0);
208#include <cgv/config/lib_end.h>
reference counted pointer, which can work together with types that are derived from ref_counted,...
interface for all classes that want to receive events
void enable_log(const std::string fn="", const bool in_memory_log=true, const int filter=vr::vr_log::F_ALL, const int kit_index=0)
cgv::signal::signal< void *, int, vr::VRStatus, vr::VRStatus > on_status_change
signal emitted to notify about status changes of trackables, first argument is handle,...
void disable_log(const int kit_index=0)
disable logging and close log file
cgv::data::ref_ptr< vr::vr_log > get_log(const int kit_index=0)
returns a pointer to the active log data container, meant for extending the lifetime of the log data ...
vr_server()
construct server with default configuration
void set_event_type_flags(VREventTypeFlags flags)
set the event type flags of to be emitted events
vr::vr_log & ref_log(const int kit_index=0)
return a reference to the used vr_log object
cgv::signal::signal< void *, bool > on_device_change
signal emitted to notify about device changes, first argument is handle and second a flag telling whe...
void emit_events_and_update_state(void *kit_handle, const vr::vr_kit_state &new_state, int kit_index, VREventTypeFlags flags, double time)
void set_device_scan_interval(double duration)
set time interval in seconds to check for device connection changes
double get_device_scan_interval() const
return the time interval in seconds to check for device connection changes
VREventTypeFlags get_event_type_flags() const
query the currently set event type flags
cgv::signal::bool_signal< cgv::gui::event & > on_event
signal emitted to dispatch events
helper struct for logging vr events
namespace that holds the abstract gui interface
data::ref_ptr< window > window_ptr
ref counted pointer to &window
vr_server & ref_vr_server()
return a reference to gamepad server singleton
VRFocus
different types of event focus grabbing
VREventTypeFlags
flags to define which events should be generated by server
@ VRE_ONE_AXIS_GENERATES_KEY
whether one axis events should generate a key event when passing inputs threshold value
@ VRE_TWO_AXES
pad / stick events
@ VRE_ONE_AXIS
trigger / throttle / pedal events
@ VRE_STATUS
status change events
@ VRE_TWO_AXES_GENERATES_DPAD
whether two axes input generates direction pad keys when presses
@ VRE_DEVICE
device change events
void connect_vr_server(bool connect_device_change_only_to_animation_trigger, cgv::gui::window_ptr w)
connect the gamepad server to the given window or the first window of the application,...
this header is dependency free
cgv::math::fvec< float, 2 > vec2
declare type of 2d single precision floating point vectors
structure that stores all information describing the state of a VR kit