You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Handling of enums feels relatively complex especially when working with things such as key codes, having to construct a variant, or convert to variant name and then do a string comparison makes our script api relatively unfriendly to users when considering things like modding etc.
i.e. with the input being KeyboardInput event.
function on_input(event)
local key = event.key_code:variant_name()
if (key == "KeyA") then
info("move left")
end
end
local KeyA = construct(types.KeyCode, {
variant = "KeyA"
})
function on_input(event)
if (event.key_code == KeyA) then
info("move left")
end
end
Describe the solution you'd like
A simpler way to handle enum variants, or even a well defined set of globals for bevy bindings (and a way for the user to easily define their own)
function on_input(event)
if (event.key_code == KeyCode.KeyA) then
info("move left")
end
end
function on_input(event)
if (event.key_code == keys.KeyA) then
info("move left")
end
end
Describe alternatives you've considered
This could be defined in a lua set of globals relatively easily.
We might want bits of both of these functionalities, and in fact constructors as a whole could be made slightly more readable this way, then we would need to differentiate between constructors and discriminants, perhaps using: MyEnum.variants.MyVariant
Uh oh!
There was an error while loading. Please reload this page.
Is your feature request related to a problem? Please describe.
Handling of enums feels relatively complex especially when working with things such as key codes, having to construct a variant, or convert to variant name and then do a string comparison makes our script api relatively unfriendly to users when considering things like modding etc.
i.e. with the input being
KeyboardInput
event.Describe the solution you'd like
A simpler way to handle enum variants, or even a well defined set of globals for bevy bindings (and a way for the user to easily define their own)
Describe alternatives you've considered
This could be defined in a lua set of globals relatively easily.
Or register a global manually.
However this seems like an important binding to upstream if possible.
The text was updated successfully, but these errors were encountered: