From b772e646f20ad6b99670295f9f3ce23458085449 Mon Sep 17 00:00:00 2001 From: FintasticMan Date: Thu, 2 Jan 2025 14:00:23 +0100 Subject: [PATCH] [Core] Remove ##__VA_ARGS__ in CLAY macro --- README.md | 7 ++++--- clay.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f4c34a0..5382577 100644 --- a/README.md +++ b/README.md @@ -187,7 +187,7 @@ CLAY(CLAY_LAYOUT({ .layoutDirection = CLAY_TOP_TO_BOTTOM })) { } // Only render this element if we're on a mobile screen if (isMobileScreen) { - CLAY() { + CLAY(0) { // etc } } @@ -362,7 +362,7 @@ typedef struct t_CustomElementData { Model myModel = Load3DModel(filePath); CustomElement modelElement = (CustomElement) { .type = CUSTOM_ELEMENT_TYPE_MODEL, .model = myModel } // ... -CLAY() { +CLAY(0) { // This config is type safe and contains the CustomElementData struct CLAY(CLAY_CUSTOM_ELEMENT({ .customData = { .type = CUSTOM_ELEMENT_TYPE_MODEL, .model = myModel } })) {} } @@ -602,6 +602,7 @@ Returns a [Clay_ElementId](#clay_elementid) for the provided id string, used for **Notes** **CLAY** opens a generic empty container, that is configurable and supports nested children. +**CLAY** requires at least 1 parameter, so if you want to create an element without any configuration, use `CLAY(0)`. **Examples** ```C @@ -1883,4 +1884,4 @@ A [Clay_String](#clay_string) that provides a human readable description of the A generic pointer to extra userdata that is transparently passed through from `Clay_Initialize` to Clay's error handler callback. Defaults to NULL. ---- \ No newline at end of file +--- diff --git a/clay.h b/clay.h index 9850890..47e6ee0 100644 --- a/clay.h +++ b/clay.h @@ -119,7 +119,7 @@ static uint8_t CLAY__ELEMENT_DEFINITION_LATCH; */ #define CLAY(...) \ for (\ - CLAY__ELEMENT_DEFINITION_LATCH = (Clay__OpenElement(), ##__VA_ARGS__, Clay__ElementPostConfiguration(), 0); \ + CLAY__ELEMENT_DEFINITION_LATCH = (Clay__OpenElement(), __VA_ARGS__, Clay__ElementPostConfiguration(), 0); \ CLAY__ELEMENT_DEFINITION_LATCH < 1; \ ++CLAY__ELEMENT_DEFINITION_LATCH, Clay__CloseElement() \ )