P1X-in / tanks-of-freedom-ii

Indie Turn Based Strategy in Isometric Voxel Art http://tof.p1x.in
Other
194 stars 19 forks source link

Added hotkey icons to 'End turn' and 'Stats' buttons #22

Open dfgworm opened 2 months ago

dfgworm commented 2 months ago

These can be easily added to other places. They support gamepad and keyboard icons at the same time, and the size is customizable (for spacebar icon for example). It should detect gamepad keypresses automatically and update all icons. I can't test that, but it seems pretty trivial.

I think such contextual tips are much better than that panel on the side.

I would suggest binding these hotkey nodes directly to input action names, so the icons just read the bound hotkeys of the action and select an icon accordingly. That would enable user to remap hotkeys and see them change in game. But that requires mapping all icons from icon atlas to their actual key names, which is probably quite a bit of work. An easier alternative would be to just use text with a generic background icon (with some exceptions maybe).

czlowiekimadlo commented 2 months ago

Remapping hotkeys is something I should have thought much earlier, adding it now would be nice, but a lot of work. Probably will get back to it at some point.

I would suggest binding these hotkey nodes directly to input action names, so the icons just read the bound hotkeys of the action and select an icon accordingly.

Many actions have multiple, redundant keys bound to them, so it would not be that simple I think.

czlowiekimadlo commented 2 months ago

I have tested your PR, it breaks the menu. Also, showing gamepad buttons on these hints is not that helpful, as they disappear when gamepad is used. This is intentional, as the game target handhelds, where screen real estate is in high demand, I don't want to waste it on UI that is not needed there.

dfgworm commented 2 months ago

I have tested your PR, it breaks the menu.

Oups

[connection signal="mouse_entered" from="turn_button/mouse_click" to="." method="_on_mouse_click_mouse_entered" binds= ["turn"]]
[connection signal="mouse_exited" from="turn_button/mouse_click" to="." method="_on_mouse_click_mouse_exited" binds= ["turn"]]

Somehow all scene connections got deleted right before i created the PR. Dunno how that happened.

Also, showing gamepad buttons on these hints is not that helpful

Ah, i had no idea. Still, my icon class is useful to display icons from the atlas, as it offers customizable size and can relatively easily be refactored into a Control node. Also, switching between gamepad and keyboard can be used in that tooltip on the right, to remove keyboard hints from gamepad version.

Many actions have multiple, redundant keys bound to them, so it would not be that simple I think.

You can just display the primary key i think. Though it is also possible to display several near each other or to cycle through them like every 5 seconds.

dfgworm commented 2 months ago

Seems all functional. Size of that menu can already be reduced slightly. It can be reduced even more in case of gamepad controls.