Optimized Button class. Added IsPressed and GetPressed methods.
This commit is contained in:
@@ -15,11 +15,15 @@ namespace ehs
|
||||
Str_8 name;
|
||||
UInt_64 id;
|
||||
Array<ButtonState> states;
|
||||
Button lastState;
|
||||
float heldTime;
|
||||
float activateTime;
|
||||
bool active;
|
||||
|
||||
public:
|
||||
HID();
|
||||
|
||||
HID(const UInt_8 type, Str_8 name, const UInt_64 id);
|
||||
HID(UInt_8 type, Str_8 name, UInt_64 id);
|
||||
|
||||
HID(HID&& hid) noexcept;
|
||||
|
||||
@@ -33,11 +37,11 @@ namespace ehs
|
||||
|
||||
bool operator!=(const HID& other) const;
|
||||
|
||||
bool operator==(const UInt_64 otherId) const;
|
||||
bool operator==(UInt_64 otherId) const;
|
||||
|
||||
bool operator!=(const UInt_64 otherId) const;
|
||||
bool operator!=(UInt_64 otherId) const;
|
||||
|
||||
virtual void Poll();
|
||||
virtual void Poll(float delta);
|
||||
|
||||
UInt_8 GetType() const;
|
||||
|
||||
@@ -71,6 +75,10 @@ namespace ehs
|
||||
|
||||
const ButtonState* IsUp() const;
|
||||
|
||||
const ButtonState *IsPressed(const Button &button);
|
||||
|
||||
const ButtonState *GetPressed();
|
||||
|
||||
void ButtonDown(const Button& button);
|
||||
|
||||
void ButtonUp(const Button& button);
|
||||
@@ -87,5 +95,11 @@ namespace ehs
|
||||
bool AddState(const ButtonState& state);
|
||||
|
||||
ButtonState* GetState(const Button& button);
|
||||
|
||||
bool TickHoldTime(float delta);
|
||||
|
||||
void ResetTime();
|
||||
|
||||
void TickActivateTime(float delta);
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user