diff --git a/renderers/raylib/clay_renderer_raylib.c b/renderers/raylib/clay_renderer_raylib.c index 7fbc2c7..0801b37 100644 --- a/renderers/raylib/clay_renderer_raylib.c +++ b/renderers/raylib/clay_renderer_raylib.c @@ -12,7 +12,8 @@ Camera Raylib_camera; typedef enum { - CUSTOM_LAYOUT_ELEMENT_TYPE_3D_MODEL + CUSTOM_LAYOUT_ELEMENT_TYPE_3D_MODEL, + CUSTOM_LAYOUT_ELEMENT_TYPE_GENERIC, } CustomLayoutElementType; typedef struct @@ -23,11 +24,18 @@ typedef struct Matrix rotation; } CustomLayoutElement_3DModel; +typedef struct +{ + void (*procedure) (Clay_RenderCommandArray *renderCommands, int32_t index, void * arguments); + void * arguments; +} CustomLayoutElement_Generic; + typedef struct { CustomLayoutElementType type; union { CustomLayoutElement_3DModel model; + CustomLayoutElement_Generic function; } customData; } CustomLayoutElement; @@ -308,6 +316,11 @@ void Clay_Raylib_Render(Clay_RenderCommandArray renderCommands, Font* fonts) EndMode3D(); break; } + case CUSTOM_LAYOUT_ELEMENT_TYPE_GENERIC: { + CustomLayoutElement_Generic customFunction = customElement->customData.function; + customFunction.procedure(&renderCommands, j, customFunction.arguments); + break; + } default: break; } break;