[Core] Remove ##__VA_ARGS__ in CLAY macro

This commit is contained in:
FintasticMan 2025-01-02 14:00:23 +01:00 committed by Nic Barker
parent b4452d080c
commit 85634f63b0
2 changed files with 5 additions and 4 deletions

View File

@ -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 } })) {}
}
@ -644,6 +644,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
@ -1925,4 +1926,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.
---
---

2
clay.h
View File

@ -128,7 +128,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() \
)