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
25
class
ControllerHoldButton
:
public
ControllerButton
26
{
27
public
:
28
ControllerHoldButton
();
29
30
auto
update
(
float
dt,
unsigned
char
buttonState) ->
void
override
;
31
auto
resetButton
() ->
void
override
;
32
33
private
:
34
35
float
currentDelay
;
36
bool
isFast
=
false
;
37
38
static
constexpr
auto
initialDelay
= 0.5f;
39
static
constexpr
auto
fastDelay
= 0.1f;
40
};
ControllerButton.h
Helper class used by Controllers to handle the logic of knowing when a button is pressed down or not.
ControllerButton::ControllerButton
ControllerButton()=default
ControllerHoldButton::currentDelay
float currentDelay
Definition
ControllerHoldButton.h:35
ControllerHoldButton::resetButton
auto resetButton() -> void override
Virtual function so we can reset both ControllerInputs and ControllerHoldButton s the same way.
Definition
ControllerHoldButton.cpp:59
ControllerHoldButton::update
auto update(float dt, unsigned char buttonState) -> void override
Upda.
Definition
ControllerHoldButton.cpp:26
ControllerHoldButton::fastDelay
static constexpr auto fastDelay
Definition
ControllerHoldButton.h:39
ControllerHoldButton::ControllerHoldButton
ControllerHoldButton()
Definition
ControllerHoldButton.cpp:20
ControllerHoldButton::isFast
bool isFast
Definition
ControllerHoldButton.h:36
ControllerHoldButton::initialDelay
static constexpr auto initialDelay
Definition
ControllerHoldButton.h:38
The House
source
Utility
ControllerInputs
ControllerHoldButton.h
Generated by
1.15.0