From 185a6992791319c4b5a12977fc07e0861e881b3f Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 19 Oct 2017 22:01:24 -0400 Subject: [PATCH] Fixes off-by-one keyboard state accumulation error. --- Inputs/Keyboard.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Inputs/Keyboard.cpp b/Inputs/Keyboard.cpp index 6acfec9bc..b424ccbb9 100644 --- a/Inputs/Keyboard.cpp +++ b/Inputs/Keyboard.cpp @@ -14,8 +14,8 @@ Keyboard::Keyboard() {} void Keyboard::set_key_pressed(Key key, bool is_pressed) { size_t key_offset = static_cast(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;