libgui 2.01
libgui is a GUI library for the GameCube, Wii, and Wii U
 
Loading...
Searching...
No Matches
InputDriver.h
1/****************************************************************************
2 * Platform Abstraction Layer
3 * Daryl Borth 2026
4 * InputDriver.h
5 *
6 * Platform input backend GuiElements delegate to.
7 * Exactly one driver implements this and assigns the single global instance.
8 ***************************************************************************/
9#pragma once
10
11enum {
12 WIIMOTE_ORIENTATION_VERTICAL = 0,
13 WIIMOTE_ORIENTATION_HORIZONTAL,
14 WIIMOTE_ORIENTATION_LENGTH
15};
16
22{
23 public:
24 virtual ~InputDriver() = default;
25
27 virtual void init() = 0;
29 virtual void shutdown() = 0;
30
32 virtual void update() = 0;
33
35 virtual void setRumble(int channel, bool rumble) = 0;
37 virtual void setContinuousRumble(int channel, bool continuous) = 0;
38
40 void setRumbleEnabled(bool enabled) { rumbleEnabled = enabled; }
42 bool isRumbleEnabled() const { return rumbleEnabled; }
44 void setWiimoteOrientation(int orientation) { wiimoteOrientation = orientation; }
47
48 protected:
49 bool rumbleEnabled = true;
50 int wiimoteOrientation = WIIMOTE_ORIENTATION_VERTICAL;
51};
Platform input backend GuiElements delegate to, via the per-channel InputController objects update() ...
Definition InputDriver.h:22
virtual void update()=0
Polls the hardware and dispatches InputPadData payloads to the UI.
virtual void setRumble(int channel, bool rumble)=0
Requests a rumble event on the specified controller channel.
bool isRumbleEnabled() const
Definition InputDriver.h:42
virtual void shutdown()=0
Shuts the controller subsystem down.
int getWiimoteOrientation() const
Definition InputDriver.h:46
void setRumbleEnabled(bool enabled)
Globally enables or disables rumble requested through setRumble().
Definition InputDriver.h:40
bool rumbleEnabled
see setRumbleEnabled()
Definition InputDriver.h:49
void setWiimoteOrientation(int orientation)
Definition InputDriver.h:44
int wiimoteOrientation
see setWiimoteOrientation()
Definition InputDriver.h:50
virtual void setContinuousRumble(int channel, bool continuous)=0
Holds a channel's motor on (or releases it) until changed. Drivers cap an unbroken run and insert a s...
virtual void init()=0
Initializes the controller subsystem.