Hopson97 / open-builder

Open "Minecraft-like" game with multiplayer support and Lua scripting support for the both client and server
https://github.com/Hopson97/open-builder/projects/3
GNU General Public License v3.0
700 stars 80 forks source link

Unknown keys error screen popup #184 #187

Closed remuzel closed 4 years ago

remuzel commented 4 years ago

This addresses issue #184

Simply adding an if statement to check the event key code, and do nothing (return) if it is -1.

I assumed that any unknown/undefined keys would lead to a keycode of -1, and thus this quick fix should catch them all.

gml16 commented 4 years ago

Why not just have if (e.key.code == -1) return; once before the switch?

remuzel commented 4 years ago

I didn't want it to happen for any kind of event. Maybe there is no key under other types of events? I might've been overly cautious but yeah.