arcade
arcade copied to clipboard
Controller support within GUI
Vision:
GUI should support controller input without or just a little effort.
Tasks:
- [x] General focus traversal
- [x] Pass controller events as UIEvents
- [x] provide first example
- [x] Make all interactable widgets usable:
- [x] UITexturedButton
- [x] UIFlatButton
- [x] UISlider
- [x] UIDropdown
- [x] Handle different views
- [ ] Interoperability with ActionsInput
- [x] Global switch to toggle focus handling
- [x] UIWidgets have to show focus themselves
Task from Feedback
- [x] If a controller connects multiple times, it crashes because of .open, which can be simply catched with a try except ( I did it on my machine)
- [x] UIDropdown overlay widgets cant be focused, because they are not re-detected on show
- [x] can only click on UISlider, and if so, it will set it to the middle value
- [x] Currently i have an issue with UIGridLayout and UIScrollbar not working together. The focus is in the wrong place. Image attached.
- [x] UIFlatButtons and UITextureButtons dont count focus as hover, which i think would be a nice addition
PR: #2566
Details
- An adapter handles connected controllers and passes on_ controller callbacks to the UIManager as UIEvents
- A UIFocusMixin can be used to make Layouts handle controller input
- to support UIScrollArea, UIFocusGroup or UIFocusMixin has to be inside of it
Further notes
It might be a good idea to provide some ControllerWindow or something which passes controller events to the window, so the UIManager enable/disable flow could just work.
- [x] Add ControllerWindow
Next Steps
- [ ] Global config du disable keyboard/controller focus changes Disable keyboard focus changes would prevent consuming interactions via tab.
- [ ] merge
UIFoxusMixininto UILayouts (maybe in UILayout itself
It might be a good idea to provide some ControllerWindow
We might be near the point where we should start looking into the pyglet event -> class adapter design. I have the following questions:
- Do you want someone with a controller to help test this on Linux?
- Are we assuming that each OOP event handler method takes only the following? 1.
self2. the event object
- that would be great :)
- at least for GUI that is how the event handler look like, they only get the event (and self)
Initial setup is merged and released with 3.2. I will keep iterating on the support to ship it out of the experimental subpackage