libgui 2.01
libgui is a GUI library for the GameCube, Wii, and Wii U
 
Loading...
Searching...
No Matches
WutInputDriver.h
1/****************************************************************************
2 * Platform Abstraction Layer (WUT driver)
3 * Daryl Borth 2026
4 * WutInputDriver.h
5 ***************************************************************************/
6#pragma once
7
8#include "../InputDriver.h"
9#include "../InputData.h"
10#include "../OneEuroFilter.h"
11
18class WutInputDriver : public InputDriver {
19 public:
20 WutInputDriver();
21 ~WutInputDriver() override;
22
23 void init() override;
24 void shutdown() override;
25 void update() override;
26 void setRumble(int channel, bool rumble) override;
27 void setContinuousRumble(int channel, bool continuous) override;
28
32
33 private:
34 bool rumbleRequest[4];
35 int menuRumbleFrames[4]; // frames left in the current menu "tick" (0 = idle)
36 int menuRumbleGapFrames[4]; // frames left in the enforced silent gap after a tick
37 bool continuousRumble[4]; // setContinuousRumble() state
38 int continuousRumbleCount[4];// consecutive frames the motor has been driven
39 int silenceFrames[4]; // frames left in the forced rest after a long continuous run
40
41 bool drcTouchedPrev;
42 float drcLastTouchX;
43 float drcLastTouchY;
44
45 // IR pointer smoothing (per Wiimote channel). One Euro Filter adapts
46 // its own smoothing strength to pointer speed each frame, so unlike
47 // a fixed-alpha EMA there's no single constant to tune - see
48 // OneEuroFilter.h for what minCutoff/beta below actually control.
49 OneEuroFilter irFilterX[4];
50 OneEuroFilter irFilterY[4];
51 bool irSmoothInit[4];
52
53 // VPADRead()/KPADReadEx() only report *new* wireless packets
54 // These caches hold the last known held/analog state per source so a
55 // "no new packet yet" tick can carry it forward
56 InputPadData drcCache; // GamePad (VPAD), channel 0 only
57 InputPadData kpadCache[4]; // Wiimote/Nunchuk/Classic/Pro, per channel
58};
Platform input backend GuiElements delegate to, via the per-channel InputController objects update() ...
Definition InputDriver.h:22
Adaptive speed-based low-pass filter (the 1-euro filter) for smoothing noisy pointer signals such as ...
void update() override
Polls the hardware and dispatches InputPadData payloads to the UI.
void openHomeButtonOverlay()
Opens the Wii U system HOME-button overlay on demand.
void init() override
Initializes the controller subsystem.
void shutdown() override
Shuts the controller subsystem down.
void setRumble(int channel, bool rumble) override
Requests a rumble event on the specified controller channel.
void setContinuousRumble(int channel, bool continuous) override
Holds a channel's motor on (or releases it) until changed. Drivers cap an unbroken run and insert a s...
The universal input payload for UI elements.
Definition InputData.h:57