mirror of
https://github.com/TomHarte/CLK.git
synced 2026-04-21 02:17:08 +00:00
Fixes off-by-one keyboard state accumulation error.
This commit is contained in:
+2
-2
@@ -14,8 +14,8 @@ Keyboard::Keyboard() {}
|
||||
|
||||
void Keyboard::set_key_pressed(Key key, bool is_pressed) {
|
||||
size_t key_offset = static_cast<size_t>(key);
|
||||
if(key_offset > key_states_.size()) {
|
||||
key_states_.resize(key_offset, false);
|
||||
if(key_offset >= key_states_.size()) {
|
||||
key_states_.resize(key_offset+1, false);
|
||||
}
|
||||
key_states_[key_offset] = is_pressed;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user