1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-25 18:30:21 +00:00

Fixes off-by-one keyboard state accumulation error.

This commit is contained in:
Thomas Harte 2017-10-19 22:01:24 -04:00
parent 96b8f9ae9f
commit 185a699279

View File

@ -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;