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

Helper class that assists Controllers by managing when a stick should be considered pressed or not. More...

#include <ControllerStick.h>

Collaboration diagram for ControllerStick:
[legend]

Public Member Functions

 ControllerStick ()
auto update (float dt, float stickState) -> void
auto reset () -> void
auto isPressed () const -> bool
auto setEvents (std::pair< std::string, std::string > events) -> void
auto getEvent () const -> std::string
 Gets the output event corresponding to this stick.

Private Attributes

bool currentlyPressed = false
 Bool representing whether the stick should be considered pressed or not.
float lastFrameState = 0.f
float currentDelay
bool isFast = false
float pressThreshold = 0.7f
std::string minEvent
 event for if the stick is pushed to the negative threshold
std::string maxEvent
 event for if the stick is pushed to the positive threshold

Static Private Attributes

static constexpr auto initialDelay = 0.3f
static constexpr auto fastDelay = 0.2f

Detailed Description

Helper class that assists Controllers by managing when a stick should be considered pressed or not.

@ControllerStick.h

Constructor & Destructor Documentation

◆ ControllerStick()

ControllerStick::ControllerStick ( )

Member Function Documentation

◆ getEvent()

auto ControllerStick::getEvent ( ) const->std::string

Gets the output event corresponding to this stick.

Should ideally only be called when currentlyPressed is true.

Returns
A string corresponding to either the minimum event or maximum event

◆ isPressed()

auto ControllerStick::isPressed ( ) const->bool

◆ reset()

auto ControllerStick::reset ( ) ->void

◆ setEvents()

auto ControllerStick::setEvents ( std::pair< std::string, std::string > events) ->void

◆ update()

auto ControllerStick::update ( float dt,
float stickState )->void

Member Data Documentation

◆ currentDelay

float ControllerStick::currentDelay
private

◆ currentlyPressed

bool ControllerStick::currentlyPressed = false
private

Bool representing whether the stick should be considered pressed or not.

◆ fastDelay

auto ControllerStick::fastDelay = 0.2f
staticconstexprprivate

◆ initialDelay

auto ControllerStick::initialDelay = 0.3f
staticconstexprprivate

◆ isFast

bool ControllerStick::isFast = false
private

◆ lastFrameState

float ControllerStick::lastFrameState = 0.f
private

◆ maxEvent

std::string ControllerStick::maxEvent
private

event for if the stick is pushed to the positive threshold

◆ minEvent

std::string ControllerStick::minEvent
private

event for if the stick is pushed to the negative threshold

◆ pressThreshold

float ControllerStick::pressThreshold = 0.7f
private

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