1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-20 10:17:05 +00:00

Introduces 'non-exclusive' emulator-space keyboards.

i.e. sets of keys that don't amount to an entire keyboard in the modern sense. Experimentally used by the Master System for its reset key.
This commit is contained in:
Thomas Harte
2018-10-24 21:59:30 -04:00
parent 278585fd94
commit a8645f80bf
34 changed files with 280 additions and 143 deletions
+15 -1
View File
@@ -10,7 +10,13 @@
using namespace Inputs;
Keyboard::Keyboard() {}
Keyboard::Keyboard() {
for(int k = 0; k < int(Key::Help); ++k) {
observed_keys_.insert(Key(k));
}
}
Keyboard::Keyboard(const std::set<Key> &observed_keys) : observed_keys_(observed_keys), is_exclusive_(false) {}
void Keyboard::set_key_pressed(Key key, char value, bool is_pressed) {
std::size_t key_offset = static_cast<std::size_t>(key);
@@ -36,3 +42,11 @@ bool Keyboard::get_key_state(Key key) {
if(key_offset >= key_states_.size()) return false;
return key_states_[key_offset];
}
const std::set<Keyboard::Key> &Keyboard::observed_keys() {
return observed_keys_;
}
bool Keyboard::is_exclusive() {
return is_exclusive_;
}