-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBoundKeys.cpp
More file actions
28 lines (23 loc) · 836 Bytes
/
Copy pathBoundKeys.cpp
File metadata and controls
28 lines (23 loc) · 836 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "BoundKeys.h"
////////////////////////////////////////////////////////////
BoundKeys::BoundKeys() : m_keys{} {}
////////////////////////////////////////////////////////////
bool BoundKeys::hasKey(const sf::Keyboard::Key& t_key)const {
return m_keys.find(t_key) == m_keys.end();
}
////////////////////////////////////////////////////////////
void BoundKeys::addKey(const sf::Keyboard::Key& t_key) {
m_keys.emplace(t_key);
}
////////////////////////////////////////////////////////////
void BoundKeys::removeKey(const sf::Keyboard::Key& t_key) {
m_keys.erase(t_key);
}
////////////////////////////////////////////////////////////
bool BoundKeys::checkMatch(const KeySet& t_pressedKeys)const {
for (auto& k : t_pressedKeys) {
auto match{m_keys.find(k)};
if (match != m_keys.end()) { return true; }
}
return false;
}