55 lines
858 B
C++
55 lines
858 B
C++
#pragma once
|
|
|
|
#include "ehs/EHS.h"
|
|
#include "Button.h"
|
|
|
|
namespace ehs
|
|
{
|
|
enum class State
|
|
{
|
|
JUST_RELEASED,
|
|
RELEASED,
|
|
PRESSED,
|
|
TOUCHED
|
|
};
|
|
|
|
class EHS_LIB_IO 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;
|
|
};
|
|
} |