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

Derived version of ControllerButton. More...

#include <ControllerHoldButton.h>

Inheritance diagram for ControllerHoldButton:
[legend]
Collaboration diagram for ControllerHoldButton:
[legend]

Public Member Functions

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

Private Attributes

float currentDelay
bool isFast = false

Static Private Attributes

static constexpr auto initialDelay = 0.5f
static constexpr auto fastDelay = 0.1f

Additional Inherited Members

Protected Attributes inherited from ControllerButton
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

Derived version of ControllerButton.

@ControllerHoldButton.h

Constructor & Destructor Documentation

◆ ControllerHoldButton()

ControllerHoldButton::ControllerHoldButton ( )
Here is the call graph for this function:

Member Function Documentation

◆ resetButton()

auto ControllerHoldButton::resetButton ( ) ->void
overridevirtual

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

Reimplemented from ControllerButton.

◆ update()

auto ControllerHoldButton::update ( float dt,
unsigned char buttonState )->void
overridevirtual

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 from ControllerButton.

Member Data Documentation

◆ currentDelay

float ControllerHoldButton::currentDelay
private

◆ fastDelay

auto ControllerHoldButton::fastDelay = 0.1f
staticconstexprprivate

◆ initialDelay

auto ControllerHoldButton::initialDelay = 0.5f
staticconstexprprivate

◆ isFast

bool ControllerHoldButton::isFast = false
private

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