libgui 3.00
libgui is a GUI library for the GameCube, Wii, and Wii U
 
Loading...
Searching...
No Matches
OgcInputDriver.h
1/****************************************************************************
2 * Platform Abstraction Layer (OGC driver)
3 * Daryl Borth 2026
4 * OgcInputDriver.h
5 *
6 * Input for every libogc console. This is the GameCube driver, and the base
7 * of the Wii one: the Wii has everything a GameCube has (the controller
8 * ports and rumble), so WiiInputDriver derives from this class and adds its
9 * own hardware through the protected hooks below, rather than this file
10 * switching on HW_RVL.
11 ***************************************************************************/
12#pragma once
13#include "../InputDriver.h"
14#include "../InputData.h"
15
20class OgcInputDriver : public InputDriver
21{
22 public:
23 OgcInputDriver();
24 ~OgcInputDriver() override;
25
26 void init() override;
27 void shutdown() override;
28 void update() override;
29 void setRumble(int channel, bool rumble) override;
30 void setContinuousRumble(int channel, bool continuous) override;
31
32 protected:
35
37 virtual void initHardware() {}
38
40 virtual void scanHardware() {}
41
44 virtual void readChannel(int channel, InputPadData & pad) { (void)channel; (void)pad; }
45
47 virtual bool isSystemRumbleAllowed() const { return true; }
48
51 virtual void driveRumble(int channel, bool on) { (void)channel; (void)on; }
52
53 private:
54 bool rumbleRequest[4];
55 int menuRumbleFrames[4]; // frames left in the current menu "tick" (0 = idle)
56 int menuRumbleGapFrames[4]; // frames left in the enforced silent gap after a tick
57 bool continuousRumble[4]; // setContinuousRumble() state
58 int continuousRumbleCount[4];// consecutive frames the motor has been driven
59 int silenceFrames[4]; // frames left in the forced rest after a long continuous run
60};
Platform input backend GuiElements delegate to, via the per-channel InputController objects update() ...
Definition InputDriver.h:22
void update() override
Polls the hardware and dispatches InputPadData payloads to the UI.
void shutdown() override
Shuts the controller subsystem down.
virtual void driveRumble(int channel, bool on)
Drives the rumble motor of any controller other than the GameCube pad on channel; called every frame ...
void init() override
Initializes the controller subsystem.
virtual void readChannel(int channel, InputPadData &pad)
Called once per channel per frame: add the extra hardware's state for channel to pad (each device in ...
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...
void setRumble(int channel, bool rumble) override
Requests a rumble event on the specified controller channel.
virtual void scanHardware()
Called once per frame before the channels are read: poll the extra hardware.
virtual bool isSystemRumbleAllowed() const
False if the console's own settings disable controller rumble.
virtual void initHardware()
Extension points for a console with more input hardware than GameCube pads.
The universal input payload for UI elements.
Definition InputData.h:57