Monado OpenXR Runtime
Qwerty driver

Driver for emulated HMD and controllers through keyboard and mouse. More...

Collaboration diagram for Qwerty driver:

Files

file  qwerty_device.c
 Implementation of qwerty_device related methods.
 
file  qwerty_device.h
 Internal header for qwerty_device and its friends.
 
file  qwerty_interface.h
 Interface to Qwerty driver.
 
file  qwerty_prober.c
 Qwerty devices autoprober.
 
file  qwerty_sdl.c
 Connection between user-generated SDL events and qwerty devices.
 
file  target_builder_qwerty.c
 Qwerty devices builder.
 

Data Structures

struct  qwerty_system
 Container of qwerty devices and driver properties. More...
 
struct  qwerty_device
 Fake device that modifies its tracked pose through its methods. More...
 
struct  qwerty_hmd
 
struct  qwerty_controller
 Supports input actions and can be attached to the HMD pose. More...
 

Macros

#define QWERTY_HMD_STR   "Qwerty HMD"
 
#define QWERTY_HMD_TRACKER_STR   QWERTY_HMD_STR " Tracker"
 
#define QWERTY_LEFT_STR   "Qwerty Left Controller"
 
#define QWERTY_LEFT_TRACKER_STR   QWERTY_LEFT_STR " Tracker"
 
#define QWERTY_RIGHT_STR   "Qwerty Right Controller"
 
#define QWERTY_RIGHT_TRACKER_STR   QWERTY_RIGHT_STR " Tracker"
 

Functions

void qwerty_process_event (struct xrt_device **xdevs, size_t xdev_count, SDL_Event event)
 Process an SDL_Event (like a key press) and dispatches a suitable action to the appropriate qwerty_device. More...
 
xrt_result_t qwerty_create_devices (enum u_logging_level log_level, struct xrt_device **out_hmd, struct xrt_device **out_left, struct xrt_device **out_right)
 Create all qwerty devices. More...
 
struct qwerty_systemqwerty_system::qwerty_system_create (struct qwerty_hmd *qhmd, struct qwerty_controller *qleft, struct qwerty_controller *qright, enum u_logging_level log_level)
 
struct qwerty_deviceqwerty_device::qwerty_device (struct xrt_device *xd)
 Cast to qwerty_device. More...
 
void qwerty_device::qwerty_press_left (struct qwerty_device *qd)
 
void qwerty_device::qwerty_release_left (struct qwerty_device *qd)
 
void qwerty_device::qwerty_press_right (struct qwerty_device *qd)
 
void qwerty_device::qwerty_release_right (struct qwerty_device *qd)
 
void qwerty_device::qwerty_press_forward (struct qwerty_device *qd)
 
void qwerty_device::qwerty_release_forward (struct qwerty_device *qd)
 
void qwerty_device::qwerty_press_backward (struct qwerty_device *qd)
 
void qwerty_device::qwerty_release_backward (struct qwerty_device *qd)
 
void qwerty_device::qwerty_press_up (struct qwerty_device *qd)
 
void qwerty_device::qwerty_release_up (struct qwerty_device *qd)
 
void qwerty_device::qwerty_press_down (struct qwerty_device *qd)
 
void qwerty_device::qwerty_release_down (struct qwerty_device *qd)
 
void qwerty_device::qwerty_press_look_left (struct qwerty_device *qd)
 
void qwerty_device::qwerty_release_look_left (struct qwerty_device *qd)
 
void qwerty_device::qwerty_press_look_right (struct qwerty_device *qd)
 
void qwerty_device::qwerty_release_look_right (struct qwerty_device *qd)
 
void qwerty_device::qwerty_press_look_up (struct qwerty_device *qd)
 
void qwerty_device::qwerty_release_look_up (struct qwerty_device *qd)
 
void qwerty_device::qwerty_press_look_down (struct qwerty_device *qd)
 
void qwerty_device::qwerty_release_look_down (struct qwerty_device *qd)
 
void qwerty_device::qwerty_press_sprint (struct qwerty_device *qd)
 Momentarily increase movement_speed until qwerty_release_sprint() More...
 
void qwerty_device::qwerty_release_sprint (struct qwerty_device *qd)
 Stop doing what qwerty_press_sprint started. More...
 
void qwerty_device::qwerty_add_look_delta (struct qwerty_device *qd, float yaw, float pitch)
 Add yaw and pitch movement for the next frame. More...
 
