mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
Add methods to check for KeyActions and KeyModifiers
This commit is contained in:
@@ -68,6 +68,8 @@ enum class KeyAction : int {
|
||||
Repeat = 2
|
||||
};
|
||||
|
||||
bool hasKeyAction(KeyAction lhs, KeyAction rhs);
|
||||
|
||||
KeyAction operator|(KeyAction lhs, KeyAction rhs);
|
||||
KeyAction operator|=(KeyAction& lhs, KeyAction rhs);
|
||||
|
||||
@@ -79,6 +81,8 @@ enum class KeyModifier : int {
|
||||
Super = 0x0008
|
||||
};
|
||||
|
||||
bool hasKeyModifier(KeyModifier lhs, KeyModifier rhs);
|
||||
|
||||
KeyModifier operator|(KeyModifier lhs, KeyModifier rhs);
|
||||
KeyModifier operator|=(KeyModifier& lhs, KeyModifier rhs);
|
||||
|
||||
|
||||
@@ -36,6 +36,12 @@ namespace {
|
||||
|
||||
namespace openspace {
|
||||
|
||||
bool hasKeyModifier(KeyAction lhs, KeyAction rhs) {
|
||||
return
|
||||
static_cast<std::underlying_type_t<KeyAction>>(lhs) &
|
||||
static_cast<std::underlying_type_t<KeyAction>>(rhs);
|
||||
}
|
||||
|
||||
KeyAction operator|(KeyAction lhs, KeyAction rhs) {
|
||||
return static_cast<KeyAction>(
|
||||
static_cast<std::underlying_type_t<KeyAction>>(lhs) |
|
||||
@@ -48,6 +54,13 @@ KeyAction operator|=(KeyAction& lhs, KeyAction rhs) {
|
||||
return lhs;
|
||||
}
|
||||
|
||||
bool hasKeyModifier(KeyModifier lhs, KeyModifier rhs) {
|
||||
return
|
||||
static_cast<std::underlying_type_t<KeyModifier>>(lhs) &
|
||||
static_cast<std::underlying_type_t<KeyModifier>>(rhs);
|
||||
}
|
||||
|
||||
|
||||
KeyModifier operator|(KeyModifier lhs, KeyModifier rhs) {
|
||||
return static_cast<KeyModifier>(
|
||||
static_cast<std::underlying_type_t<KeyModifier>>(lhs) |
|
||||
|
||||
Reference in New Issue
Block a user