Brunot
Loading...
Searching...
No Matches
ControllerButton.h
Go to the documentation of this file.
1
10
// ____ __ __ __
11
// /\__ _\/\ \ /\ \/\ \
12
// \/_/\ \/\ \ \___ __ \ \ \_\ \ ___ __ __ ____ __
13
// \ \ \ \ \ _ `\ /'__`\ \ \ _ \ / __`\/\ \/\ \ /',__\ /'__`\
14
// \ \ \ \ \ \ \ \/\ __/ \ \ \ \ \/\ \L\ \ \ \_\ \/\__, `\/\ __/
15
// \ \_\ \ \_\ \_\ \____\ \ \_\ \_\ \____/\ \____/\/\____/\ \____\
16
// \/_/ \/_/\/_/\/____/ \/_/\/_/\/___/ \/___/ \/___/ \/____/
17
18
19
20
#pragma once
21
#include <memory>
22
27
class
ControllerButton
28
{
29
public
:
30
ControllerButton
() =
default
;
31
virtual
~ControllerButton
() =
default
;
32
virtual
auto
clone
() const -> std::unique_ptr<
ControllerButton
>;
33
40
virtual auto
update
(
float
dt,
unsigned
char
buttonState) ->
void
;
41
42
auto operator=(
unsigned
char
newState) ->
ControllerButton
&;
43
virtual auto operator=(
ControllerButton
* other) ->
ControllerButton
&;
44
46
virtual auto
resetButton
() ->
void
;
47
49
auto
isPressed
() const ->
bool
;
50
51
protected:
53
unsigned
char
lastFrameState
= false;
54
56
bool
currentlyPressed
= false;
57
};
ControllerButton::ControllerButton
ControllerButton()=default
ControllerButton::~ControllerButton
virtual ~ControllerButton()=default
ControllerButton::isPressed
auto isPressed() const -> bool
Whether the button is pressed down or not currently.
Definition
ControllerButton.cpp:53
ControllerButton::update
virtual auto update(float dt, unsigned char buttonState) -> void
Upda.
Definition
ControllerButton.cpp:25
ControllerButton::currentlyPressed
bool currentlyPressed
Bool shared with the outside world to indicate whether the button is currently pressed down or not.
Definition
ControllerButton.h:56
ControllerButton::clone
virtual auto clone() const -> std::unique_ptr< ControllerButton >
Definition
ControllerButton.cpp:20
ControllerButton::resetButton
virtual auto resetButton() -> void
Virtual function so we can reset both ControllerInputs and ControllerHoldButton s the same way.
Definition
ControllerButton.cpp:48
ControllerButton::lastFrameState
unsigned char lastFrameState
char for tracking what the state of the button on the previous frame was. 1 = pushed,...
Definition
ControllerButton.h:53
The House
source
Utility
ControllerInputs
ControllerButton.h
Generated by
1.15.0