MCPcopy Create free account
hub / github.com/ErrorAtLine0/infinipaint / Clay__RenderDebugView

Function Clay__RenderDebugView

include/clay.h:3523–3949  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3521}
3522
3523void Clay__RenderDebugView(void) {
3524 Clay_Context* context = Clay_GetCurrentContext();
3525 Clay_ElementId closeButtonId = Clay__HashString(CLAY_STRING("Clay__DebugViewTopHeaderCloseButtonOuter"), 0);
3526 if (context->pointerInfo.state == CLAY_POINTER_DATA_PRESSED_THIS_FRAME) {
3527 for (int32_t i = 0; i < context->pointerOverIds.length; ++i) {
3528 Clay_ElementId *elementId = Clay_ElementIdArray_Get(&context->pointerOverIds, i);
3529 if (elementId->id == closeButtonId.id) {
3530 context->debugModeEnabled = false;
3531 return;
3532 }
3533 }
3534 }
3535
3536 uint32_t initialRootsLength = context->layoutElementTreeRoots.length;
3537 uint32_t initialElementsLength = context->layoutElements.length;
3538 Clay_TextElementConfig infoTextConfig = CLAY_TEXT_CONFIG({ .textColor = CLAY__DEBUGVIEW_COLOR_4, .fontSize = 16, .wrapMode = CLAY_TEXT_WRAP_NONE });
3539 Clay_TextElementConfig infoTitleConfig = CLAY_TEXT_CONFIG({ .textColor = CLAY__DEBUGVIEW_COLOR_3, .fontSize = 16, .wrapMode = CLAY_TEXT_WRAP_NONE });
3540 Clay_ElementId scrollId = Clay__HashString(CLAY_STRING("Clay__DebugViewOuterScrollPane"), 0);
3541 float scrollYOffset = 0;
3542 bool pointerInDebugView = context->pointerInfo.position.y < context->layoutDimensions.height - 300;
3543 for (int32_t i = 0; i < context->scrollContainerDatas.length; ++i) {
3544 Clay__ScrollContainerDataInternal *scrollContainerData = Clay__ScrollContainerDataInternalArray_Get(&context->scrollContainerDatas, i);
3545 if (scrollContainerData->elementId == scrollId.id) {
3546 if (!context->externalScrollHandlingEnabled) {
3547 scrollYOffset = scrollContainerData->scrollPosition.y;
3548 } else {
3549 pointerInDebugView = context->pointerInfo.position.y + scrollContainerData->scrollPosition.y < context->layoutDimensions.height - 300;
3550 }
3551 break;
3552 }
3553 }
3554 int32_t highlightedRow = pointerInDebugView
3555 ? (int32_t)((context->pointerInfo.position.y - scrollYOffset) / (float)CLAY__DEBUGVIEW_ROW_HEIGHT) - 1
3556 : -1;
3557 if (context->pointerInfo.position.x < context->layoutDimensions.width - (float)Clay__debugViewWidth) {
3558 highlightedRow = -1;
3559 }
3560 Clay__RenderDebugLayoutData layoutData = CLAY__DEFAULT_STRUCT;
3561 CLAY(CLAY_ID("Clay__DebugView"), {
3562 .layout = { .sizing = { CLAY_SIZING_FIXED((float)Clay__debugViewWidth) , CLAY_SIZING_FIXED(context->layoutDimensions.height) }, .layoutDirection = CLAY_TOP_TO_BOTTOM },
3563 .floating = { .zIndex = 32765, .attachPoints = { .element = CLAY_ATTACH_POINT_LEFT_CENTER, .parent = CLAY_ATTACH_POINT_RIGHT_CENTER }, .attachTo = CLAY_ATTACH_TO_ROOT, .clipTo = CLAY_CLIP_TO_ATTACHED_PARENT },
3564 .border = { .color = CLAY__DEBUGVIEW_COLOR_3, .width = { .bottom = 1 } }
3565 }) {
3566 CLAY_AUTO_ID({ .layout = { .sizing = {CLAY_SIZING_GROW(0), CLAY_SIZING_FIXED(CLAY__DEBUGVIEW_ROW_HEIGHT)}, .padding = {CLAY__DEBUGVIEW_OUTER_PADDING, CLAY__DEBUGVIEW_OUTER_PADDING, 0, 0 }, .childAlignment = {.y = CLAY_ALIGN_Y_CENTER} }, .backgroundColor = CLAY__DEBUGVIEW_COLOR_2 }) {
3567 CLAY_TEXT(CLAY_STRING("Clay Debug Tools"), infoTextConfig);
3568 CLAY_AUTO_ID({ .layout = { .sizing = { .width = CLAY_SIZING_GROW(0) } } }) {}
3569 // Close button
3570 CLAY_AUTO_ID({
3571 .layout = { .sizing = {CLAY_SIZING_FIXED(CLAY__DEBUGVIEW_ROW_HEIGHT - 10), CLAY_SIZING_FIXED(CLAY__DEBUGVIEW_ROW_HEIGHT - 10)}, .childAlignment = {CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_CENTER} },
3572 .backgroundColor = {217,91,67,80},
3573 .cornerRadius = CLAY_CORNER_RADIUS(4),
3574 .border = { .color = { 217,91,67,255 }, .width = { 1, 1, 1, 1, 0 } },
3575 }) {
3576 Clay_OnHover(HandleDebugViewCloseButtonInteraction, 0);
3577 CLAY_TEXT(CLAY_STRING("x"), CLAY_TEXT_CONFIG({ .textColor = CLAY__DEBUGVIEW_COLOR_4, .fontSize = 16 }));
3578 }
3579 }
3580 CLAY_AUTO_ID({ .layout = { .sizing = {CLAY_SIZING_GROW(0), CLAY_SIZING_FIXED(1)} }, .backgroundColor = CLAY__DEBUGVIEW_COLOR_3 } ) {}

Callers 1

Clay_EndLayoutFunction · 0.85

Calls 15

Clay_GetCurrentContextFunction · 0.85
Clay__HashStringFunction · 0.85
CLAY_AUTO_IDFunction · 0.85
Clay_OnHoverFunction · 0.85
Clay_GetScrollOffsetFunction · 0.85
Clay__GetHashMapItemFunction · 0.85
Clay__IntToStringFunction · 0.85

Tested by

no test coverage detected