libgui 2.01
libgui is a GUI library for the GameCube, Wii, and Wii U
 
Loading...
Searching...
No Matches
InputController Class Reference

Logical controller for one input channel. More...

#include <InputController.h>

Public Member Functions

 InputController (int channel)
 
void update (const InputPadData &data, float deltaTime)
 Updates the controller state.
 
void setSideways (bool s)
 Sets whether the Wiimote is held sideways; if so the d-pad and primary/secondary buttons are remapped (A/B become 2/1).
 
bool isSideways () const
 
int getChannel () const
 
void setChannel (int c)
 Temporarily overrides the channel this controller reports via getChannel().
 
void setContinuousRumble (bool continuous)
 Holds this controller's motor on or off (see InputDriver::setContinuousRumble()).
 
const InputPadData & getPadData () const
 
bool isPressed (uint32_t logicalButtonMask) const
 
bool isHeld (uint32_t logicalButtonMask) const
 
bool isPrimaryPressed () const
 
bool isSecondaryPressed () const
 
bool up () const
 
bool down () const
 
bool left () const
 
bool right () const
 

Detailed Description

Logical controller for one input channel.

Translates an InputPadData snapshot (sideways Wiimote mapping, deadzone) and drives repeat-delay timing for UI navigation.

Definition at line 16 of file InputController.h.

Constructor & Destructor Documentation

◆ InputController()

InputController::InputController ( int channel)
Parameters
channelController channel (0-3) this controller reports for

Definition at line 22 of file InputController.cpp.

Member Function Documentation

◆ down()

bool InputController::down ( ) const
Returns
true when a step down is due (initial press, then auto-repeat while held)

Definition at line 89 of file InputController.cpp.

◆ getChannel()

int InputController::getChannel ( ) const
inline
Returns
the channel this controller reports for (see setChannel())

Definition at line 34 of file InputController.h.

◆ getPadData()

const InputPadData & InputController::getPadData ( ) const
inline
Returns
the latest input snapshot passed to update()

Definition at line 48 of file InputController.h.

◆ isHeld()

bool InputController::isHeld ( uint32_t logicalButtonMask) const
Returns
true if any button in the mask is held this frame

Definition at line 80 of file InputController.cpp.

◆ isPressed()

bool InputController::isPressed ( uint32_t logicalButtonMask) const
Returns
true if any button in the mask was pressed this frame (INPUT_BTN_* / INPUT_TRIGGER_*)

Definition at line 76 of file InputController.cpp.

◆ isPrimaryPressed()

bool InputController::isPrimaryPressed ( ) const
Returns
true if the primary ("accept") button was pressed this frame: A, or 2 when sideways

Definition at line 66 of file InputController.cpp.

◆ isSecondaryPressed()

bool InputController::isSecondaryPressed ( ) const
Returns
true if the secondary ("cancel") button was pressed this frame: B, or 1 when sideways

Definition at line 71 of file InputController.cpp.

◆ isSideways()

bool InputController::isSideways ( ) const
inline
Returns
true if the Wiimote is held sideways

Definition at line 32 of file InputController.h.

◆ left()

bool InputController::left ( ) const
Returns
true when a step left is due (initial press, then auto-repeat while held)

Definition at line 94 of file InputController.cpp.

◆ right()

bool InputController::right ( ) const
Returns
true when a step right is due (initial press, then auto-repeat while held)

Definition at line 99 of file InputController.cpp.

◆ setChannel()

void InputController::setChannel ( int c)
inline

Temporarily overrides the channel this controller reports via getChannel().

Used by list-based elements (e.g. GuiFileBrowser) to present a "no channel" (-1) identity to items the cursor isn't currently over, so a stale stateChan left on a reused slot can't block clicks from the real channel. Callers MUST restore the original value (see getChannel()) after the element update() call this wraps.

Definition at line 42 of file InputController.h.

◆ setContinuousRumble()

void InputController::setContinuousRumble ( bool continuous)

Holds this controller's motor on or off (see InputDriver::setContinuousRumble()).

Definition at line 104 of file InputController.cpp.

◆ setSideways()

void InputController::setSideways ( bool s)
inline

Sets whether the Wiimote is held sideways; if so the d-pad and primary/secondary buttons are remapped (A/B become 2/1).

Definition at line 30 of file InputController.h.

◆ up()

bool InputController::up ( ) const
Returns
true when a step up is due (initial press, then auto-repeat while held)

Definition at line 84 of file InputController.cpp.

◆ update()

void InputController::update ( const InputPadData & data,
float deltaTime )

Updates the controller state.

Called once per frame by the driver.

Parameters
dataThe raw, mapped inputs from the hardware.
deltaTimeElapsed time since last frame in seconds.

Definition at line 29 of file InputController.cpp.


The documentation for this class was generated from the following files: