docs
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
21
22#ifdef __cplusplus
23extern "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///
39
40///
41/// Destroy a gamepad event created by ulCreateGamepadEvent().
42///
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///
59ULExport ULGamepadAxisEvent ulCreateGamepadAxisEvent(unsigned int index, unsigned int axis_index,
60 double value);
61
62///
63/// Destroy a gamepad axis event created by ulCreateGamepadAxisEvent().
64///
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///
83 unsigned int button_index, double value);
84
85///
86/// Destroy a gamepad button event created by ulCreateGamepadButtonEvent().
87///
89
90#ifdef __cplusplus
91} // extern "C"
92#endif
93
94#endif // ULTRALIGHT_CAPI_GAMEPADEVENT_H
void ulDestroyGamepadEvent(ULGamepadEvent evt)
Destroy a gamepad event created by ulCreateGamepadEvent().
ULGamepadButtonEvent ulCreateGamepadButtonEvent(unsigned int index, unsigned int button_index, double value)
Create a gamepad button event.
void ulDestroyGamepadButtonEvent(ULGamepadButtonEvent evt)
Destroy a gamepad button event created by ulCreateGamepadButtonEvent().
ULGamepadEvent ulCreateGamepadEvent(unsigned int index, ULGamepadEventType type)
Create a gamepad event.
ULGamepadAxisEvent ulCreateGamepadAxisEvent(unsigned int index, unsigned int axis_index, double value)
Create a gamepad axis event.
void ulDestroyGamepadAxisEvent(ULGamepadAxisEvent evt)
Destroy a gamepad axis event created by ulCreateGamepadAxisEvent().
Various defines and utility functions for the C API.
struct C_GamepadButtonEvent * ULGamepadButtonEvent
Opaque handle to a GamepadButtonEvent object.
Definition CAPI_Defines.h:119
ULGamepadEventType
The various GamepadEvent types.
Definition CAPI_Defines.h:320
#define ULExport
Definition CAPI_Defines.h:42
struct C_GamepadAxisEvent * ULGamepadAxisEvent
Opaque handle to a GamepadAxisEvent object.
Definition CAPI_Defines.h:116
struct C_GamepadEvent * ULGamepadEvent
Opaque handle to a GamepadEvent object.
Definition CAPI_Defines.h:113