On Mon, 7 Aug 2023 at 09:58, Eero Tamminen <oak@xxxxxxxxxxxxxx> wrote:
Hi Robin,
Patches look fine for me too, but GUI needs descriptions for the buttons.
Attached patch adds that, generalizes mapping handling a bit by using
array instead of separate variables, and notes the change in docs
(manual not yet updated).
Does it work OK for you?
- Eero
On 30.7.2023 11.46, Robin Sergeant wrote:
Hi,
Please find the attached patches. The first just adds the config as
before, but with checks to allow for undefined buttons (with negative
indexes).
The second adds a "Remap joystick buttons" button to the sdl joystick
dialog. This behaves like the existing "Define keys" button. The
user is guided to press each of the 3 buttons, but can also press the
ESC key for none (which results in a value of -1 being stored and the
button being ignored). The dialog looks like this:
--------------------------------
Press joystick button 1
or ESC for none...
(was: id 3)
--------------------------------
And then after pressing button 0 (but before releasing):
--------------------------------
Press joystick button 1
or ESC for none...
(now: id 0)
--------------------------------
So as I said, basically consistent with how "Define keys" currently works.
Does this look ok, and can the patches be included? Obviously happy
to make any further tweaks or change the UI etc. I should probably
have sent the proposal first, but I got carried away with the coding
and wanted to figure out how the dialogs worked :-)
Any feedback welcome!
Cheers,
Robin.
Hi Eero,
Super, thank you. I like the button descriptions, makes it much more
user friendly. I've just made a few last tweaks in a new patch (see
last attachment):
- I've changed the widths so they match the lengths of the fixed
length strings. Not really important, but it helps to show that
things are centered when looking at the table.
- I've added another condition to stop ESC key repeats being handled.
While trying to break it I noticed that if you hold ESC before opening
the dialog SDL keeps generating KEYDOWN events! Nobody would ever
actually do that, but still I think only handling the first KEYDOWN is
logical.
- I've made your names array static as I think that might reduce stack
usage. Although these days the compiler probably generates the same
code! Also reduced the scope of the counter variable at the same
time.
Hope that's all ok. To help others I am attaching all 5 patches in
order to this email. Patch 0004 is from Eero, and 0005 is hopefully
the last!
Many thanks,
Robin.