void qwerty_device::qwerty_change_movement_speed (struct qwerty_device *qd, float steps)
 Change movement speed in exponential steps (usually integers, but any float allowed) More...
 
void qwerty_device::qwerty_release_all (struct qwerty_device *qd)
 Release all movement input. More...
 
struct qwerty_hmdqwerty_hmd::qwerty_hmd_create (void)
 Create qwerty_hmd. More...
 
struct qwerty_hmdqwerty_hmd::qwerty_hmd (struct xrt_device *xd)
 Cast to qwerty_hmd. More...
 
struct qwerty_controllerqwerty_controller::qwerty_controller_create (bool is_left, struct qwerty_hmd *qhmd)
 Create qwerty_controller. More...
 
struct qwerty_controllerqwerty_controller::qwerty_controller (struct xrt_device *xd)
 Cast to qwerty_controller. More...
 
void qwerty_controller::qwerty_press_trigger (struct qwerty_controller *qc)
 Simulate pressing input/trigger/value to 1.0. More...
 
void qwerty_controller::qwerty_release_trigger (struct qwerty_controller *qc)
 Simulate releasing input/trigger/value to 0.0. More...
 
void qwerty_controller::qwerty_press_menu (struct qwerty_controller *qc)
 Simulate pressing input/menu/click. More...
 
void qwerty_controller::qwerty_release_menu (struct qwerty_controller *qc)
 Simulate releasing input/menu/click. More...
 
void qwerty_controller::qwerty_press_squeeze (struct qwerty_controller *qc)
 Simulate pressing input/squeeze/click. More...
 
void qwerty_controller::qwerty_release_squeeze (struct qwerty_controller *qc)
 Simulate releasing input/squeeze/click. More...
 
void qwerty_controller::qwerty_press_system (struct qwerty_controller *qc)
 Simulate pressing input/system/click. More...
 
void qwerty_controller::qwerty_release_system (struct qwerty_controller *qc)
 Simulate releasing input/system/click. More...
 
void qwerty_controller::qwerty_press_thumbstick_left (struct qwerty_controller *qc)
 
void qwerty_controller::qwerty_release_thumbstick_left (struct qwerty_controller *qc)
 
void qwerty_controller::qwerty_press_thumbstick_right (struct qwerty_controller *qc)
 
void qwerty_controller::qwerty_release_thumbstick_right (struct qwerty_controller *qc)
 
void qwerty_controller::qwerty_press_thumbstick_up (struct qwerty_controller *qc)
 
void qwerty_controller::qwerty_release_thumbstick_up (struct qwerty_controller *qc)
 
void qwerty_controller::qwerty_press_thumbstick_down (struct qwerty_controller *qc)
 
void qwerty_controller::qwerty_release_thumbstick_down (struct qwerty_controller *qc)
 
void qwerty_controller::qwerty_press_thumbstick_click (struct qwerty_controller *qc)
 
void qwerty_controller::qwerty_release_thumbstick_click (struct qwerty_controller *qc)
 
void qwerty_controller::qwerty_press_trackpad_left (struct qwerty_controller *qc)
 
void qwerty_controller::qwerty_release_trackpad_left (struct qwerty_controller *qc)
 
void qwerty_controller::qwerty_press_trackpad_right (struct qwerty_controller *qc)
 
void qwerty_controller::qwerty_release_trackpad_right (struct qwerty_controller *qc)
 
void qwerty_controller::qwerty_press_trackpad_up (struct qwerty_controller *qc)
 
void qwerty_controller::qwerty_release_trackpad_up (struct qwerty_controller *qc)
 
void qwerty_controller::qwerty_press_trackpad_down (struct qwerty_controller *qc)
 
void qwerty_controller::qwerty_release_trackpad_down (struct qwerty_controller *qc)
 
void qwerty_controller::qwerty_press_trackpad_click (struct qwerty_controller *qc)
 
void qwerty_controller::qwerty_release_trackpad_click (struct qwerty_controller *qc)
 
void qwerty_controller::qwerty_follow_hmd (struct qwerty_controller *qc, bool follow)
 Attach/detach the pose of qc to its HMD. More...
 
void qwerty_controller::qwerty_reset_controller_pose (struct qwerty_controller *qc)
 Reset controller to initial pose and makes it follow the HMD. More...
 

Detailed Description

Driver for emulated HMD and controllers through keyboard and mouse.

Function Documentation

