docs
Docs
C++ API
C API
Search API
Ctrl K
1.4
2.0
latest
1.4
Ultralight C++ API
1.4.0
Toggle main menu visibility
Loading...
Searching...
No Matches
GamepadEvent.h
Go to the documentation of this file.
1
/**************************************************************************************************
2
* This file is a part of Ultralight. *
3
* *
4
* See <https://ultralig.ht> for licensing and more. *
5
* *
6
* (C) 2024 Ultralight, Inc. *
7
**************************************************************************************************/
8
#pragma once
9
#include <
Ultralight/Defines.h
>
10
#include <
Ultralight/String.h
>
11
12
namespace
ultralight
{
13
14
///
15
/// Event representing a change in gamepad connection state.
16
///
17
/// @see Renderer::FireGamepadEvent
18
///
19
class
UExport
GamepadEvent
{
20
public
:
21
///
22
/// The various GamepadEvent types.
23
///
24
enum
Type
{
25
///
26
/// This event type should be fired when a gamepad is connected.
27
///
28
/// @note You will need to previously declare the gamepad, its index, and details about
29
/// its axis and button layout via Renderer::SetGamepadDetails prior to calling
30
/// Renderer::FireGamepadEvent.
31
///
32
kType_GamepadConnected
,
33
34
///
35
/// This event type should be fired when a gamepad is disconnected.
36
///
37
kType_GamepadDisconnected
,
38
};
39
40
///
41
// The type of this GamepadEvent
42
///
43
Type
type
;
44
45
///
46
/// The index of the gamepad, this should match the value previously set in
47
/// Renderer::SetGamepadDetails.
48
///
49
uint32_t
index
;
50
};
51
52
///
53
/// Event representing a change in gamepad axis state (eg, pressing a stick in a certain direction).
54
///
55
/// @see Renderer::FireGamepadAxisEvent
56
///
57
class
UExport
GamepadAxisEvent
{
58
public
:
59
///
60
/// The index of the gamepad, this should match the value previously set in
61
/// Renderer::SetGamepadDetails.
62
///
63
uint32_t
index
;
64
65
///
66
/// The index of the axis whose value has changed.
67
///
68
/// This value should be in the range previously set in Renderer::SetGamepadDetails.
69
///
70
uint32_t
axis_index
;
71
72
///
73
/// The new value of the axis.
74
///
75
/// This value should be normalized to the range [-1.0, 1.0].
76
///
77
double
value
;
78
};
79
80
///
81
/// Event representing a change in gamepad button state (eg, pressing a button on a gamepad).
82
///
83
/// @see Renderer::FireGamepadButtonEvent
84
///
85
class
UExport
GamepadButtonEvent
{
86
public
:
87
///
88
/// The index of the gamepad, this should match the value previously set in
89
/// Renderer::SetGamepadDetails.
90
///
91
uint32_t
index
;
92
93
///
94
/// The index of the button whose value has changed.
95
///
96
/// This value should be in the range previously set in Renderer::SetGamepadDetails.
97
///
98
uint32_t
button_index
;
99
100
///
101
/// The new value of the button.
102
///
103
/// This value should be normalized to the range [-1.0, 1.0], with any value greater than
104
/// 0.0 to be considered "pressed".
105
///
106
double
value
;
107
};
108
109
}
// namespace ultralight
UExport
#define UExport
Definition
Exports.h:25
String.h
Defines.h
ultralight::GamepadAxisEvent
Event representing a change in gamepad axis state (eg, pressing a stick in a certain direction).
Definition
GamepadEvent.h:57
ultralight::GamepadAxisEvent::axis_index
uint32_t axis_index
The index of the axis whose value has changed.
Definition
GamepadEvent.h:70
ultralight::GamepadAxisEvent::index
uint32_t index
The index of the gamepad, this should match the value previously set in Renderer::SetGamepadDetails.
Definition
GamepadEvent.h:63
ultralight::GamepadAxisEvent::value
double value
The new value of the axis.
Definition
GamepadEvent.h:77
ultralight::GamepadButtonEvent
Event representing a change in gamepad button state (eg, pressing a button on a gamepad).
Definition
GamepadEvent.h:85
ultralight::GamepadButtonEvent::index
uint32_t index
The index of the gamepad, this should match the value previously set in Renderer::SetGamepadDetails.
Definition
GamepadEvent.h:91
ultralight::GamepadButtonEvent::button_index
uint32_t button_index
The index of the button whose value has changed.
Definition
GamepadEvent.h:98
ultralight::GamepadButtonEvent::value
double value
The new value of the button.
Definition
GamepadEvent.h:106
ultralight::GamepadEvent
Event representing a change in gamepad connection state.
Definition
GamepadEvent.h:19
ultralight::GamepadEvent::Type
Type
The various GamepadEvent types.
Definition
GamepadEvent.h:24
ultralight::GamepadEvent::kType_GamepadDisconnected
@ kType_GamepadDisconnected
This event type should be fired when a gamepad is disconnected.
Definition
GamepadEvent.h:37
ultralight::GamepadEvent::kType_GamepadConnected
@ kType_GamepadConnected
This event type should be fired when a gamepad is connected.
Definition
GamepadEvent.h:32
ultralight::GamepadEvent::index
uint32_t index
The index of the gamepad, this should match the value previously set in Renderer::SetGamepadDetails.
Definition
GamepadEvent.h:49
ultralight::GamepadEvent::type
Type type
Definition
GamepadEvent.h:43
ultralight
Definition
Bitmap.h:14
Ultralight
GamepadEvent.h
Docs
C++ API
C API
Version
1.4
2.0
latest
1.4