frostoven/Cosmosis

Implement complete input management

aggregate1166877 opened this issue · 1 comments

Details:
The way input modes are currently implemented in core has a design mistake that needs to be addressed before the UI can be implemented. If correctly implemented, different modes may sometimes, but not always, be mutually exclusive. You can have more than one active at a time, with input preference based on some predefined [hardcoded] priority.

Using Dark Souls as an example: you can run around while in ANY menu, but arrow keys and interaction keys are now snatched by the menu and don't make their way to the game. Some flight have similar features.

Needed result:
For each action mode, send the current key(s) pressed.

By default, all active mode controllers¹ should receive key input simultaneously. A controller is allowed to request priority or exclusive access.

Bonus points:
Don't allow the key controllers to actually receive keys; rather, have them receive actions. This makes control bindings completely transparent, and allows abstracting between, say, keyboard and mouse events.

Completion of this task does not require implementing all possible peripherals; rather, it requires setting up the basic framework to facilitate any peripherals.

¹ Controller in this case refers to a logical piece of software controlling what happens to actions generated by input from any source, including keyboard / mouse / gamepad. It does not mean 'hardware device'.

Done and dusted. Input is universal and transparent, and you can choose which pieces of code are mutually exclusive with other pieces of code without them knowing about each other.

At the time of closing this ticket, the space ship can be controlled while in the game menus, and the player has the option (via LeftCtrl) to regain mouse control while in the menus in emergencies.