Monado OpenXR Runtime
Loading...
Searching...
No Matches
oxr_dpad_state.h
Go to the documentation of this file.
1
// Copyright 2022, Collabora, Ltd.
2
// Copyright 2026, NVIDIA CORPORATION.
3
// SPDX-License-Identifier: BSL-1.0
4
/*!
5
* @file
6
* @brief Holds dpad state related functions.
7
* @author Jakob Bornecrantz <jakob@collabora.com>
8
* @author Korcan Hussein <korcan.hussein@collabora.com>
9
* @ingroup oxr_main
10
*/
11
12
#pragma once
13
14
#include "
oxr_defines.h
"
15
#include "oxr_extension_support.h"
16
17
18
#ifdef __cplusplus
19
extern
"C"
{
20
#endif
21
22
23
/*
24
*
25
* Structs
26
*
27
*/
28
29
/*!
30
* dpad settings we need extracted from XrInteractionProfileDpadBindingEXT
31
*
32
* @ingroup oxr_input
33
*/
34
struct
oxr_dpad_settings
35
{
36
float
forceThreshold;
37
float
forceThresholdReleased;
38
float
centerRegion;
39
float
wedgeAngle;
40
bool
isSticky;
41
};
42
43
/*!
44
* dpad binding extracted from XrInteractionProfileDpadBindingEXT
45
*/
46
struct
oxr_dpad_binding_modification
47
{
48
/*!
49
* Binding path from XrInteractionProfileDpadBindingEXT::binding.
50
*
51
* This is set while processing xrSuggestInteractionProfileBindings, when
52
* oxr_api_action.c copies each dpad binding modification into the
53
* interaction profile's dpad state. It names the DPAD emulator path that
54
* the modification applies to, for example
55
* `/user/hand/left/input/thumbstick`.
56
*/
57
XrPath
binding
;
58
59
struct
oxr_dpad_settings
settings;
60
};
61
62
/*!
63
* A entry in the dpad state for one action set.
64
*
65
* @ingroup oxr_input
66
*/
67
struct
oxr_dpad_entry
68
{
69
#ifdef XR_EXT_dpad_binding
70
struct
oxr_dpad_binding_modification
dpads[4];
71
uint32_t dpad_count;
72
#endif
73
74
uint64_t key;
75
};
76
77
/*!
78
* Holds dpad binding state for a single interaction profile.
79
*
80
* @ingroup oxr_input
81
*/
82
struct
oxr_dpad_state
83
{
84
struct
u_hashmap_int
*uhi;
85
};
86
87
88
/*
89
*
90
* Functions
91
*
92
*/
93
94
/*!
95
* Initialises a dpad state, has to be zero init before a call to this function.
96
*
97
* @public @memberof oxr_dpad_state
98
*/
99
bool
100
oxr_dpad_state_init(
struct
oxr_dpad_state
*state);
101
102
/*!
103
* Look for a entry in the state for the given action set key,
104
* returns NULL if no entry has been made for that action set.
105
*
106
* @public @memberof oxr_dpad_state
107
*/
108
const
struct
oxr_dpad_entry
*
109
oxr_dpad_state_get(
const
struct
oxr_dpad_state
*state, uint64_t key);
110
111
/*!
112
* Look for a entry in the state for the given action set key,
113
* allocates a new entry if none was found.
114
*
115
* @public @memberof oxr_dpad_state
116
*/
117
struct
oxr_dpad_entry
*
118
oxr_dpad_state_get_or_add(
struct
oxr_dpad_state
*state, uint64_t key);
119
120
/*!
121
* Frees all state and entries attached to this dpad state.
122
*
123
* @public @memberof oxr_dpad_state
124
*/
125
void
126
oxr_dpad_state_deinit(
struct
oxr_dpad_state
*state);
127
128
/*!
129
* Clones all oxr_dpad_state
130
* @param dst_dpad_state destination of cloning
131
* @param src_dpad_state source of cloning
132
*
133
* @public @memberof oxr_dpad_state
134
*/
135
bool
136
oxr_dpad_state_clone(
struct
oxr_dpad_state
*dst_dpad_state,
const
struct
oxr_dpad_state
*src_dpad_state);
137
138
139
#ifdef __cplusplus
140
}
141
#endif
oxr_defines.h
Shared internal defines and enums in the state tracker.
oxr_dpad_binding_modification
dpad binding extracted from XrInteractionProfileDpadBindingEXT
Definition
oxr_dpad_state.h:47
oxr_dpad_binding_modification::binding
XrPath binding
Binding path from XrInteractionProfileDpadBindingEXT::binding.
Definition
oxr_dpad_state.h:57
oxr_dpad_entry
A entry in the dpad state for one action set.
Definition
oxr_dpad_state.h:68
oxr_dpad_settings
dpad settings we need extracted from XrInteractionProfileDpadBindingEXT
Definition
oxr_dpad_state.h:35
oxr_dpad_state
Holds dpad binding state for a single interaction profile.
Definition
oxr_dpad_state.h:83
u_hashmap_int
A simple uint64_t key to a void pointer hashmap.
Definition
u_hashmap.cpp:24
state_trackers
oxr
actions
oxr_dpad_state.h
Generated by
1.9.8