docs
Docs
C++ API
C API
Search API
Ctrl K
2.0
2.0
latest
1.4
Ultralight C API
2.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
CAPI_GamepadEvent.h
Go to the documentation of this file.
1
///
2
/// Copyright (C) 2026 Ultralight, Inc. All rights reserved.
3
/// A license is required for commercial use. https://ultralig.ht
4
///
5
6
///
7
/// @file CAPI_GamepadEvent.h
8
///
9
/// Gamepad event interface.
10
///
11
/// `#include <Ultralight/CAPI/CAPI_GamepadEvent.h>`
12
///
13
/// This file defines the C API for gamepad events.
14
///
15
/// @see ulFireGamepadEvent
16
///
17
#ifndef ULTRALIGHT_CAPI_GAMEPADEVENT_H
18
#define ULTRALIGHT_CAPI_GAMEPADEVENT_H
19
20
#include <
Ultralight/CAPI/CAPI_Defines.h
>
21
22
#ifdef __cplusplus
23
extern
"C"
{
24
#endif
25
26
/******************************************************************************
27
* Gamepad Event
28
*****************************************************************************/
29
30
///
31
/// Create a gamepad event.
32
///
33
/// @param index The index of the gamepad (should match ulSetGamepadDetails()).
34
/// @param type The type of gamepad event.
35
///
36
/// @return A new ULGamepadEvent instance. You must call ulDestroyGamepadEvent() when finished.
37
///
38
ULExport
ULGamepadEvent
ulCreateGamepadEvent
(
unsigned
int
index,
ULGamepadEventType
type);
39
40
///
41
/// Destroy a gamepad event created by ulCreateGamepadEvent().
42
///
43
ULExport
void
ulDestroyGamepadEvent
(
ULGamepadEvent
evt);
44
45
/******************************************************************************
46
* Gamepad Axis Event
47
*****************************************************************************/
48
49
///
50
/// Create a gamepad axis event.
51
///
52
/// @param index The index of the gamepad.
53
/// @param axis_index The index of the axis whose value has changed.
54
/// @param value The new value of the axis, normalized to [-1.0, 1.0].
55
///
56
/// @return A new ULGamepadAxisEvent instance. You must call ulDestroyGamepadAxisEvent() when
57
/// finished.
58
///
59
ULExport
ULGamepadAxisEvent
ulCreateGamepadAxisEvent
(
unsigned
int
index,
unsigned
int
axis_index,
60
double
value);
61
62
///
63
/// Destroy a gamepad axis event created by ulCreateGamepadAxisEvent().
64
///
65
ULExport
void
ulDestroyGamepadAxisEvent
(
ULGamepadAxisEvent
evt);
66
67
/******************************************************************************
68
* Gamepad Button Event
69
*****************************************************************************/
70
71
///
72
/// Create a gamepad button event.
73
///
74
/// @param index The index of the gamepad.
75
/// @param button_index The index of the button whose value has changed.
76
/// @param value The new value of the button, normalized to [0.0, 1.0]. Any value
77
/// greater than 0.0 is considered "pressed".
78
///
79
/// @return A new ULGamepadButtonEvent instance. You must call ulDestroyGamepadButtonEvent() when
80
/// finished.
81
///
82
ULExport
ULGamepadButtonEvent
ulCreateGamepadButtonEvent
(
unsigned
int
index,
83
unsigned
int
button_index,
double
value);
84
85
///
86
/// Destroy a gamepad button event created by ulCreateGamepadButtonEvent().
87
///
88
ULExport
void
ulDestroyGamepadButtonEvent
(
ULGamepadButtonEvent
evt);
89
90
#ifdef __cplusplus
91
}
// extern "C"
92
#endif
93
94
#endif
// ULTRALIGHT_CAPI_GAMEPADEVENT_H
ulDestroyGamepadEvent
void ulDestroyGamepadEvent(ULGamepadEvent evt)
Destroy a gamepad event created by ulCreateGamepadEvent().
ulCreateGamepadButtonEvent
ULGamepadButtonEvent ulCreateGamepadButtonEvent(unsigned int index, unsigned int button_index, double value)
Create a gamepad button event.
ulDestroyGamepadButtonEvent
void ulDestroyGamepadButtonEvent(ULGamepadButtonEvent evt)
Destroy a gamepad button event created by ulCreateGamepadButtonEvent().
ulCreateGamepadEvent
ULGamepadEvent ulCreateGamepadEvent(unsigned int index, ULGamepadEventType type)
Create a gamepad event.
ulCreateGamepadAxisEvent
ULGamepadAxisEvent ulCreateGamepadAxisEvent(unsigned int index, unsigned int axis_index, double value)
Create a gamepad axis event.
ulDestroyGamepadAxisEvent
void ulDestroyGamepadAxisEvent(ULGamepadAxisEvent evt)
Destroy a gamepad axis event created by ulCreateGamepadAxisEvent().
CAPI_Defines.h
Various defines and utility functions for the C API.
ULGamepadButtonEvent
struct C_GamepadButtonEvent * ULGamepadButtonEvent
Opaque handle to a GamepadButtonEvent object.
Definition
CAPI_Defines.h:119
ULGamepadEventType
ULGamepadEventType
The various GamepadEvent types.
Definition
CAPI_Defines.h:320
ULExport
#define ULExport
Definition
CAPI_Defines.h:42
ULGamepadAxisEvent
struct C_GamepadAxisEvent * ULGamepadAxisEvent
Opaque handle to a GamepadAxisEvent object.
Definition
CAPI_Defines.h:116
ULGamepadEvent
struct C_GamepadEvent * ULGamepadEvent
Opaque handle to a GamepadEvent object.
Definition
CAPI_Defines.h:113
Ultralight
CAPI
CAPI_GamepadEvent.h
Docs
C++ API
C API
Version
2.0
2.0
latest
1.4