Repository navigation
[WIP] Allow players to pick kart icon for profile (#1771) - #5907
gui27souza wants to merge 13 commits into
Conversation
|
Take a look here: https://github.com/supertuxkart/stk-code/blob/master/data%2Fgui%2Fdialogs%2Fandroid%2Fmultitouch_settings.stkgui This uses a ribbon widget (to show the control methods for mobile) |
@SewerFox Thanks for the pointer! I took a look at multitouch_settings.stkgui, but it uses a static with pre-defined buttons declared directly in XML. In our case, since the kart icons must be loaded dynamically (and we have lots of icons, requiring multiple rows/scrolling), I had to use <ribbon_grid> (DynamicRibbonWidget). Exploring the codebase, I noticed that <ribbon_grid> is currently only used in full screens (like karts.stkgui or tracks.stkgui), and never inside a Dialog. That seems to be the root of the issue, in my view:
Do you guys know of any recommended way or existing pattern to dynamically display a list/grid of icons inside a dialog? I think it's better to stick to standard GUI practices rather than touching core engine behavior if possible. XD |
|
Just a quick update: I also enabled the "Choose Icon" option inside the settings tab ( |
The button triggers an empty dialog, with a boilerplate dialog (IconSelectionDialog), which will be implemented next
1664c89 to
94a3824
Compare
|
Since the grid alignment is fixed, but still need some guidance on how to proceed, I'm sending this PR as ready for review, but also aware of what is still not ready on the Icon Selection Dialog:
Even though, it's possible now to choose an icon directly from the user_screen:
|
|
Hello Gui, I tested your code and the icon system works as promised, but about the UI, I think using the same DynamicRibbon style of the user icons in the user selection screen would be better than using a badge to indicate the selected icon (to follow the same pattern of all screens). |
|
@SewerFox Hello! Thanks a lot for testing and for the feedback! XD That makes total sense. Just to give a bit of context: I used the badge mainly as a workaround for the dialog quirks. Since mouse clicks weren't locking the focus/selection on ribbon items inside the modal, the badge was the only way I found to give visual feedback that an icon was picked. Regarding the scroll system: when testing earlier, I tried <scrollable_ribbon>, but having all the kart icons in a single horizontal line didn't feel as pleasant for UX compared to seeing the grid of icons at once. If I'm not mistaken, <ribbon_grid> (DynamicRibbonWidget) already has pagination/scroll arrows built-in when there are many items, but the dialog event handling was getting in the way. Because of that, I was considering turning IconSelectionDialog into a full Screen instead. That would likely solve all these GUI issues at once: mouse selection, keyboard/arrow navigation, and the native grid pagination would work out of the box (just like in the kart selection screen). What do you think about this approach? Meanwhile, I'm almost done with the custom icon upload feature (which works independently of whether this is a Dialog or a Screen) and I plan to finish first. If handling the ribbon inside a modal proves too problematic, I can try converting it to a Screen. Sounds like a good plan? |
|
Well, taking in account that there is a real change of some player have gazillion of installed karts (that's usual), the screen may be the most suitable option imo |
|
Quick update As planned, I've just pushed the custom icon upload implementation to this PR:
I also changed the PR back to [WIP] and updated the description. Now that the upload backend and UI are in place, my next step is converting the |



Agreement
Summary
Work in progress for issue #1771. Players can now pick a native kart icon or enter a custom file path to set as their profile icon directly from the User Screen and Settings tab.
Current State & What works:
UserScreenandTabbedUserScreen.IconPathInputDialog):.png,.jpg,.jpeg), corrupted/unsupported file checks, and 1:1 aspect ratio tolerance (0.9 to 1.1).PlayerProfile::setIconFromPath(...).#ifdef MOBILE_STK).Next Steps / WIP:
Following feedback from @SewerFox , modal dialogs have inherent engine limitations with dynamic ribbons (mouse clicks not triggering selection and keyboard focus quirks).
IconSelectionDialoginto a fullScreen(IconSelectionScreen) to natively support mouse selection, arrow key navigation, and pagination arrows when many karts/addons are installed.