libGumball 0.0.2
C23-Based, libGimbal-powered UI Library
Loading...
Searching...
No Matches
gumball_event_input.h
Go to the documentation of this file.
1#ifndef GUM_EVENT_INPUT_H
2#define GUM_EVENT_INPUT_H
3
4// View this file's documentation online: https://libgumball.psyops.studio/gumball__event__input_8h.html
5
6/*! \file
7 * \ingroup events
8 *
9 * Base event type for input
10 *
11 * \author 2025 Agustín Bellagamba
12 * \copyright MIT License
13*/
14
15#include "gumball_event.h"
16
17/*! \name Type System
18 * \brief Type UUID and Cast Operators
19 * @{
20*/
21#define GUM_EVENT_INPUT_TYPE (GBL_TYPEID (GUM_Event_Input)) //!< Returns the GUM_Event_Input Type UUID
22#define GUM_EVENT_INPUT(self) (GBL_CAST (GUM_Event_Input, self)) //!< Casts an instance of a compatible element to a GUM_Event_Input
23#define GUM_EVENT_INPUT_CLASS(klass) (GBL_CLASS_CAST (GUM_Event_Input, klass)) //!< Casts a class of a compatible element to a GUM_Event_InputClass
24#define GUM_EVENT_INPUT_CLASSOF(self) (GBL_CLASSOF (GUM_Event_Input, self)) //!< Casts an instance of a compatible element to a GUM_Event_InputClass
25//! @}
26
27#define GBL_SELF_TYPE GUM_Event_Input
28
29GBL_DECLS_BEGIN
30
31typedef enum : uint8_t {
32 GUM_INPUT_PRESS,
33 GUM_INPUT_RELEASE
34} GUM_INPUT_STATE;
35
36typedef enum : uint8_t {
37 GUM_INPUT_PRIMARY,
38 GUM_INPUT_SECONDARY,
39 GUM_INPUT_TERTIARY,
40 GUM_INPUT_LEFT,
41 GUM_INPUT_UP,
42 GUM_INPUT_RIGHT,
43 GUM_INPUT_DOWN
44} GUM_INPUT_ID;
45
46GBL_FORWARD_DECLARE_STRUCT(GUM_Event_Input);
47
48/*! \struct GUM_Event_InputClass
49 * \extends GUM_EventClass
50 * \brief GUM_Event_Input structure
51 *
52 * GUM_Event_InputClass derives from GUM_EventClass, adding nothing new.
53*/
54GBL_CLASS_DERIVE_EMPTY(GUM_Event_Input, GUM_Event);
55
56/*!
57 * \class GUM_Event_Input
58 * \extends GUM_Event
59 * \brief Input event
60 *
61 * GUM_Event_Input represents any input event.
62 *
63*/
64GBL_INSTANCE_DERIVE(GUM_Event_Input, GUM_Event)
65 GUM_INPUT_STATE state; //!< State of the input event
66 GUM_INPUT_ID id; //!< ID of the input event
67GBL_INSTANCE_END
68
69GBL_DECLS_END
70
71#undef GBL_SELF_TYPE
72
73#endif
GBL_INSTANCE_DERIVE(GUM_Event_Button, GUM_Event_Input) uint8_t controllerId
ID of the controller that generated the event.
GUM_INPUT_ID id
ID of the input event.
Definition gumball_event_input.h:66
GUM_Event_Button class.