Added in some missing Clay macros and moved re-used config declarations out of global scope into main for video-example.c3

This commit is contained in:
Jefferey Schlueter 2025-02-04 14:49:57 -05:00
parent afe52f946b
commit c133e07096
2 changed files with 321 additions and 103 deletions

View File

@ -68,18 +68,6 @@ const Document[*] ALL_DOCUMENTS = {
uint selectedDocumentIndex = 0;
RectangleElementConfig contentBackgroundConfig = {
{ 90, 90, 90, 255 },
clay::@cornerRadiusUniCT(8)
};
Sizing layoutExpand = Sizing{ clay::sizingGrow(), clay::sizingGrow() };
LayoutConfig sidebarButtonLayout = LayoutConfig{
.sizing = { .width = clay::sizingGrow() },
.padding = clay::paddingCT(16, 16, 16, 16)
};
bool isDebugModeEnabled = false;
fn void main() @public
@ -104,6 +92,21 @@ fn void main() @public
TextureFilter.BILINEAR
);
// ==============================================
// ===== predeclarations of re-used configs =====
// ==============================================
RectangleElementConfig contentBackgroundConfig = {
{ 90, 90, 90, 255 },
clay::@cornerRadiusUniCT(8)
};
Sizing layoutExpand = Sizing{ clay::sizingGrow(), clay::sizingGrow() };
LayoutConfig sidebarButtonLayout = LayoutConfig{
.sizing = { .width = clay::sizingGrow() },
.padding = clay::paddingCT(16, 16, 16, 16)
};
while (!rl::windowShouldClose()) {
clay::setLayoutDimensions({rl::getScreenWidth(), rl::getScreenHeight()});
Vector2 mouse_position = rl::getMousePosition();

View File

@ -2,11 +2,14 @@ module clay;
import clay::carray;
// =======================
// ===== USER MACROS =====
// =======================
macro @clay(...; @body()) @builtin
{
clay::openElement();
$for (var $i = 0; $i < $vacount; $i++)
$vaexpr[$i]; // If you get an error here consisder the @body[...]() macros
$vaexpr[$i]; // If you get an error here consider the @body[...]() macros
$endfor
clay::elementPostConfiguration();
@body();
@ -15,34 +18,33 @@ macro @clay(...; @body()) @builtin
macro text(String text, TextElementConfig *config) { clay::openTextElement({text.len, text}, config); }
<*Provides you conditional calls (eg #booleanCondition ? #doA : 0) within the condifuration of @clay(...)*>
macro @bodyIf(#condition, #ifRes) { if (#condition) { #ifRes; } }
<*Provides you conditional calls (eg #booleanCondition ? #doA : #doB) within the condifuration of @clay(...)*>
macro @bodyIfElse(#condition, #ifRes, #elseRes) { if (#condition) { #ifRes; } else { #elseRes; } }
<*attaches a RectangleElementConfig to the clay element when called within @clay(...)*>
macro rectangle(RectangleElementConfig config) { clay::attachElementConfig({ .rectangleElementConfig = clay::storeRectangleElementConfig(config) }, clay::ELEMENT_CONFIG_TYPE_RECTANGLE ); }
<*attaches a LayoutConfig to the clay element when called within @clay(...)*>
macro layout(LayoutConfig config) { clay::attachLayoutConfig( clay::storeLayoutConfig(config) ); }
<*attaches a LayoutConfig to the clay element when called within @clay(...)*>
macro scroll(ScrollElementConfig config) { clay::attachElementConfig({ .scrollElementConfig = clay::storeScrollElementConfig(config) }, clay::ELEMENT_CONFIG_TYPE_SCROLL_CONTAINER ); }
<*attaches a FloatingElementConfig to the clay element when called within @clay(...)*>
macro floating(FloatingElementConfig config) { clay::attachElementConfig({ .floatingElementConfig = clay::storeFloatingElementConfig(config) }, clay::ELEMENT_CONFIG_TYPE_FLOATING_CONTAINER ); }
<*attaches a BorderElementConfig to the clay element when called within @clay(...)*>
macro @borderRadiusUni(uint #width, ClayColor #color, float #cornerRadius = 0) { clay::attachElementConfig({ .borderElementConfig = clay::storeBorderElementConfig({ .left = { #width, #color }, .right = { #width, #color }, .top = { #width, #color }, .bottom = { #width, #color }, .#cornerRadius = {#cornerRadius, #cornerRadius, #cornerRadius, #cornerRadius}})}, clay::ELEMENT_CONFIG_TYPE_BORDER_CONTAINER); }
macro borderRadiusUni(uint width, ClayColor color, float cornerRadius = 0) { clay::attachElementConfig({ .borderElementConfig = clay::storeBorderElementConfig({ .left = { width, color }, .right = { width, color }, .top = { width, color }, .bottom = { width, color }, .cornerRadius = {cornerRadius, cornerRadius, cornerRadius, cornerRadius}})}, clay::ELEMENT_CONFIG_TYPE_BORDER_CONTAINER); }
macro id(String idString) { clay::attachId(clay::hashString({idString.len, idString}, 0, 0)); }
macro idi(String idString, uint seed) { clay::attachId(clay::hashString({idString.len, idString}, 0, seed)); }
macro idLocal(String idString, uint offset) { clay::attachId(clay::hashString({idString.len, idString}, offset, 0)); }
macro idiLocal(String idString, uint offset, uint seed) { clay::attachId(clay::hashString({idString.len, idString}, offset, seed)); }
macro TextElementConfig* textConfig(TextElementConfig config) { return clay::storeTextElementConfig(config); }
macro SizingAxis sizingFit(float min = 0, float max = float.max) { return { .size.minMax = {min, max}, .type = SizingType.FIT }; }
macro SizingAxis sizingFit(float min = 0) { return { .size.minMax = {min, float.max}, .type = SizingType.FIT }; }
macro SizingAxis sizingGrow() { return { .size.minMax = {0, 0}, .type = SizingType.GROW }; }
macro SizingAxis sizingGrow(float max = 0) { return { .size.minMax = {0, max}, .type = SizingType.GROW }; }
macro SizingAxis sizingFixed(float pixels) { return { .size.minMax = {pixels, pixels}, .type = SizingType.FIXED }; }
@ -64,6 +66,9 @@ macro Padding paddingCT(ushort $a, ushort $b, ushort $c, ushort $d) { return { $
macro CornerRadius @cornerRadiusUniCT(float #uniform) { return {#uniform, #uniform, #uniform, #uniform}; }
// TODO: figure out why this isn't working
// macro ClayColor @colorHex(#hex) { return {(float)(((#hex >> 16) & 0xFF) / 255.0), (float)(((#hex >> 8) & 0xFF) / 255.0), (float)(((#hex) & 0xFF) / 255.0), 255}; }
struct ClayString
{
int length;
@ -93,7 +98,6 @@ struct ClayColor
float r, g, b, a;
}
struct ElementId
{
uint id;
@ -109,15 +113,16 @@ struct CornerRadius
float bottomLeft;
float bottomRight;
}
distinct ElementConfigType @private = char;
const ElementConfigType ELEMENT_CONFIG_TYPE_NONE @private = 0;
const ElementConfigType ELEMENT_CONFIG_TYPE_RECTANGLE @private = 1;
const ElementConfigType ELEMENT_CONFIG_TYPE_BORDER_CONTAINER @private = 2;
const ElementConfigType ELEMENT_CONFIG_TYPE_FLOATING_CONTAINER @private = 4;
const ElementConfigType ELEMENT_CONFIG_TYPE_SCROLL_CONTAINER @private = 8;
const ElementConfigType ELEMENT_CONFIG_TYPE_IMAGE @private = 16;
const ElementConfigType ELEMENT_CONFIG_TYPE_TEXT @private = 32;
const ElementConfigType ELEMENT_CONFIG_TYPE_CUSTOM @private = 64;
distinct ElementConfigType = char;
const ElementConfigType ELEMENT_CONFIG_TYPE_NONE = 0;
const ElementConfigType ELEMENT_CONFIG_TYPE_RECTANGLE = 1;
const ElementConfigType ELEMENT_CONFIG_TYPE_BORDER_CONTAINER = 2;
const ElementConfigType ELEMENT_CONFIG_TYPE_FLOATING_CONTAINER = 4;
const ElementConfigType ELEMENT_CONFIG_TYPE_SCROLL_CONTAINER = 8;
const ElementConfigType ELEMENT_CONFIG_TYPE_IMAGE = 16;
const ElementConfigType ELEMENT_CONFIG_TYPE_TEXT = 32;
const ElementConfigType ELEMENT_CONFIG_TYPE_CUSTOM = 64;
enum LayoutDirection : char @export
{
@ -196,12 +201,11 @@ struct RectangleElementConfig
{
ClayColor color;
CornerRadius cornerRadius;
// #ifdef CLAY_EXTEND_CONFIG_RECTANGLE
// CLAY_EXTEND_CONFIG_RECTANGLE
// #endif
// No C-like struct extension macros (eg. CLAY_EXTEND_CONFIG_RECTANGLE)
// TODO: C3 doesn't support conditional compilation outside of functions/methods/macros
}
enum WrapMode @export
enum WrapMode
{
WORDS,
NEWLINES,
@ -216,21 +220,19 @@ struct TextElementConfig
ushort letterSpacing;
ushort lineHeight;
WrapMode wrapMode;
// #ifdef CLAY_EXTEND_CONFIG_TEXT
// CLAY_EXTEND_CONFIG_TEXT
// #endif
// No C-like struct extension macros (eg. CLAY_EXTEND_CONFIG_TEXT)
// TODO: C3 doesn't support conditional compilation outside of functions/methods/macros
}
struct ImageElementConfig
{
void *imageData;
Dimensions sourceDimensions;
// #ifdef CLAY_EXTEND_CONFIG_IMAGE
// CLAY_EXTEND_CONFIG_IMAGE
// #endif
// No C-like struct extension macros (eg. CLAY_EXTEND_CONFIG_IMAGE)
// TODO: C3 doesn't support conditional compilation outside of functions/methods/macros
}
enum AttachPoint : char @export
enum AttachPoint : char
{
LEFT_TOP,
LEFT_CENTER,
@ -249,10 +251,10 @@ struct FloatingAttachPoints
AttachPoint parent;
}
enum PointerCaptureMode @export
enum PointerCaptureMode
{
CAPTURE,
// MODE_PASSTHROUGH,
// MODE_PASSTHROUGH, // not fully implemented in C as of bindings dev-time
PARENT,
}
@ -270,6 +272,8 @@ struct FloatingElementConfig
struct CustomElementConfig
{
void *customData;
// No C-like struct extension macros (eg. CLAY_EXTEND_CONFIG_FLOATING)
// TODO: C3 doesn't support conditional compilation outside of functions/methods/macros
}
struct ScrollElementConfig
@ -293,6 +297,8 @@ struct BorderElementConfig
Border bottom;
Border betweenChildren;
CornerRadius cornerRadius;
// No C-like struct extension macros (eg. CLAY_EXTEND_CONFIG_BORDER)
// TODO: C3 doesn't support conditional compilation outside of functions/methods/macros
}
union ElementConfigUnion
@ -341,24 +347,20 @@ def RenderCommandArray = carray::Array(<RenderCommand>);
struct ScrollContainerData
{
// Note: This is a pointer to the real internal scroll position, mutating it may cause a change in final layout.
// Intended for use with external functionality that modifies scroll position, such as scroll bars or auto scrolling.
ClayVector2 *scrollPosition;
Dimensions scrollContainerDimensions;
Dimensions contentDimensions;
ScrollElementConfig config;
// Indicates whether an actual scroll container matched the provided ID or if the default struct was returned.
bool found;
}
struct ElementData
{
ClayBoundingBox boundingBox;
// Indicates whether an actual Element matched the provided ID or if the default struct was returned.
bool found;
}
enum PointerState @export
enum PointerState
{
PRESSED_THIS_FRAME,
PRESSED,
@ -376,7 +378,7 @@ def OnHoverEvent = fn void(ElementId elementId, PointerData pointerData, iptr us
def MeasureTextFunc = fn Dimensions(ClayString *text, TextElementConfig *config);
def QueryScrollOffsetFunc = fn ClayVector2(uint elementId);
enum ErrorType @export
enum ErrorType
{
TEXT_MEASUREMENT_FUNCTION_NOT_PROVIDED,
ARENA_CAPACITY_EXCEEDED,
@ -402,69 +404,282 @@ struct ErrorHandler
uint128 userData;
}
distinct Context = void; // I'm not doing all that again
struct BooleanWarnings
{
bool maxElementsExceeded;
bool maxRenderCommandsExceeded;
bool maxTextMeasureCacheExceeded;
}
struct Warning
{
ClayString baseMessage;
ClayString dynamicMessage;
}
def WarningArray = carray::Array(<Warning>);
struct LayoutElementChildren
{
int *elements;
ushort length;
}
struct LayoutElement
{
union childrenOrTextContent {
LayoutElementChildren children;
TextElementData *textElementData;
}
Dimensions dimensions;
Dimensions minDimensions;
LayoutConfig *layoutConfig;
ElementConfigArraySlice elementConfigs;
uint configsEnabled;
uint id;
}
struct WrappedTextLine
{
Dimensions dimensions;
ClayString line;
}
struct WrappedTextLineArraySlice
{
int length;
WrappedTextLine *internalArray;
}
struct TextElementData
{
ClayString text;
Dimensions preferredDimensions;
int elementIndex;
WrappedTextLineArraySlice wrappedLines;
}
struct ElementConfigArraySlice
{
int length;
ElementConfig *internalArray;
}
def DebugElementData = bool[<2>];
struct LayoutElementHashMapItem
{
ClayBoundingBox boundingBox;
ElementId elementId;
LayoutElement* layoutElement;
OnHoverEvent onHoverFunction;
int128 hoverFunctionUserData;
int nextIndex;
uint128 generation;
DebugElementData *debugData;
}
struct LayoutElementTreeRoot
{
int layoutElementIndex;
uint parentId; // This can be zero in the case of the root layout tree
uint clipElementId; // This can be zero if there is no clip element
int zIndex;
ClayVector2 pointerOffset; // Only used when scroll containers are managed externally
}
struct LayoutElementTreeNode
{
LayoutElement *layoutElement;
ClayVector2 position;
ClayVector2 nextChildOffset;
}
struct MeasuredWord
{
int startOffset;
int length;
float width;
int next;
}
struct MeasureTextCacheItem
{
Dimensions unwrappedDimensions;
int measuredWordsStartIndex;
bool containsNewlines;
// Hash map data
uint id;
int nextIndex;
uint generation;
}
struct ScrollContainerDataInternal
{
LayoutElement *layoutElement;
ClayBoundingBox boundingBox;
Dimensions contentSize;
ClayVector2 scrollOrigin;
ClayVector2 pointerOrigin;
ClayVector2 scrollMomentum;
ClayVector2 scrollPosition;
ClayVector2 previousDelta;
float momentumTime;
uint elementId;
bool openThisFrame;
bool pointerScrollActive;
}
def LayoutElementArray = carray::Array(<LayoutElement>) ;
def IntArray = carray::Array(<int>) ;
def TextElementDataArray = carray::Array(<TextElementData>) ;
def RectangleElementConfigArray = carray::Array(<RectangleElementConfig>) ;
def TextElementConfigArray = carray::Array(<TextElementConfig>) ;
def ImageElementConfigArray = carray::Array(<ImageElementConfig>) ;
def FloatingElementConfigArray = carray::Array(<FloatingElementConfig>) ;
def ScrollElementConfigArray = carray::Array(<ScrollElementConfig>) ;
def CustomElementConfigArray = carray::Array(<CustomElementConfig>) ;
def BorderElementConfigArray = carray::Array(<BorderElementConfig>) ;
def LayoutElementPointerArray = carray::Array(<LayoutElement*>) ;
def LayoutConfigArray = carray::Array(<LayoutConfig>) ;
def ElementConfigArray = carray::Array(<ElementConfig>) ;
def WrappedTextLineArray = carray::Array(<WrappedTextLine>) ;
def LayoutElementTreeNodeArray = carray::Array(<LayoutElementTreeNode>) ;
def LayoutElementTreeRootArray = carray::Array(<LayoutElementTreeRoot>) ;
def LayoutElementHashMapItemArray = carray::Array(<LayoutElementHashMapItem>) ;
def MeasureTextCacheItemArray = carray::Array(<MeasureTextCacheItem>) ;
def MeasuredWordArray = carray::Array(<MeasuredWord>) ;
def ElementIdArray = carray::Array(<ElementId>) ;
def ScrollContainerDataInternalArray = carray::Array(<ScrollContainerDataInternal>) ;
def BoolArray = carray::Array(<bool>) ;
def CharArray = carray::Array(<char>) ;
def DebugElementDataArray = carray::Array(<DebugElementData>) ;
// TODO: find out why alignment is off, accessing from Context doesn't really work
struct Context
{
int maxElementCount;
int maxMeasureTextCacheWordCount;
bool warningsEnabled;
ErrorHandler errorHandler;
BooleanWarnings booleanWarnings;
WarningArray warnings;
PointerData pointerInfo;
Dimensions layoutDimensions;
ElementId dynamicElementIndexBaseHash;
uint dynamicElementIndex;
bool debugModeEnabled;
bool disableCulling;
bool externalScrollHandlingEnabled;
uint debugSelectedElementId;
uint generation;
uint128 arenaResetOffset;
Arena internalArena;
// Layout Elements / Render Commands
LayoutElementArray layoutElements;
RenderCommandArray renderCommands;
IntArray openLayoutElementStack;
IntArray layoutElementChildren;
IntArray layoutElementChildrenBuffer;
TextElementDataArray textElementData;
LayoutElementPointerArray imageElementPointers;
IntArray reusableElementIndexBuffer;
IntArray layoutElementClipElementIds;
// Configs
LayoutConfigArray layoutConfigs;
ElementConfigArray elementConfigBuffer;
ElementConfigArray elementConfigs;
RectangleElementConfigArray rectangleElementConfigs;
TextElementConfigArray textElementConfigs;
ImageElementConfigArray imageElementConfigs;
FloatingElementConfigArray floatingElementConfigs;
ScrollElementConfigArray scrollElementConfigs;
CustomElementConfigArray customElementConfigs;
BorderElementConfigArray borderElementConfigs;
// Misc Data Structures
ClayStringArray layoutElementIdStrings;
WrappedTextLineArray wrappedTextLines;
LayoutElementTreeNodeArray layoutElementTreeNodeArray1;
LayoutElementTreeRootArray layoutElementTreeRoots;
LayoutElementHashMapItemArray layoutElementsHashMapInternal;
IntArray layoutElementsHashMap;
MeasureTextCacheItemArray measureTextHashMapInternal;
IntArray measureTextHashMapInternalFreeList;
IntArray measureTextHashMap;
MeasuredWordArray measuredWords;
IntArray measuredWordsFreeList;
IntArray openClipElementStack;
ElementIdArray pointerOverIds;
ScrollContainerDataInternalArray scrollContainerDatas;
BoolArray treeNodeVisited;
CharArray dynamicStringData;
DebugElementDataArray debugElementData;
}
// =====================
// ===== FUNCTIONS =====
// =====================
// ===== Public Clay API C3 Functions (String replacement) ===== // TODO @export and @wasm can be ignored rn
// I haven't been able to get c3c and c compilations to work together for wasm32 or a c3 library
fn ElementId getElementIdWithIndex(String idString, uint index) @export @inline
// ===== Public Clay API C3 Functions (String replacement) =====
fn ElementId getElementIdWithIndex(String idString, uint index) @inline
{ return __getElementIdWithIndex({idString.len, idString}, (uint)index); }
fn ElementId getElementId(String idString) @export @inline
fn ElementId getElementId(String idString) @inline
{ return __getElementId({idString.len, idString}); }
// ===== Public Clay API Functions =====
extern fn uint minMemorySize() @extern("Clay_MinMemorySize") @wasm @export;
extern fn Arena createArena(uint capacity, void* offset) @extern("Clay_CreateArenaWithCapacityAndMemory") @wasm @export;
extern fn void setPointerState(ClayVector2 position, bool pointerDown) @extern("Clay_SetPointerState") @export;
extern fn Context* initialize(Arena arena, Dimensions layoutDimensions, ErrorHandler errorHandler) @extern("Clay_Initialize") @wasm @export;
extern fn Context* getCurrentContext() @extern("Clay_GetCurrentContext") @export;
extern fn void setCurrentContext(Context* context) @extern("Clay_SetCurrentContext") @export;
extern fn void updateScrollContainer(bool enableDragScrolling, ClayVector2 scrollDelta, float deltaTime) @extern("Clay_UpdateScrollContainers") @export;
extern fn void setLayoutDimensions (Dimensions dimensions) @extern("Clay_SetLayoutDimensions") @export;
extern fn ElementData getElementData(ElementId id) @extern("Clay_GetElementData") @export;
extern fn bool hovered() @extern("Clay_Hovered") @export;
extern fn void onHover(OnHoverEvent onHover, iptr userData) @extern("Clay_OnHover") @export;
extern fn bool pointerOver(ElementId elementId) @extern("Clay_PointerOver") @wasm @export;
extern fn ScrollContainerData getScrollContainerData(ElementId id) @extern("Clay_GetScrollContainerData") @export;
extern fn void setMeasureTextFunction(MeasureTextFunc measureText) @extern("Clay_SetMeasureTextFunction") @export;
extern fn void setQueryScrollOffsetFunction(QueryScrollOffsetFunc queryScrollOffset) @extern("Clay_SetQueryScrollOffsetFunction") @export;
extern fn RenderCommand * RenderCommandArray.get(RenderCommandArray* array, int index) @extern("Clay_RenderCommandArray_Get") @export;
extern fn void setDebugModeEnabled(bool enabled) @extern("Clay_SetDebugModeEnabled") @export;
extern fn bool isDebugModeEnabled() @extern("Clay_IsDebugModeEnabled") @export;
extern fn void setCullingEnabled(bool enabled) @extern("Clay_SetCullingEnabled") @export;
extern fn int getMaxMeasuredTextCachedWordCount() @extern("Clay_GetMaxElementCount") @export;
extern fn void setMaxElementCount(int maxElementCount) @extern("Clay_SetMaxElementCount") @export;
extern fn int getMaxElementCount() @extern("Clay_GetMaxMeasureTextCacheWordCount") @export;
extern fn void setMaxMeasureTextCacheWordCount(int maxMeasureTextCacheWordCount) @extern("Clay_SetMaxMeasureTextCacheWordCount") @export;
extern fn void resetMeasureTextCache() @extern("Clay_ResetMeasureTextCache") @export;
extern fn void beginLayout() @extern("Clay_BeginLayout") @export;
extern fn RenderCommandArray endLayout() @extern("Clay_EndLayout") @export;
// ===== Public Clay API Functions ===== // TODO: worry about exports/ static library creation later
extern fn uint minMemorySize() @extern("Clay_MinMemorySize") ; // @export;
extern fn Arena createArena(uint capacity, void* offset) @extern("Clay_CreateArenaWithCapacityAndMemory") ; // @export;
extern fn void setPointerState(ClayVector2 position, bool pointerDown) @extern("Clay_SetPointerState") ; // @export;
extern fn Context* initialize(Arena arena, Dimensions layoutDimensions, ErrorHandler errorHandler) @extern("Clay_Initialize") ; // @export;
extern fn Context* getCurrentContext() @extern("Clay_GetCurrentContext") ; // @export;
extern fn void setCurrentContext(Context* context) @extern("Clay_SetCurrentContext") ; // @export;
extern fn void updateScrollContainer(bool enableDragScrolling, ClayVector2 scrollDelta, float deltaTime) @extern("Clay_UpdateScrollContainers") ; // @export;
extern fn void setLayoutDimensions (Dimensions dimensions) @extern("Clay_SetLayoutDimensions") ; // @export;
extern fn ElementData getElementData(ElementId id) @extern("Clay_GetElementData") ; // @export;
extern fn bool hovered() @extern("Clay_Hovered") ; // @export;
extern fn void onHover(OnHoverEvent onHover, iptr userData) @extern("Clay_OnHover") ; // @export;
extern fn bool pointerOver(ElementId elementId) @extern("Clay_PointerOver") ; // @export;
extern fn ScrollContainerData getScrollContainerData(ElementId id) @extern("Clay_GetScrollContainerData") ; // @export;
extern fn void setMeasureTextFunction(MeasureTextFunc measureText) @extern("Clay_SetMeasureTextFunction") ; // @export;
extern fn void setQueryScrollOffsetFunction(QueryScrollOffsetFunc queryScrollOffset) @extern("Clay_SetQueryScrollOffsetFunction") ; // @export;
extern fn RenderCommand * RenderCommandArray.get(RenderCommandArray* array, int index) @extern("Clay_RenderCommandArray_Get") ; // @export;
extern fn void setDebugModeEnabled(bool enabled) @extern("Clay_SetDebugModeEnabled") ; // @export;
extern fn bool isDebugModeEnabled() @extern("Clay_IsDebugModeEnabled") ; // @export;
extern fn void setCullingEnabled(bool enabled) @extern("Clay_SetCullingEnabled") ; // @export;
extern fn int getMaxMeasuredTextCachedWordCount() @extern("Clay_GetMaxElementCount") ; // @export;
extern fn void setMaxElementCount(int maxElementCount) @extern("Clay_SetMaxElementCount") ; // @export;
extern fn int getMaxElementCount() @extern("Clay_GetMaxMeasureTextCacheWordCount") ; // @export;
extern fn void setMaxMeasureTextCacheWordCount(int maxMeasureTextCacheWordCount) @extern("Clay_SetMaxMeasureTextCacheWordCount") ; // @export;
extern fn void resetMeasureTextCache() @extern("Clay_ResetMeasureTextCache") ; // @export;
extern fn void beginLayout() @extern("Clay_BeginLayout") ; // @export;
extern fn RenderCommandArray endLayout() @extern("Clay_EndLayout") ; // @export;
// ===== (NEW) Internal Clay API Functions (String replacement) =====
extern fn ElementId __getElementIdWithIndex(ClayString idString, uint index) @extern("Clay_GetElementIdWithIndex") @export @private;
extern fn ElementId __getElementId(ClayString idString) @extern("Clay_GetElementId") @export @private;
extern fn ElementId __getElementIdWithIndex(ClayString idString, uint index) @extern("Clay_GetElementIdWithIndex") ; // @export;
extern fn ElementId __getElementId(ClayString idString) @extern("Clay_GetElementId") ; // @export;
// ===== Internal Clay API Functions =====
extern fn void openElement() @extern ("Clay__OpenElement") @export @private;
extern fn void closeElement() @extern("Clay__CloseElement") @export @private;
extern fn void openTextElement(ClayString text, TextElementConfig *textConfig) @extern("Clay__OpenTextElement") @export @private;
extern fn void elementPostConfiguration() @extern("Clay__ElementPostConfiguration") @export @private;
extern fn LayoutConfig * storeLayoutConfig(LayoutConfig config) @extern("Clay__StoreLayoutConfig") @export @private;
extern fn void attachId(ElementId id) @extern("Clay__AttachId") @export @private;
extern fn void attachLayoutConfig(LayoutConfig *config) @extern("Clay__AttachLayoutConfig") @export @private;
extern fn void attachElementConfig(ElementConfigUnion config, ElementConfigType type) @extern("Clay__AttachElementConfig") @export @private;
extern fn RectangleElementConfig * storeRectangleElementConfig(RectangleElementConfig config) @extern("Clay__StoreRectangleElementConfig") @export @private;
extern fn TextElementConfig * storeTextElementConfig(TextElementConfig config) @extern("Clay__StoreTextElementConfig") @export @private;
extern fn ImageElementConfig * storeImageElementConfig(ImageElementConfig config) @extern("Clay__StoreImageElementConfig") @export @private;
extern fn FloatingElementConfig * storeFloatingElementConfig(FloatingElementConfig config) @extern("Clay__StoreFloatingElementConfig") @export @private;
extern fn CustomElementConfig * storeCustomElementConfig(CustomElementConfig config) @extern("Clay__StoreCustomElementConfig") @export @private;
extern fn ScrollElementConfig * storeScrollElementConfig(ScrollElementConfig config) @extern("Clay__StoreScrollElementConfig") @export @private;
extern fn BorderElementConfig * storeBorderElementConfig(BorderElementConfig config) @extern("Clay__StoreBorderElementConfig") @export @private;
extern fn ElementId hashString(ClayString key, uint offset, uint seed) @extern("Clay__HashString") @export @private;
extern fn uint getParentElementId() @extern("Clay__GetParentElementId") @export @private;
extern fn void openElement() @extern ("Clay__OpenElement") ; // @export;
extern fn void closeElement() @extern("Clay__CloseElement") ; // @export;
extern fn void openTextElement(ClayString text, TextElementConfig *textConfig) @extern("Clay__OpenTextElement") ; // @export;
extern fn void elementPostConfiguration() @extern("Clay__ElementPostConfiguration") ; // @export;
extern fn LayoutConfig * storeLayoutConfig(LayoutConfig config) @extern("Clay__StoreLayoutConfig") ; // @export;
extern fn void attachId(ElementId id) @extern("Clay__AttachId") ; // @export;
extern fn void attachLayoutConfig(LayoutConfig *config) @extern("Clay__AttachLayoutConfig") ; // @export;
extern fn void attachElementConfig(ElementConfigUnion config, ElementConfigType type) @extern("Clay__AttachElementConfig") ; // @export;
extern fn RectangleElementConfig * storeRectangleElementConfig(RectangleElementConfig config) @extern("Clay__StoreRectangleElementConfig") ; // @export;
extern fn TextElementConfig * storeTextElementConfig(TextElementConfig config) @extern("Clay__StoreTextElementConfig") ; // @export;
extern fn ImageElementConfig * storeImageElementConfig(ImageElementConfig config) @extern("Clay__StoreImageElementConfig") ; // @export;
extern fn FloatingElementConfig * storeFloatingElementConfig(FloatingElementConfig config) @extern("Clay__StoreFloatingElementConfig") ; // @export;
extern fn CustomElementConfig * storeCustomElementConfig(CustomElementConfig config) @extern("Clay__StoreCustomElementConfig") ; // @export;
extern fn ScrollElementConfig * storeScrollElementConfig(ScrollElementConfig config) @extern("Clay__StoreScrollElementConfig") ; // @export;
extern fn BorderElementConfig * storeBorderElementConfig(BorderElementConfig config) @extern("Clay__StoreBorderElementConfig") ; // @export;
extern fn ElementId hashString(ClayString key, uint offset, uint seed) @extern("Clay__HashString") ; // @export;
extern fn uint getParentElementId() @extern("Clay__GetParentElementId") ; // @export;
// ==========================================================================
// ===== An internal module for wrapping Struct Array's defined in Clay =====