C7-Game / Prototype

An early-stage, open-source 4X strategy game
https://c7-game.github.io/
MIT License
33 stars 9 forks source link

Generalize keyboard shortcuts #341

Open QuintillusCFC opened 2 years ago

QuintillusCFC commented 2 years ago

At some point we should generalize our keyboard shortcuts. Currently, many of these are configured in UnitButtons.cs (although there will eventually be a wider variety of other ones, e.g. Clear Map), and they are hard-coded to specific keys. This works great if you are used to the QWERTY layout and the English version of Civ, but if you have different layouts or languages, it may not be intuitive.

This item is to make a generalized system, so the configuration can be loaded from some sort of settings file, with the default one corresponding to English + QWERTY. Once that is set up, we can work with the community to create additional default options; for example there's an active German civ community that can likely contribute sensible defaults for that version fairly quickly once we can load them from a config file.

pcen commented 1 year ago

This is done in the godot4 branch with pr https://github.com/C7-Game/Prototype/pull/405

WildWeazel commented 1 year ago

Not sure about closing this just yet as there's a configuration element that's still unimplemented. Maybe a follow-on task?

benskywalker commented 11 months ago

I'm not sure this is finished on the Godot branch - I use Colemak keyboard and shortcuts are based on the position in the Qwerty keyboard. Shortcuts like Enter, Esc, etc, all work. However, if I want to build a road with a worker, I need to press "P", which is located where "R" is on Qwerty. Wouldn't setting the key bindings to the "Unicode" setting automatically make other (English) keyboard layouts work? I did some testing and that seemed to make key bindings work for me. @pcen thoughts on making this change?

pcen commented 11 months ago

I'm not sure this is finished on the Godot branch - I use Colemak keyboard and shortcuts are based on the position in the Qwerty keyboard. Shortcuts like Enter, Esc, etc, all work. However, if I want to build a road with a worker, I need to press "P", which is located where "R" is on Qwerty. Wouldn't setting the key bindings to the "Unicode" setting automatically make other (English) keyboard layouts work? I did some testing and that seemed to make key bindings work for me. @pcen thoughts on making this change?

I didn't test on anything except the macbook keyboard, in fact I had no idea there's a unicode setting. Sounds like a great change!

WildWeazel commented 11 months ago

I'm all in favor of improved portability. Eventually there should be an in-game keymapping utility, but for now at least a single place in code to statically assign all keycodes.