Skip to content
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

[Core] Fix assumption of colour channel ranges as 0-255 #75

Open
mikejsavage opened this issue Dec 21, 2024 · 2 comments
Open

[Core] Fix assumption of colour channel ranges as 0-255 #75

mikejsavage opened this issue Dec 21, 2024 · 2 comments

Comments

@mikejsavage
Copy link
Contributor

Clay_Color is defined as 4 floats, so you would expect each component to range from 0-1, but the inspector hardcodes colours with components in 0-255 as if it was 4x uint8.

Besides the inspector clay doesn't seem to care what you put in Clay_Color so it's not a big deal, but it would still be nice to clear this up.

@raugl
Copy link

raugl commented Dec 23, 2024

I too would like to see it changed to 4 uint8_ts. I'm working on another set of bindings for zig and I have replaced clay's BoundingBox and Vector2 with raylib's equivalents as they allow the use of methods on otherwise memory compatible types. I would love to be able to do the same with Color, especially since I don't see a good reason for them being floats, maybe other than fewer internal casts.

@nicbarker
Copy link
Owner

@mikejsavage I totally agree, the inspector hardcoding colour values was a mistake. I wanted to make sure the data type was flexible enough to support formats that use 4x floats in 0-1 range, but they are 0-255 simply because that's what raylib asks for.

Perhaps the correct solution is that the user can optionally provide a function pointer that transforms Clay_Color -> Clay_Color that the debugger calls to transform it's internal colours into a format that the user decides on.

@nicbarker nicbarker changed the title Minor: Clay_Color range is unintuitive [Core] Fix assumption of colours as 0-255 Dec 24, 2024
@nicbarker nicbarker changed the title [Core] Fix assumption of colours as 0-255 [Core] Fix assumption of colours channel ranges as 0-255 Dec 24, 2024
@nicbarker nicbarker changed the title [Core] Fix assumption of colours channel ranges as 0-255 [Core] Fix assumption of colour channel ranges as 0-255 Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants