Type aliases
Every Clay type has a CC_ name, so app code never needs to spell Clay_. Use them for variables, casts and function signatures.
Each is a #define onto the Clay type, so the two spellings are interchangeable.
Example
static CC_Color accent = { 45, 108, 223, 255 };
static CC_Padding card_padding = { 16, 16, 12, 12 }; // left, right, top, bottom
static void print_box(CC_BoundingBox bb) {
printf("%.0f x %.0f at (%.0f, %.0f)\n", bb.width, bb.height, bb.x, bb.y);
}
static void inspect(void) {
CC_ElementData d = CC_ElementDataOf("Card");
if (d.found) print_box(d.boundingBox);
}
Reference
| ccompose | Clay | Used for |
|---|---|---|
CC_ElementDeclaration, CC_Decl | Clay_ElementDeclaration | Every container's fields |
CC_LayoutConfig | Clay_LayoutConfig | .layout |
CC_LayoutDirection | Clay_LayoutDirection | .layout.layoutDirection, Element |
CC_Sizing, CC_SizingAxis, CC_SizingType | Clay_Sizing, Clay_SizingAxis, Clay__SizingType | .layout.sizing |
CC_Padding | Clay_Padding | .layout.padding |
CC_ChildAlignment, CC_LayoutAlignmentX, CC_LayoutAlignmentY | Clay_ChildAlignment, … | .layout.childAlignment |
CC_CornerRadius | Clay_CornerRadius | .cornerRadius |
CC_BorderElementConfig, CC_BorderWidth | Clay_BorderElementConfig, Clay_BorderWidth | .border |
CC_TextElementConfig, CC_TextStyle | Clay_TextElementConfig | Text fields |
CC_TextElementConfigWrapMode, CC_TextAlignment | Clay_TextElementConfigWrapMode, Clay_TextAlignment | .wrapMode, .textAlignment |
CC_ImageElementConfig | Clay_ImageElementConfig | .image |
CC_FloatingElementConfig, CC_FloatingAttachToElement | Clay_FloatingElementConfig, … | .floating |
CC_ClipElementConfig | Clay_ClipElementConfig | .clip |
CC_AspectRatioElementConfig | Clay_AspectRatioElementConfig | .aspectRatio |
CC_CustomElementConfig | Clay_CustomElementConfig | .custom |
CC_TransitionElementConfig, CC_TransitionData, CC_TransitionArgs, CC_TransitionProperty, CC_TransitionState, CC_TransitionEnterTrigger, CC_TransitionExitTrigger, CC_TransitionInteraction, CC_ExitTransitionOrdering | Clay_Transition… | .transition and easing callbacks |
CC_Color | Clay_Color | {r, g, b, a} floats, 0 to 255 |
CC_String | Clay_String | {length, chars} |
CC_Dimensions | Clay_Dimensions | {width, height} |
CC_Vector2 | Clay_Vector2 | {x, y} |
CC_BoundingBox | Clay_BoundingBox | {x, y, width, height}, passed to CC_DrawFn |
CC_ElementId | Clay_ElementId | Hashed element id |
CC_ErrorData | Clay_ErrorData | Error handler argument |
CC_ElementData | Clay_ElementData | {boundingBox, found}, from CC_ElementDataOf |
CC_PointerCaptureMode | Clay_PointerCaptureMode | .floating.pointerCaptureMode |
CC_RenderCommand, CC_RenderCommandArray | Clay_RenderCommand, Clay_RenderCommandArray | What CC_End returns |
CC_RenderCommandArray_Get | Clay_RenderCommandArray_Get | Index into the array |