Brunot
Loading...
Searching...
No Matches
ControllerHoldButton.h
Go to the documentation of this file.
1
10// ____ __ __ __
11// /\__ _\/\ \ /\ \/\ \
12// \/_/\ \/\ \ \___ __ \ \ \_\ \ ___ __ __ ____ __
13// \ \ \ \ \ _ `\ /'__`\ \ \ _ \ / __`\/\ \/\ \ /',__\ /'__`\
14// \ \ \ \ \ \ \ \/\ __/ \ \ \ \ \/\ \L\ \ \ \_\ \/\__, `\/\ __/
15// \ \_\ \ \_\ \_\ \____\ \ \_\ \_\ \____/\ \____/\/\____/\ \____\
16// \/_/ \/_/\/_/\/____/ \/_/\/_/\/___/ \/___/ \/___/ \/____/
17
18#pragma once
19#include "ControllerButton.h"
20
26{
27public:
29
30 auto update(float dt, unsigned char buttonState) -> void override;
31 auto resetButton() -> void override;
32
33private:
34
36 bool isFast = false;
37
38 static constexpr auto initialDelay = 0.5f;
39 static constexpr auto fastDelay = 0.1f;
40};
Helper class used by Controllers to handle the logic of knowing when a button is pressed down or not.
ControllerButton()=default
float currentDelay
Definition ControllerHoldButton.h:35
auto resetButton() -> void override
Virtual function so we can reset both ControllerInputs and ControllerHoldButton s the same way.
Definition ControllerHoldButton.cpp:59
auto update(float dt, unsigned char buttonState) -> void override
Upda.
Definition ControllerHoldButton.cpp:26
static constexpr auto fastDelay
Definition ControllerHoldButton.h:39
ControllerHoldButton()
Definition ControllerHoldButton.cpp:20
bool isFast
Definition ControllerHoldButton.h:36
static constexpr auto initialDelay
Definition ControllerHoldButton.h:38