Death to C++
This commit is contained in:
25
vendor/clay/clay.h
vendored
25
vendor/clay/clay.h
vendored
@@ -154,14 +154,7 @@ static inline void Clay__SuppressUnusedLatchDefinitionVariableWarning(void) { (v
|
||||
// CLAY(declarationStruct);
|
||||
#define CLAY__WRAPPER_TYPE(type) Clay__##type##Wrapper
|
||||
#define CLAY__WRAPPER_STRUCT(type) typedef struct { type wrapped; } CLAY__WRAPPER_TYPE(type)
|
||||
|
||||
// In C++, bypass the wrapper struct - MSVC doesn't support designated initializers
|
||||
// in function-style casts through wrapper structs. Direct construction works fine.
|
||||
#ifdef __cplusplus
|
||||
#define CLAY__CONFIG_WRAPPER(type, ...) (CLAY__INIT(type) { __VA_ARGS__ })
|
||||
#else
|
||||
#define CLAY__CONFIG_WRAPPER(type, ...) (CLAY__INIT(CLAY__WRAPPER_TYPE(type)) { __VA_ARGS__ }).wrapped
|
||||
#endif
|
||||
|
||||
#define CLAY_TEXT(text, textConfig) Clay__OpenTextElement(text, textConfig)
|
||||
|
||||
@@ -3152,14 +3145,6 @@ CLAY_DLL_EXPORT Clay_ElementIdArray Clay_GetPointerOverIds(void) {
|
||||
return Clay_GetCurrentContext()->pointerOverIds;
|
||||
}
|
||||
|
||||
// MSVC C++ cannot compile the debug view because it uses CLAY() macros with
|
||||
// designated initializers in function-style casts. Stub it out in C++ mode.
|
||||
#ifdef __cplusplus
|
||||
void Clay__RenderDebugViewElementConfigHeader(Clay_String elementId, Clay__ElementConfigType type) { (void)elementId; (void)type; }
|
||||
void Clay__RenderDebugViewColor(Clay_Color color, Clay_TextElementConfig *textConfig) { (void)color; (void)textConfig; }
|
||||
void Clay__RenderDebugViewCornerRadius(Clay_CornerRadius cornerRadius, Clay_TextElementConfig *textConfig) { (void)cornerRadius; (void)textConfig; }
|
||||
void Clay__RenderDebugView(void) {}
|
||||
#else
|
||||
#pragma region DebugTools
|
||||
Clay_Color CLAY__DEBUGVIEW_COLOR_1 = {58, 56, 52, 255};
|
||||
Clay_Color CLAY__DEBUGVIEW_COLOR_2 = {62, 60, 58, 255};
|
||||
@@ -3387,6 +3372,12 @@ void Clay__RenderDebugLayoutSizing(Clay_SizingAxis sizing, Clay_TextElementConfi
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CLAY_DISABLE_DEBUG_VIEW
|
||||
void Clay__RenderDebugViewElementConfigHeader(Clay_String elementId, Clay__ElementConfigType type) { (void)elementId; (void)type; }
|
||||
void Clay__RenderDebugViewColor(Clay_Color color, Clay_TextElementConfig *textConfig) { (void)color; (void)textConfig; }
|
||||
void Clay__RenderDebugViewCornerRadius(Clay_CornerRadius cornerRadius, Clay_TextElementConfig *textConfig) { (void)cornerRadius; (void)textConfig; }
|
||||
void Clay__RenderDebugView(void) {}
|
||||
#else
|
||||
void Clay__RenderDebugViewElementConfigHeader(Clay_String elementId, Clay__ElementConfigType type) {
|
||||
Clay__DebugElementConfigTypeLabelConfig config = Clay__DebugGetElementConfigTypeLabel(type);
|
||||
Clay_Color backgroundColor = config.color;
|
||||
@@ -3857,7 +3848,7 @@ void Clay__RenderDebugView(void) {
|
||||
}
|
||||
}
|
||||
#pragma endregion
|
||||
#endif // __cplusplus (debug view)
|
||||
#endif // CLAY_DISABLE_DEBUG_VIEW
|
||||
|
||||
uint32_t Clay__debugViewWidth = 400;
|
||||
Clay_Color Clay__debugViewHighlightColor = { 168, 66, 28, 100 };
|
||||
@@ -4434,7 +4425,7 @@ void Clay_ResetMeasureTextCache(void) {
|
||||
context->measureTextHashMap.length = 0;
|
||||
context->measuredWords.length = 0;
|
||||
context->measuredWordsFreeList.length = 0;
|
||||
|
||||
|
||||
for (int32_t i = 0; i < context->measureTextHashMap.capacity; ++i) {
|
||||
context->measureTextHashMap.internalArray[i] = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user