EHS/include/io/hid/ButtonState.h

55 lines
843 B
C
Raw Normal View History

2023-12-17 03:29:08 -08:00
#pragma once
2023-12-17 15:00:08 -08:00
#include "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;
};
}