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

Added more debug color variables #159

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

leidegre
Copy link

@leidegre leidegre commented Jan 3, 2025

This PR adds additional global variables for debug view, these are the ones I could find that were constants or involved constants somehow by pulling all these into variables you can now convert these variables from 8-bit to whatever your rendering backend uses, I have for example the following snippet in my Clay program for which makes the debug view render nicely (I use a custom Direct2D based backend and not Raylib). This backend uses color values in the range of 0 to 1.

The following may be suitable to make into a Clay utility function that does this conversion for you, which can be called to normalize color values if that is what you want for your backend.

#define CLAY_COLOR_NORMALIZE(c,n) (Clay_Color){c.r/n,c.g/n,c.b/n,c.a/n}

CLAY__DEBUGVIEW_COLOR_1=CLAY_COLOR_NORMALIZE(CLAY__DEBUGVIEW_COLOR_1,255.0f);
CLAY__DEBUGVIEW_COLOR_2=CLAY_COLOR_NORMALIZE(CLAY__DEBUGVIEW_COLOR_2,255.0f);
CLAY__DEBUGVIEW_COLOR_3=CLAY_COLOR_NORMALIZE(CLAY__DEBUGVIEW_COLOR_3,255.0f);
CLAY__DEBUGVIEW_COLOR_4=CLAY_COLOR_NORMALIZE(CLAY__DEBUGVIEW_COLOR_4,255.0f);
CLAY__DEBUGVIEW_COLOR_CLOSE_BUTTON_1=CLAY_COLOR_NORMALIZE(CLAY__DEBUGVIEW_COLOR_CLOSE_BUTTON_1,255.0f);
CLAY__DEBUGVIEW_COLOR_CLOSE_BUTTON_2=CLAY_COLOR_NORMALIZE(CLAY__DEBUGVIEW_COLOR_CLOSE_BUTTON_2,255.0f);
CLAY__DEBUGVIEW_COLOR_TYPE_BACKGROUND_ALPHA/=255.0f;
CLAY__DEBUGVIEW_COLOR_TYPE_RECTANGLE=CLAY_COLOR_NORMALIZE(CLAY__DEBUGVIEW_COLOR_TYPE_RECTANGLE,255.0f);
CLAY__DEBUGVIEW_COLOR_TYPE_TEXT=CLAY_COLOR_NORMALIZE(CLAY__DEBUGVIEW_COLOR_TYPE_TEXT,255.0f);
CLAY__DEBUGVIEW_COLOR_TYPE_IMAGE=CLAY_COLOR_NORMALIZE(CLAY__DEBUGVIEW_COLOR_TYPE_IMAGE,255.0f);
CLAY__DEBUGVIEW_COLOR_TYPE_FLOATING_CONTAINER=CLAY_COLOR_NORMALIZE(CLAY__DEBUGVIEW_COLOR_TYPE_FLOATING_CONTAINER,255.0f);
CLAY__DEBUGVIEW_COLOR_TYPE_SCROLL_CONTAINER=CLAY_COLOR_NORMALIZE(CLAY__DEBUGVIEW_COLOR_TYPE_SCROLL_CONTAINER,255.0f);
CLAY__DEBUGVIEW_COLOR_TYPE_BORDER_CONTAINER=CLAY_COLOR_NORMALIZE(CLAY__DEBUGVIEW_COLOR_TYPE_BORDER_CONTAINER,255.0f);
CLAY__DEBUGVIEW_COLOR_TYPE_CUSTOM=CLAY_COLOR_NORMALIZE(CLAY__DEBUGVIEW_COLOR_TYPE_CUSTOM,255.0f);
CLAY__DEBUGVIEW_COLOR_TYPE_ERROR=  CLAY_COLOR_NORMALIZE(CLAY__DEBUGVIEW_COLOR_TYPE_ERROR,255.0f);
CLAY__DEBUGVIEW_COLOR_SELECTED_ROW=CLAY_COLOR_NORMALIZE(CLAY__DEBUGVIEW_COLOR_SELECTED_ROW,255.0f);
Clay__DebugView_TextNameConfig.textColor=CLAY_COLOR_NORMALIZE(Clay__DebugView_TextNameConfig.textColor,255.0f);

Feel free to merge this or don't, I just wrote this up as a suggestion. If it doesn't make sense no worries.

@nicbarker nicbarker force-pushed the main branch 2 times, most recently from 4fd677e to 338852b Compare January 14, 2025 08:46
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

Successfully merging this pull request may close these issues.

1 participant