report error message via log interface when out of space

This commit is contained in:
tralph3 2025-06-26 11:57:14 -03:00
parent 4a91cac1b2
commit a397b6e5c0

6
clay.h
View file

@ -4201,6 +4201,10 @@ Clay_RenderCommandArray Clay_EndLayout(void) {
} else { } else {
message = CLAY_STRING("Clay Error: Layout elements exceeded Clay__maxElementCount"); message = CLAY_STRING("Clay Error: Layout elements exceeded Clay__maxElementCount");
} }
context->errorHandler.errorHandlerFunction(CLAY__INIT(Clay_ErrorData) {
.errorType = CLAY_ERROR_TYPE_ELEMENTS_CAPACITY_EXCEEDED,
.errorText = message,
.userData = context->errorHandler.userData });
Clay__AddRenderCommand(CLAY__INIT(Clay_RenderCommand ) { Clay__AddRenderCommand(CLAY__INIT(Clay_RenderCommand ) {
.boundingBox = { context->layoutDimensions.width / 2 - 59 * 4, context->layoutDimensions.height / 2, 0, 0 }, .boundingBox = { context->layoutDimensions.width / 2 - 59 * 4, context->layoutDimensions.height / 2, 0, 0 },
.renderData = { .text = { .stringContents = CLAY__INIT(Clay_StringSlice) { .length = message.length, .chars = message.chars, .baseChars = message.chars }, .textColor = {255, 0, 0, 255}, .fontSize = 16 } }, .renderData = { .text = { .stringContents = CLAY__INIT(Clay_StringSlice) { .length = message.length, .chars = message.chars, .baseChars = message.chars }, .textColor = {255, 0, 0, 255}, .fontSize = 16 } },
@ -4365,7 +4369,7 @@ void Clay_ResetMeasureTextCache(void) {
context->measureTextHashMap.length = 0; context->measureTextHashMap.length = 0;
context->measuredWords.length = 0; context->measuredWords.length = 0;
context->measuredWordsFreeList.length = 0; context->measuredWordsFreeList.length = 0;
for (int32_t i = 0; i < context->measureTextHashMap.capacity; ++i) { for (int32_t i = 0; i < context->measureTextHashMap.capacity; ++i) {
context->measureTextHashMap.internalArray[i] = 0; context->measureTextHashMap.internalArray[i] = 0;
} }