EHS/include/ehs/io/hid/ButtonState.h

55 lines
858 B
C
Raw Normal View History

2024-02-05 22:25:30 -08:00
#pragma once
#include "ehs/EHS.h"
#include "Button.h"
namespace ehs
{
enum class State
{
JUST_RELEASED,
RELEASED,
PRESSED,
TOUCHED
};
2024-07-24 01:36:20 -07:00
class EHS_LIB_IO ButtonState
2024-02-05 22:25:30 -08:00
{
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;
};
}