Multi-focus, player-specific input events.
Created by: Faless
Mostly implement what discussed in #20091 . Focus uses group names (strings) instead of booleans.
A demo project with split screen, separate focus and inputs is available here:
(W,A,S,D,Space ||| LEFT,RIGHT,UP,DOWN, Enter
)
ActionPlayer.zip (live HTML5 here, you need to first click into the page after loading for input to start working)
The PR basically add a player
field to each input event in the InputMap
.
Action related methods have a new parameter for specifying which player to filter (0
for no filtering).
Viewport have two new properties under "GUI" section: input_player
to specify which player the UI will filter (default 0
, i.e. no filtering) and focus_group
property decides focus sharing. Viewports in the same focus_group
share focus across them.
This change is quite hacky, and we are still trying to figure out if there's a better way then this to get multifocus and UI actions working together. Without overcomplicating things but still allowing people to make split screen games and use Godot UI nodes.
I'm setting this PR to milestone 4.0 so we can get @reduz input once he is done with Vulkan. If anyone has suggestions, ideas, they are more than welcome.
Fixes #10755