Brunot
Loading...
Searching...
No Matches
ControllerButton Class Reference

Helper class used by Controllers to handle the logic of knowing when a button is pressed down or not. More...

#include <ControllerButton.h>

Inheritance diagram for ControllerButton:
[legend]

Public Member Functions

 ControllerButton ()=default
virtual ~ControllerButton ()=default
virtual auto clone () const -> std::unique_ptr< ControllerButton >
virtual auto update (float dt, unsigned char buttonState) -> void
 Upda.
auto operator= (unsigned char newState) -> ControllerButton &
virtual auto operator= (ControllerButton *other) -> ControllerButton &
virtual auto resetButton () -> void
 Virtual function so we can reset both ControllerInputs and ControllerHoldButton s the same way.
auto isPressed () const -> bool
 Whether the button is pressed down or not currently.

Protected Attributes

unsigned char lastFrameState = false
 char for tracking what the state of the button on the previous frame was. 1 = pushed, 0 = not pushed
bool currentlyPressed = false
 Bool shared with the outside world to indicate whether the button is currently pressed down or not.

Detailed Description

Helper class used by Controllers to handle the logic of knowing when a button is pressed down or not.

@ControllerButton.h

Constructor & Destructor Documentation

◆ ControllerButton()

ControllerButton::ControllerButton ( )
default
Here is the caller graph for this function:

◆ ~ControllerButton()

virtual ControllerButton::~ControllerButton ( )
virtualdefault
Here is the call graph for this function:

Member Function Documentation

◆ clone()

auto ControllerButton::clone ( ) const->std::unique_ptr< ControllerButton >
virtual
Here is the call graph for this function:

◆ isPressed()

auto ControllerButton::isPressed ( ) const->bool

Whether the button is pressed down or not currently.

Here is the caller graph for this function:

◆ operator=() [1/2]

auto ControllerButton::operator= ( ControllerButton * other) ->ControllerButton &
virtual
Here is the call graph for this function:

◆ operator=() [2/2]

auto ControllerButton::operator= ( unsigned char newState) ->ControllerButton &
Here is the call graph for this function:

◆ resetButton()

auto ControllerButton::resetButton ( ) ->void
virtual

Virtual function so we can reset both ControllerInputs and ControllerHoldButton s the same way.

Reimplemented in ControllerHoldButton.

Here is the caller graph for this function:

◆ update()

auto ControllerButton::update ( float dt,
unsigned char buttonState )->void
virtual

Upda.

Parameters
dtHow much time has passed since the last state
buttonStateThe current state of a physical controller button
Returns
If the button is pressed down or not

Reimplemented in ControllerHoldButton.

Here is the caller graph for this function:

Member Data Documentation

◆ currentlyPressed

bool ControllerButton::currentlyPressed = false
protected

Bool shared with the outside world to indicate whether the button is currently pressed down or not.

◆ lastFrameState

unsigned char ControllerButton::lastFrameState = false
protected

char for tracking what the state of the button on the previous frame was. 1 = pushed, 0 = not pushed


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