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;
161 void set_device_scan_interval(
double duration);
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);
188 void disable_log(
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
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,...
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...
double get_device_scan_interval() const
return the time interval in seconds to check for device connection changes
cgv::signal::bool_signal< cgv::gui::event & > on_event
signal emitted to dispatch events
helper struct for logging vr events
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,...
structure that stores all information describing the state of a VR kit