I want to fire InputEventJoypadButton, and to avoid hard-coding an event for every button I came up with the idea to type the enumeration into the button’s text property. But what an idea.
to avoid hard-coding an event for every button I came up with
It would be way more elegant indeed, sad that Global enums are weird special guys, I’m guessing it’s because they are declared in the C++ code and are not gdscript objects
Well good luck! It’s a cool project, I never thought of doing something like that with Godot.
I don’t know anything about this and have probably misunderstood your question, but just taking a guess. If the buttons are stored in an enum and have button indexes, wouldn’t the indexes correspond with the enum index? In that case you could just not append each index into a non-global enum/array/dictionary and get the ints from there? As it sounds like the problem is that global enums dont have this functionality.
And yes! It’s a really smart way of encoding the value in the the index. However my concern is: if we can represent an enum in its symbolic form, we don’t want to rely on its integeral form in any way (incl. where implicitly bound to array indices), because the latter is subject to change (in future engine versions).