TeamHypersomnia / Hypersomnia

Multiplayer top-down shooter made from scratch in C++. Play in your Browser! https://hypersomnia.io Made in 🇵🇱
https://hypersomnia.io/
GNU Affero General Public License v3.0
1.14k stars 49 forks source link

Support for binding of key combos #256

Open geneotech opened 6 years ago

geneotech commented 6 years ago

Right now, the binding of keys to their corresponding commands is of the form:

using game_intent_map = augs::enum_map<
    augs::event::keys::key, 
    game_intent_type
>;

Similarly for game_gui_intent_map, app_intent_map, app_ingame_intent_map. That means that each command can have only one associated key at most.

This proves at all insufficient for the variety of commands available in editor. (By the way, we will also need to provide an editor_intent_map).

We need some logic so that lets us bind e.g. a combo like Ctrl+F to a FIND command, or Ctrl+H to an OPEN_HISTORY command.

geneotech commented 6 years ago

Proposed solution: Let the intent maps instead be of the form:

std::unordered_map<
    std::vector<augs::event::keys::key>,
    game_intent_type
>

(Note: augs::event::keys::key represents any single keysym, like Left Shift or k.) main.cpp will need some modifications for this - whole input distribution happens there.