55 lines
849 B
C
55 lines
849 B
C
|
#pragma once
|
||
|
|
||
|
#include "../../EHS.h"
|
||
|
#include "Button.h"
|
||
|
|
||
|
namespace lwe
|
||
|
{
|
||
|
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;
|
||
|
};
|
||
|
}
|