Currently, input configuration is unfinished. This includes joystick support, keyboard remapping, etc. While there are classes that represent basic concepts, the design has not solidified for real-world use. If a player wanted to customize the buttons on their controls, seamlessly use a joystick, or, if the developer wanted to support different controller types, those options are not yet available.
This PR adds new essential classes. Also included are some modifications/refactors to integrate these new classes.
Key elements are:
Add a Player class.
Add VirtualControllers::Base and a class hierarchy, including:
VirtualControllers::GenericController
VirtualControllers::Keyboard
Add PhysicalInputDevices::Base and a class hierarchy, including:
PhysicalInputDevices::Joysticks::Base
PhysicalInputDevices::Keyboard
Updates to VirtualControlProcessor handling of new virtual inputs.
Mapping
Also introduced is an explicit mapping class PhysicalInputDeviceToVirtualControllerMapping. This is an association class that contains pointers to player, a physical input device, the virtual input device, and then contains a mapping between the two devices.
When initializing VirtualControlProcessor, a "reasonable" mapping is automatically created. For now, this will preserve the previous routing and controller mapping behaviour that is currently present in the system, so nothing should break. (Note the signature of the virtual control functions will change, see blow). In the future, the mapping may need to be created explicitly rather than implicitly during initialize(). If that's the case then helper functions will be made available.
Deprecated Features, Required Upgrades
⚠️ This change will likely break build on some projects. Please update signatures for the following functions:
AllegroFlare::Screens::Base::virtual_control_button_up_func() functions now have a different signature.
AllegroFlare::Screens::Base::virtual_control_button_down_func() functions now have a different signature.
AllegroFlare::VirtualControl (but mostly its constants) should be replaced with AllegroFlare::VirtualControllers::Base or AllegroFlare::VirtualControllers::GenericController.
Problem
Currently, input configuration is unfinished. This includes joystick support, keyboard remapping, etc. While there are classes that represent basic concepts, the design has not solidified for real-world use. If a player wanted to customize the buttons on their controls, seamlessly use a joystick, or, if the developer wanted to support different controller types, those options are not yet available.
More info available on the Project Doc.
Solution
This PR adds new essential classes. Also included are some modifications/refactors to integrate these new classes.
Key elements are:
Player
class.VirtualControllers::Base
and a class hierarchy, including:VirtualControllers::GenericController
VirtualControllers::Keyboard
PhysicalInputDevices::Base
and a class hierarchy, including:PhysicalInputDevices::Joysticks::Base
PhysicalInputDevices::Keyboard
VirtualControlProcessor
handling of new virtual inputs.Mapping
Also introduced is an explicit mapping class
PhysicalInputDeviceToVirtualControllerMapping
. This is an association class that contains pointers to player, a physical input device, the virtual input device, and then contains a mapping between the two devices.When initializing
VirtualControlProcessor
, a "reasonable" mapping is automatically created. For now, this will preserve the previous routing and controller mapping behaviour that is currently present in the system, so nothing should break. (Note the signature of the virtual control functions will change, see blow). In the future, the mapping may need to be created explicitly rather than implicitly duringinitialize()
. If that's the case then helper functions will be made available.Deprecated Features, Required Upgrades
⚠️ This change will likely break build on some projects. Please update signatures for the following functions:
AllegroFlare::Screens::Base::virtual_control_button_up_func()
functions now have a different signature.AllegroFlare::Screens::Base::virtual_control_button_down_func()
functions now have a different signature.AllegroFlare::VirtualControl
(but mostly its constants) should be replaced withAllegroFlare::VirtualControllers::Base
orAllegroFlare::VirtualControllers::GenericController
.