2023-12-17 03:29:08 -08:00
|
|
|
#pragma once
|
|
|
|
|
2024-01-14 09:38:57 -08:00
|
|
|
#include "ehs/EHS.h"
|
2023-12-17 03:29:08 -08:00
|
|
|
#include "Button.h"
|
|
|
|
|
2023-12-17 15:56:13 -08:00
|
|
|
namespace ehs
|
2023-12-17 03:29:08 -08:00
|
|
|
{
|
|
|
|
enum class State
|
|
|
|
{
|
|
|
|
JUST_RELEASED,
|
|
|
|
RELEASED,
|
|
|
|
PRESSED,
|
|
|
|
TOUCHED
|
|
|
|
};
|
|
|
|
|
|
|
|
class ButtonState
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
Button button;
|
|
|
|
State state;
|
|
|
|
bool pressed;
|
|
|
|
float threshold;
|
|
|
|
|
|
|
|
public:
|
|
|
|
ButtonState();
|
|
|
|
|
|
|
|
ButtonState(const Button& button, const State state);
|
|
|
|
|
|
|
|
ButtonState(const ButtonState& bs);
|
|
|
|
|
|
|
|
ButtonState& operator=(const ButtonState& bs);
|
|
|
|
|
|
|
|
bool operator==(const Button& other) const;
|
|
|
|
|
|
|
|
bool operator!=(const Button& other) const;
|
|
|
|
|
|
|
|
bool operator==(const State otherState) const;
|
|
|
|
|
|
|
|
bool operator!=(const State otherState) const;
|
|
|
|
|
|
|
|
Button GetButton() const;
|
|
|
|
|
|
|
|
void SetState(State newState);
|
|
|
|
|
|
|
|
State GetState() const;
|
|
|
|
|
|
|
|
void SetPressed(bool value);
|
|
|
|
|
|
|
|
bool IsPressed() const;
|
|
|
|
|
|
|
|
void SetThreshold(const float newThreshold);
|
|
|
|
|
|
|
|
float GetThreshold() const;
|
|
|
|
};
|
|
|
|
}
|