|
|
@ -53,6 +53,13 @@ public: |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void ChangeAllKeyStatus(bool pressed) { |
|
|
|
|
|
std::lock_guard<std::mutex> guard(mutex); |
|
|
|
|
|
for (const KeyButtonPair& pair : list) { |
|
|
|
|
|
pair.key_button->status.store(pressed); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private: |
|
|
private: |
|
|
std::mutex mutex; |
|
|
std::mutex mutex; |
|
|
std::list<KeyButtonPair> list; |
|
|
std::list<KeyButtonPair> list; |
|
|
@ -79,4 +86,8 @@ void Keyboard::ReleaseKey(int key_code) { |
|
|
key_button_list->ChangeKeyStatus(key_code, false); |
|
|
key_button_list->ChangeKeyStatus(key_code, false); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Keyboard::ReleaseAllKeys() { |
|
|
|
|
|
key_button_list->ChangeAllKeyStatus(false); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} // namespace InputCommon
|
|
|
} // namespace InputCommon
|