mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-22 09:15:45 +00:00
Enable mouse toggle buttons
This commit is contained in:
parent
0b24257e2c
commit
9c42c9e164
5 changed files with 65 additions and 11 deletions
|
@ -19,16 +19,18 @@ public:
|
|||
|
||||
bool GetStatus() const override {
|
||||
if (toggle) {
|
||||
return toggled_status.load();
|
||||
return toggled_status.load(std::memory_order_relaxed);
|
||||
}
|
||||
return status.load();
|
||||
}
|
||||
|
||||
void ToggleButton() {
|
||||
if (!lock) {
|
||||
lock = true;
|
||||
toggled_status.store(!toggled_status.load());
|
||||
if (lock) {
|
||||
return;
|
||||
}
|
||||
lock = true;
|
||||
const bool old_toggle_status = toggled_status.load();
|
||||
toggled_status.store(!old_toggle_status);
|
||||
}
|
||||
|
||||
void UnlockButton() {
|
||||
|
@ -41,7 +43,7 @@ private:
|
|||
std::shared_ptr<KeyButtonList> key_button_list;
|
||||
std::atomic<bool> status{false};
|
||||
std::atomic<bool> toggled_status{false};
|
||||
bool lock = {};
|
||||
bool lock{false};
|
||||
const bool toggle;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue