We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I just got "Unhandled command type." for raylib renderer for command "CLAY__ELEMENT_CONFIG_TYPE_NONE".
My layout is just a rectangle:
Clay_RenderCommandArray CreateLayout() { Clay_BeginLayout(); CLAY_RECTANGLE({ .color = {255,255,255,0} }); Clay_RenderCommandArray renderCommands = Clay_EndLayout(); return renderCommands; }
full code
#include <stdint.h> #include <stdio.h> #include <stdlib.h> // Must be defined in one file, _before_ #include "clay.h" #define CLAY_IMPLEMENTATION #include "clay/clay.h" #include "clay/renderers/raylib/clay_renderer_raylib.c" const uint32_t FONT_ID_BODY_24 = 0; const uint32_t FONT_ID_BODY_16 = 1; #define COLOR_ORANGE (Clay_Color) {225, 138, 50, 255} #define COLOR_BLUE (Clay_Color) {111, 173, 162, 255} bool reinitializeClay = false; void HandleClayErrors(Clay_ErrorData errorData) { printf("%s", errorData.errorText.chars); if (errorData.errorType == CLAY_ERROR_TYPE_ELEMENTS_CAPACITY_EXCEEDED) { reinitializeClay = true; Clay_SetMaxElementCount(Clay_GetMaxElementCount() * 2); } else if (errorData.errorType == CLAY_ERROR_TYPE_TEXT_MEASUREMENT_CAPACITY_EXCEEDED) { reinitializeClay = true; Clay_SetMaxMeasureTextCacheWordCount(Clay_GetMaxMeasureTextCacheWordCount() * 2); } } Clay_RenderCommandArray CreateLayout() { Clay_BeginLayout(); CLAY_RECTANGLE({ .color = {255,255,255,0} }); Clay_RenderCommandArray renderCommands = Clay_EndLayout(); return renderCommands; } int main(void) { uint64_t totalMemorySize = Clay_MinMemorySize(); Clay_Arena clayMemory = Clay_CreateArenaWithCapacityAndMemory(totalMemorySize, malloc(totalMemorySize)); Clay_SetMeasureTextFunction(Raylib_MeasureText); Clay_Initialize(clayMemory, (Clay_Dimensions) { (float)GetScreenWidth(), (float)GetScreenHeight() }, (Clay_ErrorHandler) { HandleClayErrors }); Clay_Raylib_Initialize(1024, 768, "Clay - Raylib Renderer Example", FLAG_VSYNC_HINT | FLAG_WINDOW_RESIZABLE | FLAG_WINDOW_HIGHDPI | FLAG_MSAA_4X_HINT); Raylib_fonts[FONT_ID_BODY_24] = (Raylib_Font) { .font = LoadFontEx("resources/Roboto-Regular.ttf", 48, 0, 400), .fontId = FONT_ID_BODY_24, }; SetTextureFilter(Raylib_fonts[FONT_ID_BODY_24].font.texture, TEXTURE_FILTER_BILINEAR); Raylib_fonts[FONT_ID_BODY_16] = (Raylib_Font) { .font = LoadFontEx("resources/Roboto-Regular.ttf", 32, 0, 400), .fontId = FONT_ID_BODY_16, }; SetTextureFilter(Raylib_fonts[FONT_ID_BODY_16].font.texture, TEXTURE_FILTER_BILINEAR); //-------------------------------------------------------------------------------------- // Main game loop while (!WindowShouldClose()) // Detect window close button or ESC key { if (reinitializeClay) { Clay_SetMaxElementCount(8192); totalMemorySize = Clay_MinMemorySize(); clayMemory = Clay_CreateArenaWithCapacityAndMemory(totalMemorySize, malloc(totalMemorySize)); Clay_Initialize(clayMemory, (Clay_Dimensions) { (float)GetScreenWidth(), (float)GetScreenHeight() }, (Clay_ErrorHandler) { HandleClayErrors }); reinitializeClay = false; } double currentTime = GetTime(); Clay_RenderCommandArray renderCommands = CreateLayout(); printf("layout time: %f microseconds\n", (GetTime() - currentTime) * 1000 * 1000); BeginDrawing(); ClearBackground(BLACK); Clay_Raylib_Render(renderCommands); EndDrawing(); } return 0; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I just got "Unhandled command type." for raylib renderer for command "CLAY__ELEMENT_CONFIG_TYPE_NONE".
My layout is just a rectangle:
full code
The text was updated successfully, but these errors were encountered: