Add Clay_IsDebugModeEnabled()

This makes it easier to implement keyboard shortcuts that toggle the debug
menu while also ensuring that the state does not get out of sync, like
when closing the menu via the cross in the top right corner.
This commit is contained in:
Junior Rantila 2024-12-29 22:47:00 +01:00
parent 5831a8ac7c
commit c8226075ad

6
clay.h
View File

@ -477,6 +477,7 @@ void Clay_SetMeasureTextFunction(Clay_Dimensions (*measureTextFunction)(Clay_Str
void Clay_SetQueryScrollOffsetFunction(Clay_Vector2 (*queryScrollOffsetFunction)(uint32_t elementId)); void Clay_SetQueryScrollOffsetFunction(Clay_Vector2 (*queryScrollOffsetFunction)(uint32_t elementId));
Clay_RenderCommand * Clay_RenderCommandArray_Get(Clay_RenderCommandArray* array, int32_t index); Clay_RenderCommand * Clay_RenderCommandArray_Get(Clay_RenderCommandArray* array, int32_t index);
void Clay_SetDebugModeEnabled(bool enabled); void Clay_SetDebugModeEnabled(bool enabled);
bool Clay_IsDebugModeEnabled(void);
void Clay_SetCullingEnabled(bool enabled); void Clay_SetCullingEnabled(bool enabled);
void Clay_SetMaxElementCount(uint32_t maxElementCount); void Clay_SetMaxElementCount(uint32_t maxElementCount);
void Clay_SetMaxMeasureTextCacheWordCount(uint32_t maxMeasureTextCacheWordCount); void Clay_SetMaxMeasureTextCacheWordCount(uint32_t maxMeasureTextCacheWordCount);
@ -3852,6 +3853,11 @@ void Clay_SetDebugModeEnabled(bool enabled) {
Clay__debugModeEnabled = enabled; Clay__debugModeEnabled = enabled;
} }
CLAY_WASM_EXPORT("Clay_IsDebugModeEnabled")
bool Clay_IsDebugModeEnabled(void) {
return Clay__debugModeEnabled;
}
CLAY_WASM_EXPORT("Clay_SetCullingEnabled") CLAY_WASM_EXPORT("Clay_SetCullingEnabled")
void Clay_SetCullingEnabled(bool enabled) { void Clay_SetCullingEnabled(bool enabled) {
Clay__disableCulling = !enabled; Clay__disableCulling = !enabled;