-
-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Color.hex
constant
#10294
Comments
Do you mean compile time evaluated? Because it can't be |
You can use constructor instead of static method const MY_COLOR = Color(0xffffffff) |
Thanks, I didn't realize this worked. I don't think it's documented. |
Turns out it's not a constructor, but an implicit conversion operator. const MY_COLOR: Color = 0xffffffff |
Describe the project you are working on
RPG roguelike with arrays of colors used to modify textures based on skin tone
Describe the problem or limitation you are having in your project
A constant array provides a performance boost, but is harder to read than using the
Color.hex
method.Describe the feature / enhancement and how it helps to overcome the problem or limitation
Make
Color.hex(...)
a constant function so it can be used in constant arrays.Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
If this enhancement will not be used often, can it be worked around with a few lines of script?
No, because constant functions cannot be defined with GDScript.
Is there a reason why this should be core and not an add-on in the asset library?
Color is a basic type in GDScript.
The text was updated successfully, but these errors were encountered: