Compare commits

...

3 Commits

Author SHA1 Message Date
Michael Savage
a16ae82919
Merge 86cadd6651 into 4f8957d5d2 2025-03-07 12:39:17 +02:00
Michael Savage
86cadd6651 [Core] Add a userData pointer to Clay_TextElementConfig 2025-03-07 10:39:07 +00:00
Ethan McCue
4f8957d5d2
[Documentation] Fix typo (#315)
Some checks are pending
CMake on multiple platforms / build (Release, cl, cl, windows-latest) (push) Waiting to run
CMake on multiple platforms / build (Release, clang, clang++, ubuntu-latest) (push) Waiting to run
CMake on multiple platforms / build (Release, gcc, g++, ubuntu-latest) (push) Waiting to run
2025-03-07 21:45:27 +13:00

6
clay.h
View File

@ -266,7 +266,7 @@ typedef CLAY_PACKED_ENUM {
CLAY_ALIGN_Y_TOP, CLAY_ALIGN_Y_TOP,
// Aligns child elements to the bottom of this element, offset by padding.width.bottom // Aligns child elements to the bottom of this element, offset by padding.width.bottom
CLAY_ALIGN_Y_BOTTOM, CLAY_ALIGN_Y_BOTTOM,
// Aligns child elements vertiically to the center of this element // Aligns child elements vertically to the center of this element
CLAY_ALIGN_Y_CENTER, CLAY_ALIGN_Y_CENTER,
} Clay_LayoutAlignmentY; } Clay_LayoutAlignmentY;
@ -357,6 +357,8 @@ typedef CLAY_PACKED_ENUM {
// Controls various functionality related to text elements. // Controls various functionality related to text elements.
typedef struct { typedef struct {
// A pointer that will be transparently passed through to the resulting render command.
void *userData;
// The RGBA color of the font to render, conventionally specified as 0-255. // The RGBA color of the font to render, conventionally specified as 0-255.
Clay_Color textColor; Clay_Color textColor;
// An integer transparently passed to Clay_MeasureText to identify the font to use. // An integer transparently passed to Clay_MeasureText to identify the font to use.
@ -2692,7 +2694,7 @@ void Clay__CalculateFinalLayout(void) {
.letterSpacing = textElementConfig->letterSpacing, .letterSpacing = textElementConfig->letterSpacing,
.lineHeight = textElementConfig->lineHeight, .lineHeight = textElementConfig->lineHeight,
}}, }},
.userData = sharedConfig->userData, .userData = textElementConfig->userData,
.id = Clay__HashNumber(lineIndex, currentElement->id).id, .id = Clay__HashNumber(lineIndex, currentElement->id).id,
.zIndex = root->zIndex, .zIndex = root->zIndex,
.commandType = CLAY_RENDER_COMMAND_TYPE_TEXT, .commandType = CLAY_RENDER_COMMAND_TYPE_TEXT,