VR-Engage  2.2
Loading...
Searching...
No Matches
inputData.h
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2025 MAK Technologies, Inc.
3** All rights reserved.
4******************************************************************************/
5
6//! \file
7//! \brief Defines data structures and enumerations for input device data
8
9#pragma once
10
11#include <vrvCore/DtKeyState.h>
12
13namespace makVre
14{
15//! \brief Enumeration of input device types
16//!
17//! Defines the various types of input devices supported by the system
18using DtDeviceName = enum DtDeviceType {
19 DtGamepad = 0, //!< Gamepad/controller device
20 DtJoystick, //!< Joystick device
21 DtKeyboard, //!< Keyboard device
22 DtMouse, //!< Mouse device
23 DtTouchController, //!< Touch-based controller device
24 DtOther //!< Other device types
25};
26
27//! \brief Enumeration of input event types
28//!
29//! Defines the various types of input events that can be generated by devices
31 DtInputTypeAxis = 0, //!< Axis movement (joystick, analog stick, etc.)
32 DtInputTypeButton, //!< Button press/release
33 DtInputTypeDoubleClick, //!< Double-click event
34 DtInputTypeHat, //!< Hat/POV switch event
35 DtInputTypeTrackBall, //!< Trackball movement
36 DtInputTypeMotion, //!< Motion-based input (accelerometer, etc.)
37 DtInputTypeScroll, //!< Scrolling input (mouse wheel, etc.)
38 DtInputTypeKey, //!< Keyboard key press/release
39 DtInputTypeInvalid //!< Invalid or unknown input type
40};
41
42//! \brief Enumeration of mouse button types
43//!
44//! Defines standard mouse buttons that can be used as input
46 DtLeftButton = 0, //!< Left mouse button
47 DtRightButton, //!< Right mouse button
48 DtMiddleButton //!< Middle mouse button (scroll wheel button)
49};
50
51//! \brief Enumeration of axis directions
52//!
53//! Defines standard axes that can be used for directional input
54using DtInputAxis = enum DtAxisFlags {
55 DtAxisNone = 0, //!< No axis specified
56 DtAxisX, //!< X-axis (horizontal)
57 DtAxisY, //!< Y-axis (vertical)
58 DtAxisZ //!< Z-axis (depth)
59};
60
61//! \brief Enumeration of hat/POV switch positions
62//!
63//! Defines the directional positions for a hat switch or POV controller
64//! with bit flags that can be combined for diagonal directions
65using DtHatFlags = enum DtHatFlags {
66 DtHatCentered = 0x00, //!< Hat in center/neutral position
67 DtHatUp = 0x01, //!< Hat in up position
68 DtHatRight = 0x02, //!< Hat in right position
69 DtHatDown = 0x04, //!< Hat in down position
70 DtHatLeft = 0x08, //!< Hat in left position
71 DtHatRightUp = DtHatRight | DtHatUp, //!< Hat in up-right diagonal position
72 DtHatRightDown = DtHatRight | DtHatDown, //!< Hat in down-right diagonal position
73 DtHatLeftUp = DtHatLeft | DtHatUp, //!< Hat in up-left diagonal position
74 DtHatLeftDown = DtHatLeft | DtHatDown, //!< Hat in down-left diagonal position
75 DtHatInvalid //!< Invalid hat position
76};
77
78//! \brief Alias for key modifier flags from DtKeyState
79//!
80//! Reuses the existing KeyModifier enum to represent input modifiers (Shift, Ctrl, Alt, etc.)
81using DtInputModifier = makVrv::DtKeyState::KeyModifier;
82
83//! \brief Structure for transferring input data through the input system
84//!
85//! Contains all information about an input event, including device information,
86//! input type, and value. This is the primary data structure used to communicate
87//! input events between devices and the input manager.
89{
90 //! \brief Type of device that generated the input
91 DtDeviceType myDeviceType;
92
93 //! \brief Name of the specific device instance
94 //!
95 //! When combined with device ID, uniquely identifies the source of the input
96 //! across all attached devices. If not set, the device type is used instead.
97 std::string myDeviceName;
98
99 //! \brief Index of the device instance, starting with 0
100 //!
101 //! Used to distinguish between multiple devices with the same name
103
104 //! \brief Timestamp when the input event occurred (simulation time)
106
107 //! \brief Type of input event (button press, axis movement, etc.)
109
110 //! \brief Identifier for the specific input control
111 //!
112 //! For DtInputTypeKey: ASCII character code
113 //! For DtInputTypeAxis: Axis index (0, 1, 2, etc.)
114 //! For DtInputTypeButton: Button index
116
117 //! \brief Value of the input event
118 //!
119 //! For buttons: 1.0 (pressed) or 0.0 (released)
120 //! For axes: Normalized value, typically -1.0 to 1.0
121 //! For other inputs: Depends on input type
123
124 //! \brief Optional flags specific to the input type
125 //!
126 //! For hat inputs: DtHatFlags values
127 //! For axis inputs: DtAxisFlags values
129
130 //! \brief Keyboard modifiers active during the input event
131 //!
132 //! Stores modifier key states (Ctrl, Alt, Shift, etc.)
133 int myModifiers = 0;
134};
135
136} // namespace makVre
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
enum DtHatFlags { DtHatCentered=0x00, DtHatUp=0x01, DtHatRight=0x02, DtHatDown=0x04, DtHatLeft=0x08, DtHatRightUp=DtHatRight|DtHatUp, DtHatRightDown=DtHatRight|DtHatDown, DtHatLeftUp=DtHatLeft|DtHatUp, DtHatLeftDown=DtHatLeft|DtHatDown, DtHatInvalid } DtHatFlags
Enumeration of hat/POV switch positions.
Definition inputData.h:65
makVrv::DtKeyState::KeyModifier DtInputModifier
Alias for key modifier flags from DtKeyState.
Definition inputData.h:81
enum DtAxisFlags { DtAxisNone=0, DtAxisX, DtAxisY, DtAxisZ } DtInputAxis
Enumeration of axis directions.
Definition inputData.h:54
enum DtInputType { DtInputTypeAxis=0, DtInputTypeButton, DtInputTypeDoubleClick, DtInputTypeHat, DtInputTypeTrackBall, DtInputTypeMotion, DtInputTypeScroll, DtInputTypeKey, DtInputTypeInvalid } DtInputType
Enumeration of input event types.
Definition inputData.h:30
enum DtMouseButton { DtLeftButton=0, DtRightButton, DtMiddleButton } DtMouseButton
Enumeration of mouse button types.
Definition inputData.h:45
enum DtDeviceType { DtGamepad=0, DtJoystick, DtKeyboard, DtMouse, DtTouchController, DtOther } DtDeviceName
Enumeration of input device types.
Definition inputData.h:18
Structure for transferring input data through the input system.
Definition inputData.h:89
int myModifiers
Keyboard modifiers active during the input event.
Definition inputData.h:133
DtDeviceType myDeviceType
Type of device that generated the input.
Definition inputData.h:91
int myInputFlags
Optional flags specific to the input type.
Definition inputData.h:128
std::string myDeviceName
Name of the specific device instance.
Definition inputData.h:97
DtInputType myInputType
Type of input event (button press, axis movement, etc.)
Definition inputData.h:108
int myInputID
Identifier for the specific input control.
Definition inputData.h:115
double myTimestamp
Timestamp when the input event occurred (simulation time)
Definition inputData.h:105
int myDeviceIndex
Index of the device instance, starting with 0.
Definition inputData.h:102
float myInputValue
Value of the input event.
Definition inputData.h:122