libgui 2.01
libgui is a GUI library for the GameCube, Wii, and Wii U
 
Loading...
Searching...
No Matches
InputData.h
1/****************************************************************************
2 * Platform Abstraction Layer
3 * Daryl Borth 2026
4 * InputData.h
5 *
6 * Platform-agnostic input structures
7 ***************************************************************************/
8#pragma once
9
10#include <cstdint>
11
17enum InputDataButtons : uint32_t {
18 INPUT_BTN_NONE = 0,
19 INPUT_BTN_A = (1 << 0),
20 INPUT_BTN_B = (1 << 1),
21 INPUT_BTN_X = (1 << 2),
22 INPUT_BTN_Y = (1 << 3),
23 INPUT_BTN_1 = (1 << 4),
24 INPUT_BTN_2 = (1 << 5),
25 INPUT_BTN_UP = (1 << 6),
26 INPUT_BTN_DOWN = (1 << 7),
27 INPUT_BTN_LEFT = (1 << 8),
28 INPUT_BTN_RIGHT = (1 << 9),
29 INPUT_BTN_PLUS = (1 << 10), // Plus (Wii/Wii U) / Start (GC)
30 INPUT_BTN_MINUS = (1 << 11), // Minus (Wii/Wii U)
31 INPUT_BTN_HOME = (1 << 12), // Home (Wii/Wii U)
32 INPUT_TRIGGER_L = (1 << 13), // L Trigger / Bumper, Nunchuk C
33 INPUT_TRIGGER_R = (1 << 14), // R Trigger / Bumper
34 INPUT_TRIGGER_ZL = (1 << 15), // ZL Trigger / GC Z Button, Nunchuk Z
35 INPUT_TRIGGER_ZR = (1 << 16), // ZR Trigger
36 INPUT_THUMB_L = (1 << 17), // Left Stick Click (L3)
37 INPUT_THUMB_R = (1 << 18) // Right Stick Click (R3)
38};
39
42enum GuiHardwareProfile : uint32_t {
43 INPUT_HW_GAMECUBE = 0,
44 INPUT_HW_WIIMOTE = 1,
45 INPUT_HW_NUNCHUK = 2,
46 INPUT_HW_CLASSIC = 3,
47 INPUT_HW_WUPC = 4,
48 INPUT_HW_DRC = 5,
49 INPUT_HW_MAX = 6
50};
51
57struct InputPadData {
61 uint32_t buttons_d;
62 uint32_t buttons_h;
63 uint32_t buttons_r;
64 float stickX;
65 float stickY;
66 float substickX;
67 float substickY;
68 float gforceX;
69 float gforceY;
70 float gforceZ;
71 float pitch;
72 float roll;
73 float yaw;
74 uint32_t battery_level;
75 float cursor_x;
76 float cursor_y;
79 bool isTouch;
81
85 bool hw_connected[INPUT_HW_MAX];
86 uint32_t hw_buttons_d[INPUT_HW_MAX];
87 uint32_t hw_buttons_h[INPUT_HW_MAX];
88 uint32_t hw_buttons_r[INPUT_HW_MAX];
89 float hw_stickX[INPUT_HW_MAX];
90 float hw_stickY[INPUT_HW_MAX];
91 float hw_substickX[INPUT_HW_MAX];
92 float hw_substickY[INPUT_HW_MAX];
93 float hw_triggerL[INPUT_HW_MAX];
94 float hw_triggerR[INPUT_HW_MAX];
95
96 float hw_gforceX[INPUT_HW_MAX];
97 float hw_gforceY[INPUT_HW_MAX];
98 float hw_gforceZ[INPUT_HW_MAX];
99 float hw_pitch[INPUT_HW_MAX];
100 float hw_roll[INPUT_HW_MAX];
101 float hw_yaw[INPUT_HW_MAX];
103
104 InputPadData() {
106 stickX = stickY = substickX = substickY = 0.0f;
107 gforceX = gforceY = gforceZ = 0.0f;
108 pitch = roll = yaw = 0.0f;
109 battery_level = 0;
110 cursor_x = cursor_y = cursor_angle = 0.0f;
111 validPointer = isTouch = false;
112
113 for(uint32_t i = 0; i < INPUT_HW_MAX; i++) {
114 hw_connected[i] = false;
115 hw_buttons_d[i] = hw_buttons_h[i] = hw_buttons_r[i] = 0;
116 hw_stickX[i] = hw_stickY[i] = hw_substickX[i] = hw_substickY[i] = 0.0f;
117 hw_triggerL[i] = hw_triggerR[i] = 0.0f;
118 hw_gforceX[i] = hw_gforceY[i] = hw_gforceZ[i] = 0.0f;
119 hw_pitch[i] = hw_roll[i] = hw_yaw[i] = 0.0f;
120 }
121 }
122};
GuiHardwareProfile
Hardware profile that a set of button or stick values came from (GameCube, Wiimote,...
Definition InputData.h:42
InputDataButtons
Universal platform-agnostic button bitmasks Covers Wii, GameCube, and Wii U inputs.
Definition InputData.h:17
uint32_t buttons_d
Pressed this frame (down)
Definition InputData.h:61
float stickX
Left analog stick X, -1.0 to 1.0.
Definition InputData.h:64
float hw_roll[INPUT_HW_MAX]
Orientation roll, per profile.
Definition InputData.h:100
float gforceY
Accelerometer Y.
Definition InputData.h:69
uint32_t hw_buttons_d[INPUT_HW_MAX]
Buttons pressed this frame, per profile.
Definition InputData.h:86
float substickY
Right analog stick (C-Stick) Y, -1.0 to 1.0.
Definition InputData.h:67
float hw_gforceZ[INPUT_HW_MAX]
Accelerometer Z, per profile.
Definition InputData.h:98
float hw_triggerL[INPUT_HW_MAX]
Analog L trigger / shoulder, 0.0 - 1.0, per profile (GameCube, Classic, WUPC); 0 where the hardware h...
Definition InputData.h:93
float hw_triggerR[INPUT_HW_MAX]
Analog R trigger / shoulder, 0.0 - 1.0, per profile.
Definition InputData.h:94
float hw_stickY[INPUT_HW_MAX]
Left stick Y, per profile.
Definition InputData.h:90
float hw_substickX[INPUT_HW_MAX]
Right stick X, per profile.
Definition InputData.h:91
float pitch
Controller orientation pitch (Wiimote/Nunchuk)
Definition InputData.h:71
uint32_t battery_level
Controller battery level as reported by the backend.
Definition InputData.h:74
float cursor_x
Pointer X on the design canvas (Wiimote IR / GamePad touch)
Definition InputData.h:75
bool hw_connected[INPUT_HW_MAX]
Profile is connected and contributing.
Definition InputData.h:85
bool validPointer
True if the IR pointer or touch is active on screen.
Definition InputData.h:78
float cursor_angle
Pointer rotation (Wiimote roll)
Definition InputData.h:77
float yaw
Controller orientation yaw.
Definition InputData.h:73
bool isTouch
True if input is direct touch (VPad) vs IR pointer.
Definition InputData.h:79
float gforceX
Accelerometer X (Wiimote/Nunchuk/GamePad)
Definition InputData.h:68
float hw_stickX[INPUT_HW_MAX]
Left stick X, per profile.
Definition InputData.h:89
float hw_gforceY[INPUT_HW_MAX]
Accelerometer Y, per profile.
Definition InputData.h:97
float cursor_y
Pointer Y on the design canvas.
Definition InputData.h:76
float hw_gforceX[INPUT_HW_MAX]
Accelerometer X, per profile.
Definition InputData.h:96
float hw_yaw[INPUT_HW_MAX]
Orientation yaw, per profile.
Definition InputData.h:101
uint32_t hw_buttons_h[INPUT_HW_MAX]
Buttons held this frame, per profile.
Definition InputData.h:87
float substickX
Right analog stick (C-Stick) X, -1.0 to 1.0.
Definition InputData.h:66
float hw_pitch[INPUT_HW_MAX]
Orientation pitch, per profile.
Definition InputData.h:99
float roll
Controller orientation roll.
Definition InputData.h:72
float stickY
Left analog stick Y, -1.0 to 1.0.
Definition InputData.h:65
uint32_t buttons_r
Released this frame.
Definition InputData.h:63
float hw_substickY[INPUT_HW_MAX]
Right stick Y, per profile.
Definition InputData.h:92
uint32_t buttons_h
Held this frame.
Definition InputData.h:62
uint32_t hw_buttons_r[INPUT_HW_MAX]
Buttons released this frame, per profile.
Definition InputData.h:88
float gforceZ
Accelerometer Z.
Definition InputData.h:70