◆ qwerty_add_look_delta()

void qwerty_add_look_delta ( struct qwerty_device qd,
float  yaw,
float  pitch 
)

Add yaw and pitch movement for the next frame.

References qwerty_device::look_speed, qwerty_device::pitch_delta, and qwerty_device::yaw_delta.

◆ qwerty_change_movement_speed()

void qwerty_change_movement_speed ( struct qwerty_device qd,
float  steps 
)

Change movement speed in exponential steps (usually integers, but any float allowed)

References qwerty_device::movement_speed.

◆ qwerty_controller()

struct qwerty_controller * qwerty_controller ( struct xrt_device xd)

Cast to qwerty_controller.

Ensures returning a valid controller or crashing.

◆ qwerty_controller_create()

struct qwerty_controller * qwerty_controller_create ( bool  is_left,
struct qwerty_hmd qhmd 
)

Create qwerty_controller.

Crash on failure.

◆ qwerty_create_devices()

xrt_result_t qwerty_create_devices ( enum u_logging_level  log_level,
struct xrt_device **  out_hmd,
struct xrt_device **  out_left,
struct xrt_device **  out_right 
)

#include <drivers/qwerty/qwerty_interface.h>

Create all qwerty devices.

◆ qwerty_device()

struct qwerty_device * qwerty_device ( struct xrt_device xd)

Cast to qwerty_device.

Ensures returning a valid device or crashing.

◆ qwerty_follow_hmd()

◆ qwerty_hmd()

struct qwerty_hmd * qwerty_hmd ( struct xrt_device xd)

Cast to qwerty_hmd.

Ensures returning a valid HMD or crashing.

◆ qwerty_hmd_create()

struct qwerty_hmd * qwerty_hmd_create ( void  )

Create qwerty_hmd.

Crash on failure.

◆ qwerty_press_menu()

void qwerty_press_menu ( struct qwerty_controller qc)

Simulate pressing input/menu/click.

References os_monotonic_get_ns().

◆ qwerty_press_sprint()

void qwerty_press_sprint ( struct qwerty_device qd)

Momentarily increase movement_speed until qwerty_release_sprint()

References qwerty_device::sprint_pressed.

◆ qwerty_press_squeeze()

void qwerty_press_squeeze ( struct qwerty_controller qc)

Simulate pressing input/squeeze/click.

References os_monotonic_get_ns().

◆ qwerty_press_system()

void qwerty_press_system ( struct qwerty_controller qc)

Simulate pressing input/system/click.

References os_monotonic_get_ns().

◆ qwerty_press_trigger()

void qwerty_press_trigger ( struct qwerty_controller qc)

Simulate pressing input/trigger/value to 1.0.

References os_monotonic_get_ns().

◆ qwerty_process_event()

void qwerty_process_event ( struct xrt_device **  xdevs,
size_t  xdev_count,
SDL_Event  event 
)

#include <drivers/qwerty/qwerty_interface.h>

Process an SDL_Event (like a key press) and dispatches a suitable action to the appropriate qwerty_device.

Note
A qwerty_controller might not be in use (for example if you have physical controllers connected), though its memory will be modified by these events regardless. A qwerty_hmd not in use will not be modified as it never gets created.

◆ qwerty_release_all()

void qwerty_release_all ( struct qwerty_device qd)

◆ qwerty_release_menu()

void qwerty_release_menu ( struct qwerty_controller qc)

Simulate releasing input/menu/click.

References os_monotonic_get_ns().

◆ qwerty_release_sprint()

void qwerty_release_sprint ( struct qwerty_device qd)

Stop doing what qwerty_press_sprint started.

References qwerty_device::sprint_pressed.

◆ qwerty_release_squeeze()

void qwerty_release_squeeze ( struct qwerty_controller qc)

Simulate releasing input/squeeze/click.

References os_monotonic_get_ns().

◆ qwerty_release_system()

void qwerty_release_system ( struct qwerty_controller qc)

Simulate releasing input/system/click.

References os_monotonic_get_ns().

◆ qwerty_release_trigger()

void qwerty_release_trigger ( struct qwerty_controller qc)

Simulate releasing input/trigger/value to 0.0.

References os_monotonic_get_ns().

◆ qwerty_reset_controller_pose()

void qwerty_reset_controller_pose ( struct qwerty_controller qc)

Reset controller to initial pose and makes it follow the HMD.

References qwerty_system::hmd, and qwerty_device::sys.