MHeasell / rwe

Robot War Engine - Real-time strategy game engine compatible with Total Annihilation
https://www.robotwarengine.com/
GNU General Public License v3.0
116 stars 18 forks source link

Handle escape key #96

Closed OskarPedersen closed 3 years ago

OskarPedersen commented 3 years ago

Allows units to be deselected with the escape key. Edit: If the current cursor mode is not normal, pressing escape will return to the normal cursor mode.

Skirmisher commented 3 years ago

Cool! The original behavior of the escape key cancels the current cursor mode (e.g. if the player has clicked the Attack button or selected a structure to build, but hasn't issued an order yet) before deselecting units, so it's worth inserting a quick check if cursorMode is not NormalCursorMode in there (there are a number of examples elsewhere in GameScene). Also, indentation should be 4 spaces.

Glad to see another contributor to RWE :)

MHeasell commented 3 years ago

Welcome! Yep I think if this had the suggestions from Skirmisher it would be perfect :)

OskarPedersen commented 3 years ago

Thanks! Wasn't aware that the escape key did that as well, updated the PR.