15#include <AUI/Platform/AInput.h>
23 constexpr APointerIndex()
noexcept: mValue(AInput::LBUTTON) {}
26 assert((
button == AInput::LBUTTON ||
27 button == AInput::RBUTTON ||
28 button == AInput::CBUTTON));
42 return mValue <= MAX_BUTTON_VALUE;
50 return mValue > MAX_BUTTON_VALUE;
60 return (AInput::Key)mValue;
70 return mValue - MAX_BUTTON_VALUE - 1;
74 auto operator<=>(
const APointerIndex& rhs)
const noexcept =
default;
77 constexpr int rawValue() const noexcept {
83 static constexpr int MAX_BUTTON_VALUE = AInput::RBUTTON;
85 explicit constexpr APointerIndex(
int value) : mValue(value) {}
89inline std::ostream& operator<<(std::ostream& o,
const APointerIndex& color) {
90 o <<
"APointerIndex{";
91 if (
auto b = color.button()) {
100 case AInput::CBUTTON:
107 }
else if (
auto b = color.finger()) {
108 o <<
"finger=" << *b;
Utility wrapper implementing the stack-allocated (fast) optional idiom.
Definition: AOptional.h:32
Wrapper class that stores either mouse button index or finger index.
Definition: APointerIndex.h:21
bool isFinger() const noexcept
Definition: APointerIndex.h:49
AOptional< int > finger() const noexcept
Definition: APointerIndex.h:66
AOptional< AInput::Key > button() const noexcept
Definition: APointerIndex.h:56
bool isButton() const noexcept
Definition: APointerIndex.h:41