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
XrPath binding;
49
struct
oxr_dpad_settings
settings;
50
};
51
52
/*!
53
* A entry in the dpad state for one action set.
54
*
55
* @ingroup oxr_input
56
*/
57
struct
oxr_dpad_entry
58
{
59
#ifdef XR_EXT_dpad_binding
60
struct
oxr_dpad_binding_modification
dpads[4];
61
uint32_t dpad_count;
62
#endif
63
64
uint64_t key;
65
};
66
67
/*!
68
* Holds dpad binding state for a single interaction profile.
69
*
70
* @ingroup oxr_input
71
*/
72
struct
oxr_dpad_state
73
{
74
struct
u_hashmap_int
*uhi;
75
};
76
77
78
/*
79
*
80
* Functions
81
*
82
*/
83
84
/*!
85
* Initialises a dpad state, has to be zero init before a call to this function.
86
*
87
* @public @memberof oxr_dpad_state
88
*/
89
bool
90
oxr_dpad_state_init(
struct
oxr_dpad_state
*state);
91
92
/*!
93
* Look for a entry in the state for the given action set key,
94
* returns NULL if no entry has been made for that action set.
95
*
96
* @public @memberof oxr_dpad_state
97
*/
98
struct
oxr_dpad_entry
*
99
oxr_dpad_state_get(
struct
oxr_dpad_state
*state, uint64_t key);
100
101
/*!
102
* Look for a entry in the state for the given action set key,
103
* allocates a new entry if none was found.
104
*
105
* @public @memberof oxr_dpad_state
106
*/
107
struct
oxr_dpad_entry
*
108
oxr_dpad_state_get_or_add(
struct
oxr_dpad_state
*state, uint64_t key);
109
110
/*!
111
* Frees all state and entries attached to this dpad state.
112
*
113
* @public @memberof oxr_dpad_state
114
*/
115
void
116
oxr_dpad_state_deinit(
struct
oxr_dpad_state
*state);
117
118
/*!
119
* Clones all oxr_dpad_state
120
* @param dst_dpad_state destination of cloning
121
* @param src_dpad_state source of cloning
122
*
123
* @public @memberof oxr_dpad_state
124
*/
125
bool
126
oxr_dpad_state_clone(
struct
oxr_dpad_state
*dst_dpad_state,
const
struct
oxr_dpad_state
*src_dpad_state);
127
128
129
#ifdef __cplusplus
130
}
131
#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_entry
A entry in the dpad state for one action set.
Definition
oxr_dpad_state.h:58
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:73
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