mirror of
https://github.com/nicbarker/clay.git
synced 2025-09-18 04:26:18 +00:00
Compare commits
8 commits
faa388b3e0
...
a577895910
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a577895910 | ||
![]() |
37675089e3 | ||
![]() |
1cbc56cbf2 | ||
![]() |
2388d06726 | ||
![]() |
b284305e12 | ||
![]() |
80e28e7088 | ||
![]() |
55453f8e45 | ||
![]() |
a6cf58c74c |
|
@ -1,13 +1,13 @@
|
||||||
cp ../../clay.h clay.c;
|
cp ../../clay.h clay.c;
|
||||||
# Intel Mac
|
# Intel Mac
|
||||||
clang -c -DCLAY_IMPLEMENTATION -o clay.o -ffreestanding -static -target x86_64-apple-darwin clay.c -fPIC -O3 && ar r clay-odin/macos/clay.a clay.o;
|
rm -f clay-odin/macos/clay.a && clang -c -DCLAY_IMPLEMENTATION -o clay.o -ffreestanding -static -target x86_64-apple-darwin clay.c -fPIC -O3 && ar r clay-odin/macos/clay.a clay.o;
|
||||||
# ARM Mac
|
# ARM Mac
|
||||||
clang -c -DCLAY_IMPLEMENTATION -g -o clay.o -static clay.c -fPIC -O3 && ar r clay-odin/macos-arm64/clay.a clay.o;
|
rm -f clay-odin/macos-arm64/clay.a && clang -c -DCLAY_IMPLEMENTATION -g -o clay.o -static clay.c -fPIC -O3 && ar r clay-odin/macos-arm64/clay.a clay.o;
|
||||||
# x64 Windows
|
# x64 Windows
|
||||||
clang -c -DCLAY_IMPLEMENTATION -o clay-odin/windows/clay.lib -ffreestanding -target x86_64-pc-windows-msvc -fuse-ld=llvm-lib -static -O3 clay.c;
|
rm -f clay-odin/windows/clay.lib && clang -c -DCLAY_IMPLEMENTATION -o clay-odin/windows/clay.lib -ffreestanding -target x86_64-pc-windows-msvc -fuse-ld=llvm-lib -static -O3 clay.c;
|
||||||
# Linux
|
# Linux
|
||||||
clang -c -DCLAY_IMPLEMENTATION -o clay.o -ffreestanding -static -target x86_64-unknown-linux-gnu clay.c -fPIC -O3 && ar r clay-odin/linux/clay.a clay.o;
|
rm -f clay-odin/linux/clay.a && clang -c -DCLAY_IMPLEMENTATION -o clay.o -ffreestanding -static -target x86_64-unknown-linux-gnu clay.c -fPIC -O3 && ar r clay-odin/linux/clay.a clay.o;
|
||||||
# WASM
|
# WASM
|
||||||
clang -c -DCLAY_IMPLEMENTATION -o clay-odin/wasm/clay.o -target wasm32 -nostdlib -static -O3 clay.c;
|
rm -f clay-odin/wasm/clay.o && clang -c -DCLAY_IMPLEMENTATION -o clay-odin/wasm/clay.o -target wasm32 -nostdlib -static -O3 clay.c;
|
||||||
rm clay.o;
|
rm clay.o;
|
||||||
rm clay.c;
|
rm clay.c;
|
||||||
|
|
|
@ -338,7 +338,6 @@ ClayArray :: struct($type: typeid) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ElementDeclaration :: struct {
|
ElementDeclaration :: struct {
|
||||||
id: ElementId,
|
|
||||||
layout: LayoutConfig,
|
layout: LayoutConfig,
|
||||||
backgroundColor: Color,
|
backgroundColor: Color,
|
||||||
cornerRadius: CornerRadius,
|
cornerRadius: CornerRadius,
|
||||||
|
@ -378,6 +377,7 @@ Context :: struct {} // opaque structure, only use as a pointer
|
||||||
@(link_prefix = "Clay_", default_calling_convention = "c")
|
@(link_prefix = "Clay_", default_calling_convention = "c")
|
||||||
foreign Clay {
|
foreign Clay {
|
||||||
_OpenElement :: proc() ---
|
_OpenElement :: proc() ---
|
||||||
|
_OpenElementWithId :: proc(id: ElementId) ---
|
||||||
_CloseElement :: proc() ---
|
_CloseElement :: proc() ---
|
||||||
MinMemorySize :: proc() -> u32 ---
|
MinMemorySize :: proc() -> u32 ---
|
||||||
CreateArenaWithCapacityAndMemory :: proc(capacity: c.size_t, offset: [^]u8) -> Arena ---
|
CreateArenaWithCapacityAndMemory :: proc(capacity: c.size_t, offset: [^]u8) -> Arena ---
|
||||||
|
@ -426,11 +426,19 @@ ConfigureOpenElement :: proc(config: ElementDeclaration) -> bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
@(deferred_none = _CloseElement)
|
@(deferred_none = _CloseElement)
|
||||||
UI :: proc() -> proc (config: ElementDeclaration) -> bool {
|
UI_WithId :: proc(id: ElementId) -> proc (config: ElementDeclaration) -> bool {
|
||||||
|
_OpenElementWithId(id)
|
||||||
|
return ConfigureOpenElement
|
||||||
|
}
|
||||||
|
|
||||||
|
@(deferred_none = _CloseElement)
|
||||||
|
UI_AutoId :: proc() -> proc (config: ElementDeclaration) -> bool {
|
||||||
_OpenElement()
|
_OpenElement()
|
||||||
return ConfigureOpenElement
|
return ConfigureOpenElement
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UI :: proc{UI_WithId, UI_AutoId};
|
||||||
|
|
||||||
Text :: proc($text: string, config: ^TextElementConfig) {
|
Text :: proc($text: string, config: ^TextElementConfig) {
|
||||||
wrapped := MakeString(text)
|
wrapped := MakeString(text)
|
||||||
wrapped.isStaticallyAllocated = true
|
wrapped.isStaticallyAllocated = true
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -63,14 +63,12 @@ border2pxRed := clay.BorderElementConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
LandingPageBlob :: proc(index: u32, fontSize: u16, fontId: u16, color: clay.Color, $text: string, image: ^raylib.Texture2D) {
|
LandingPageBlob :: proc(index: u32, fontSize: u16, fontId: u16, color: clay.Color, $text: string, image: ^raylib.Texture2D) {
|
||||||
if clay.UI()({
|
if clay.UI(clay.ID("HeroBlob", index))({
|
||||||
id = clay.ID("HeroBlob", index),
|
|
||||||
layout = { sizing = { width = clay.SizingGrow({ max = 480 }) }, padding = clay.PaddingAll(16), childGap = 16, childAlignment = clay.ChildAlignment{ y = .Center } },
|
layout = { sizing = { width = clay.SizingGrow({ max = 480 }) }, padding = clay.PaddingAll(16), childGap = 16, childAlignment = clay.ChildAlignment{ y = .Center } },
|
||||||
border = border2pxRed,
|
border = border2pxRed,
|
||||||
cornerRadius = clay.CornerRadiusAll(10)
|
cornerRadius = clay.CornerRadiusAll(10)
|
||||||
}) {
|
}) {
|
||||||
if clay.UI()({
|
if clay.UI(clay.ID("CheckImage", index))({
|
||||||
id = clay.ID("CheckImage", index),
|
|
||||||
layout = { sizing = { width = clay.SizingFixed(32) } },
|
layout = { sizing = { width = clay.SizingFixed(32) } },
|
||||||
aspectRatio = { 1.0 },
|
aspectRatio = { 1.0 },
|
||||||
image = { imageData = image },
|
image = { imageData = image },
|
||||||
|
@ -80,16 +78,14 @@ LandingPageBlob :: proc(index: u32, fontSize: u16, fontId: u16, color: clay.Colo
|
||||||
}
|
}
|
||||||
|
|
||||||
LandingPageDesktop :: proc() {
|
LandingPageDesktop :: proc() {
|
||||||
if clay.UI()({
|
if clay.UI(clay.ID("LandingPage1Desktop"))({
|
||||||
id = clay.ID("LandingPage1Desktop"),
|
|
||||||
layout = { sizing = { width = clay.SizingGrow(), height = clay.SizingFit({ min = cast(f32)windowHeight - 70 }) }, childAlignment = { y = .Center }, padding = { left = 50, right = 50 } },
|
layout = { sizing = { width = clay.SizingGrow(), height = clay.SizingFit({ min = cast(f32)windowHeight - 70 }) }, childAlignment = { y = .Center }, padding = { left = 50, right = 50 } },
|
||||||
}) {
|
}) {
|
||||||
if clay.UI()({
|
if clay.UI(clay.ID("LandingPage1"))({
|
||||||
id = clay.ID("LandingPage1"),
|
|
||||||
layout = { sizing = { clay.SizingGrow(), clay.SizingGrow() }, childAlignment = { y = .Center }, padding = clay.PaddingAll(32), childGap = 32 },
|
layout = { sizing = { clay.SizingGrow(), clay.SizingGrow() }, childAlignment = { y = .Center }, padding = clay.PaddingAll(32), childGap = 32 },
|
||||||
border = { COLOR_RED, { left = 2, right = 2 } },
|
border = { COLOR_RED, { left = 2, right = 2 } },
|
||||||
}) {
|
}) {
|
||||||
if clay.UI()({ id = clay.ID("LeftText"), layout = { sizing = { width = clay.SizingPercent(0.55) }, layoutDirection = .TopToBottom, childGap = 8 } }) {
|
if clay.UI(clay.ID("LeftText"))({ layout = { sizing = { width = clay.SizingPercent(0.55) }, layoutDirection = .TopToBottom, childGap = 8 } }) {
|
||||||
clay.Text(
|
clay.Text(
|
||||||
"Clay is a flex-box style UI auto layout library in C, with declarative syntax and microsecond performance.",
|
"Clay is a flex-box style UI auto layout library in C, with declarative syntax and microsecond performance.",
|
||||||
clay.TextConfig({fontSize = 56, fontId = FONT_ID_TITLE_56, textColor = COLOR_RED}),
|
clay.TextConfig({fontSize = 56, fontId = FONT_ID_TITLE_56, textColor = COLOR_RED}),
|
||||||
|
@ -100,8 +96,7 @@ LandingPageDesktop :: proc() {
|
||||||
clay.TextConfig({fontSize = 36, fontId = FONT_ID_TITLE_36, textColor = COLOR_ORANGE}),
|
clay.TextConfig({fontSize = 36, fontId = FONT_ID_TITLE_36, textColor = COLOR_ORANGE}),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if clay.UI()({
|
if clay.UI(clay.ID("HeroImageOuter"))({
|
||||||
id = clay.ID("HeroImageOuter"),
|
|
||||||
layout = { layoutDirection = .TopToBottom, sizing = { width = clay.SizingPercent(0.45) }, childAlignment = { x = .Center }, childGap = 16 },
|
layout = { layoutDirection = .TopToBottom, sizing = { width = clay.SizingPercent(0.45) }, childAlignment = { x = .Center }, childGap = 16 },
|
||||||
}) {
|
}) {
|
||||||
LandingPageBlob(1, 30, FONT_ID_BODY_30, COLOR_BLOB_BORDER_5, "High performance", &checkImage5)
|
LandingPageBlob(1, 30, FONT_ID_BODY_30, COLOR_BLOB_BORDER_5, "High performance", &checkImage5)
|
||||||
|
@ -115,8 +110,7 @@ LandingPageDesktop :: proc() {
|
||||||
}
|
}
|
||||||
|
|
||||||
LandingPageMobile :: proc() {
|
LandingPageMobile :: proc() {
|
||||||
if clay.UI()({
|
if clay.UI(clay.ID("LandingPage1Mobile"))({
|
||||||
id = clay.ID("LandingPage1Mobile"),
|
|
||||||
layout = {
|
layout = {
|
||||||
layoutDirection = .TopToBottom,
|
layoutDirection = .TopToBottom,
|
||||||
sizing = { width = clay.SizingGrow(), height = clay.SizingFit({ min = cast(f32)windowHeight - 70 }) },
|
sizing = { width = clay.SizingGrow(), height = clay.SizingFit({ min = cast(f32)windowHeight - 70 }) },
|
||||||
|
@ -125,7 +119,7 @@ LandingPageMobile :: proc() {
|
||||||
childGap = 32,
|
childGap = 32,
|
||||||
},
|
},
|
||||||
}) {
|
}) {
|
||||||
if clay.UI()({ id = clay.ID("LeftText"), layout = { sizing = { width = clay.SizingGrow() }, layoutDirection = .TopToBottom, childGap = 8 } }) {
|
if clay.UI(clay.ID("LeftText"))({ layout = { sizing = { width = clay.SizingGrow() }, layoutDirection = .TopToBottom, childGap = 8 } }) {
|
||||||
clay.Text(
|
clay.Text(
|
||||||
"Clay is a flex-box style UI auto layout library in C, with declarative syntax and microsecond performance.",
|
"Clay is a flex-box style UI auto layout library in C, with declarative syntax and microsecond performance.",
|
||||||
clay.TextConfig({fontSize = 48, fontId = FONT_ID_TITLE_48, textColor = COLOR_RED}),
|
clay.TextConfig({fontSize = 48, fontId = FONT_ID_TITLE_48, textColor = COLOR_RED}),
|
||||||
|
@ -136,8 +130,7 @@ LandingPageMobile :: proc() {
|
||||||
clay.TextConfig({fontSize = 32, fontId = FONT_ID_TITLE_32, textColor = COLOR_ORANGE}),
|
clay.TextConfig({fontSize = 32, fontId = FONT_ID_TITLE_32, textColor = COLOR_ORANGE}),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if clay.UI()({
|
if clay.UI(clay.ID("HeroImageOuter"))({
|
||||||
id = clay.ID("HeroImageOuter"),
|
|
||||||
layout = { layoutDirection = .TopToBottom, sizing = { width = clay.SizingGrow() }, childAlignment = { x = .Center }, childGap = 16 },
|
layout = { layoutDirection = .TopToBottom, sizing = { width = clay.SizingGrow() }, childAlignment = { x = .Center }, childGap = 16 },
|
||||||
}) {
|
}) {
|
||||||
LandingPageBlob(1, 24, FONT_ID_BODY_24, COLOR_BLOB_BORDER_5, "High performance", &checkImage5)
|
LandingPageBlob(1, 24, FONT_ID_BODY_24, COLOR_BLOB_BORDER_5, "High performance", &checkImage5)
|
||||||
|
@ -151,18 +144,16 @@ LandingPageMobile :: proc() {
|
||||||
|
|
||||||
FeatureBlocks :: proc(widthSizing: clay.SizingAxis, outerPadding: u16) {
|
FeatureBlocks :: proc(widthSizing: clay.SizingAxis, outerPadding: u16) {
|
||||||
textConfig := clay.TextConfig({fontSize = 24, fontId = FONT_ID_BODY_24, textColor = COLOR_RED})
|
textConfig := clay.TextConfig({fontSize = 24, fontId = FONT_ID_BODY_24, textColor = COLOR_RED})
|
||||||
if clay.UI()({
|
if clay.UI(clay.ID("HFileBoxOuter"))({
|
||||||
id = clay.ID("HFileBoxOuter"),
|
|
||||||
layout = { layoutDirection = .TopToBottom, sizing = { width = widthSizing }, childAlignment = { y = .Center }, padding = { outerPadding, outerPadding, 32, 32 }, childGap = 8 },
|
layout = { layoutDirection = .TopToBottom, sizing = { width = widthSizing }, childAlignment = { y = .Center }, padding = { outerPadding, outerPadding, 32, 32 }, childGap = 8 },
|
||||||
}) {
|
}) {
|
||||||
if clay.UI()({ id = clay.ID("HFileIncludeOuter"), layout = { padding = { 8, 8, 4, 4 } }, backgroundColor = COLOR_RED, cornerRadius = clay.CornerRadiusAll(8) }) {
|
if clay.UI(clay.ID("HFileIncludeOuter"))({ layout = { padding = { 8, 8, 4, 4 } }, backgroundColor = COLOR_RED, cornerRadius = clay.CornerRadiusAll(8) }) {
|
||||||
clay.Text("#include clay.h", clay.TextConfig({fontSize = 24, fontId = FONT_ID_BODY_24, textColor = COLOR_LIGHT}))
|
clay.Text("#include clay.h", clay.TextConfig({fontSize = 24, fontId = FONT_ID_BODY_24, textColor = COLOR_LIGHT}))
|
||||||
}
|
}
|
||||||
clay.Text("~2000 lines of C99.", textConfig)
|
clay.Text("~2000 lines of C99.", textConfig)
|
||||||
clay.Text("Zero dependencies, including no C standard library.", textConfig)
|
clay.Text("Zero dependencies, including no C standard library.", textConfig)
|
||||||
}
|
}
|
||||||
if clay.UI()({
|
if clay.UI(clay.ID("BringYourOwnRendererOuter"))({
|
||||||
id = clay.ID("BringYourOwnRendererOuter"),
|
|
||||||
layout = { layoutDirection = .TopToBottom, sizing = { width = widthSizing }, childAlignment = { y = .Center }, padding = { outerPadding, outerPadding, 32, 32 }, childGap = 8 },
|
layout = { layoutDirection = .TopToBottom, sizing = { width = widthSizing }, childAlignment = { y = .Center }, padding = { outerPadding, outerPadding, 32, 32 }, childGap = 8 },
|
||||||
}) {
|
}) {
|
||||||
clay.Text("Renderer agnostic.", clay.TextConfig({fontId = FONT_ID_BODY_24, fontSize = 24, textColor = COLOR_ORANGE}))
|
clay.Text("Renderer agnostic.", clay.TextConfig({fontId = FONT_ID_BODY_24, fontSize = 24, textColor = COLOR_ORANGE}))
|
||||||
|
@ -172,9 +163,8 @@ FeatureBlocks :: proc(widthSizing: clay.SizingAxis, outerPadding: u16) {
|
||||||
}
|
}
|
||||||
|
|
||||||
FeatureBlocksDesktop :: proc() {
|
FeatureBlocksDesktop :: proc() {
|
||||||
if clay.UI()({ id = clay.ID("FeatureBlocksOuter"), layout = { sizing = { width = clay.SizingGrow({}) } } }) {
|
if clay.UI(clay.ID("FeatureBlocksOuter"))({ layout = { sizing = { width = clay.SizingGrow({}) } } }) {
|
||||||
if clay.UI()({
|
if clay.UI(clay.ID("FeatureBlocksInner"))({
|
||||||
id = clay.ID("FeatureBlocksInner"),
|
|
||||||
layout = { sizing = { width = clay.SizingGrow() }, childAlignment = { y = .Center } },
|
layout = { sizing = { width = clay.SizingGrow() }, childAlignment = { y = .Center } },
|
||||||
border = { width = { betweenChildren = 2}, color = COLOR_RED },
|
border = { width = { betweenChildren = 2}, color = COLOR_RED },
|
||||||
}) {
|
}) {
|
||||||
|
@ -184,8 +174,7 @@ FeatureBlocksDesktop :: proc() {
|
||||||
}
|
}
|
||||||
|
|
||||||
FeatureBlocksMobile :: proc() {
|
FeatureBlocksMobile :: proc() {
|
||||||
if clay.UI()({
|
if clay.UI(clay.ID("FeatureBlocksInner"))({
|
||||||
id = clay.ID("FeatureBlocksInner"),
|
|
||||||
layout = { layoutDirection = .TopToBottom, sizing = { width = clay.SizingGrow() } },
|
layout = { layoutDirection = .TopToBottom, sizing = { width = clay.SizingGrow() } },
|
||||||
border = { width = { betweenChildren = 2}, color = COLOR_RED },
|
border = { width = { betweenChildren = 2}, color = COLOR_RED },
|
||||||
}) {
|
}) {
|
||||||
|
@ -194,9 +183,9 @@ FeatureBlocksMobile :: proc() {
|
||||||
}
|
}
|
||||||
|
|
||||||
DeclarativeSyntaxPage :: proc(titleTextConfig: clay.TextElementConfig, widthSizing: clay.SizingAxis) {
|
DeclarativeSyntaxPage :: proc(titleTextConfig: clay.TextElementConfig, widthSizing: clay.SizingAxis) {
|
||||||
if clay.UI()({ id = clay.ID("SyntaxPageLeftText"), layout = { sizing = { width = widthSizing }, layoutDirection = .TopToBottom, childGap = 8 } }) {
|
if clay.UI(clay.ID("SyntaxPageLeftText"))({ layout = { sizing = { width = widthSizing }, layoutDirection = .TopToBottom, childGap = 8 } }) {
|
||||||
clay.Text("Declarative Syntax", clay.TextConfig(titleTextConfig))
|
clay.Text("Declarative Syntax", clay.TextConfig(titleTextConfig))
|
||||||
if clay.UI()({ id = clay.ID("SyntaxSpacer"), layout = { sizing = { width = clay.SizingGrow({ max = 16 }) } } }) {}
|
if clay.UI(clay.ID("SyntaxSpacer"))({ layout = { sizing = { width = clay.SizingGrow({ max = 16 }) } } }) {}
|
||||||
clay.Text(
|
clay.Text(
|
||||||
"Flexible and readable declarative syntax with nested UI element hierarchies.",
|
"Flexible and readable declarative syntax with nested UI element hierarchies.",
|
||||||
clay.TextConfig({fontSize = 28, fontId = FONT_ID_BODY_28, textColor = COLOR_RED}),
|
clay.TextConfig({fontSize = 28, fontId = FONT_ID_BODY_28, textColor = COLOR_RED}),
|
||||||
|
@ -210,9 +199,8 @@ DeclarativeSyntaxPage :: proc(titleTextConfig: clay.TextElementConfig, widthSizi
|
||||||
clay.TextConfig({fontSize = 28, fontId = FONT_ID_BODY_28, textColor = COLOR_RED}),
|
clay.TextConfig({fontSize = 28, fontId = FONT_ID_BODY_28, textColor = COLOR_RED}),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if clay.UI()({ id = clay.ID("SyntaxPageRightImage"), layout = { sizing = { width = widthSizing }, childAlignment = { x = .Center } } }) {
|
if clay.UI(clay.ID("SyntaxPageRightImage"))({ layout = { sizing = { width = widthSizing }, childAlignment = { x = .Center } } }) {
|
||||||
if clay.UI()({
|
if clay.UI(clay.ID("SyntaxPageRightImageInner"))({
|
||||||
id = clay.ID("SyntaxPageRightImageInner"),
|
|
||||||
layout = { sizing = { width = clay.SizingGrow({ max = 568 }) } },
|
layout = { sizing = { width = clay.SizingGrow({ max = 568 }) } },
|
||||||
aspectRatio = { 1136.0 / 1194.0 },
|
aspectRatio = { 1136.0 / 1194.0 },
|
||||||
image = { imageData = &syntaxImage },
|
image = { imageData = &syntaxImage },
|
||||||
|
@ -221,12 +209,10 @@ DeclarativeSyntaxPage :: proc(titleTextConfig: clay.TextElementConfig, widthSizi
|
||||||
}
|
}
|
||||||
|
|
||||||
DeclarativeSyntaxPageDesktop :: proc() {
|
DeclarativeSyntaxPageDesktop :: proc() {
|
||||||
if clay.UI()({
|
if clay.UI(clay.ID("SyntaxPageDesktop"))({
|
||||||
id = clay.ID("SyntaxPageDesktop"),
|
|
||||||
layout = { sizing = { clay.SizingGrow(), clay.SizingFit({ min = cast(f32)windowHeight - 50 }) }, childAlignment = { y = .Center }, padding = { left = 50, right = 50 } },
|
layout = { sizing = { clay.SizingGrow(), clay.SizingFit({ min = cast(f32)windowHeight - 50 }) }, childAlignment = { y = .Center }, padding = { left = 50, right = 50 } },
|
||||||
}) {
|
}) {
|
||||||
if clay.UI()({
|
if clay.UI(clay.ID("SyntaxPage"))({
|
||||||
id = clay.ID("SyntaxPage"),
|
|
||||||
layout = { sizing = { clay.SizingGrow(), clay.SizingGrow() }, childAlignment = { y = .Center }, padding = clay.PaddingAll(32), childGap = 32 },
|
layout = { sizing = { clay.SizingGrow(), clay.SizingGrow() }, childAlignment = { y = .Center }, padding = clay.PaddingAll(32), childGap = 32 },
|
||||||
border = border2pxRed,
|
border = border2pxRed,
|
||||||
}) {
|
}) {
|
||||||
|
@ -236,8 +222,7 @@ DeclarativeSyntaxPageDesktop :: proc() {
|
||||||
}
|
}
|
||||||
|
|
||||||
DeclarativeSyntaxPageMobile :: proc() {
|
DeclarativeSyntaxPageMobile :: proc() {
|
||||||
if clay.UI()({
|
if clay.UI(clay.ID("SyntaxPageMobile"))({
|
||||||
id = clay.ID("SyntaxPageMobile"),
|
|
||||||
layout = {
|
layout = {
|
||||||
layoutDirection = .TopToBottom,
|
layoutDirection = .TopToBottom,
|
||||||
sizing = { clay.SizingGrow(), clay.SizingFit({ min = cast(f32)windowHeight - 50 }) },
|
sizing = { clay.SizingGrow(), clay.SizingFit({ min = cast(f32)windowHeight - 50 }) },
|
||||||
|
@ -257,7 +242,7 @@ ColorLerp :: proc(a: clay.Color, b: clay.Color, amount: f32) -> clay.Color {
|
||||||
LOREM_IPSUM_TEXT :: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
|
LOREM_IPSUM_TEXT :: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
|
||||||
|
|
||||||
HighPerformancePage :: proc(lerpValue: f32, titleTextConfig: clay.TextElementConfig, widthSizing: clay.SizingAxis) {
|
HighPerformancePage :: proc(lerpValue: f32, titleTextConfig: clay.TextElementConfig, widthSizing: clay.SizingAxis) {
|
||||||
if clay.UI()({ id = clay.ID("PerformanceLeftText"), layout = { sizing = { width = widthSizing }, layoutDirection = .TopToBottom, childGap = 8 } }) {
|
if clay.UI(clay.ID("PerformanceLeftText"))({ layout = { sizing = { width = widthSizing }, layoutDirection = .TopToBottom, childGap = 8 } }) {
|
||||||
clay.Text("High Performance", clay.TextConfig(titleTextConfig))
|
clay.Text("High Performance", clay.TextConfig(titleTextConfig))
|
||||||
if clay.UI()({ layout = { sizing = { width = clay.SizingGrow({ max = 16 }) } }}) {}
|
if clay.UI()({ layout = { sizing = { width = clay.SizingGrow({ max = 16 }) } }}) {}
|
||||||
clay.Text(
|
clay.Text(
|
||||||
|
@ -273,21 +258,18 @@ HighPerformancePage :: proc(lerpValue: f32, titleTextConfig: clay.TextElementCon
|
||||||
clay.TextConfig({fontSize = 28, fontId = FONT_ID_BODY_36, textColor = COLOR_LIGHT}),
|
clay.TextConfig({fontSize = 28, fontId = FONT_ID_BODY_36, textColor = COLOR_LIGHT}),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if clay.UI()({ id = clay.ID("PerformanceRightImageOuter"), layout = { sizing = { width = widthSizing }, childAlignment = { x = .Center } } }) {
|
if clay.UI(clay.ID("PerformanceRightImageOuter"))({ layout = { sizing = { width = widthSizing }, childAlignment = { x = .Center } } }) {
|
||||||
if clay.UI()({
|
if clay.UI(clay.ID("PerformanceRightBorder"))({
|
||||||
id = clay.ID("PerformanceRightBorder"),
|
|
||||||
layout = { sizing = { clay.SizingGrow(), clay.SizingFixed(400) } },
|
layout = { sizing = { clay.SizingGrow(), clay.SizingFixed(400) } },
|
||||||
border = { COLOR_LIGHT, {2, 2, 2, 2, 2} },
|
border = { COLOR_LIGHT, {2, 2, 2, 2, 2} },
|
||||||
}) {
|
}) {
|
||||||
if clay.UI()({
|
if clay.UI(clay.ID("AnimationDemoContainerLeft"))({
|
||||||
id = clay.ID("AnimationDemoContainerLeft"),
|
|
||||||
layout = { sizing = { clay.SizingPercent(0.35 + 0.3 * lerpValue), clay.SizingGrow() }, childAlignment = { y = .Center }, padding = clay.PaddingAll(16) },
|
layout = { sizing = { clay.SizingPercent(0.35 + 0.3 * lerpValue), clay.SizingGrow() }, childAlignment = { y = .Center }, padding = clay.PaddingAll(16) },
|
||||||
backgroundColor = ColorLerp(COLOR_RED, COLOR_ORANGE, lerpValue),
|
backgroundColor = ColorLerp(COLOR_RED, COLOR_ORANGE, lerpValue),
|
||||||
}) {
|
}) {
|
||||||
clay.Text(LOREM_IPSUM_TEXT, clay.TextConfig({fontSize = 16, fontId = FONT_ID_BODY_16, textColor = COLOR_LIGHT}))
|
clay.Text(LOREM_IPSUM_TEXT, clay.TextConfig({fontSize = 16, fontId = FONT_ID_BODY_16, textColor = COLOR_LIGHT}))
|
||||||
}
|
}
|
||||||
if clay.UI()({
|
if clay.UI(clay.ID("AnimationDemoContainerRight"))({
|
||||||
id = clay.ID("AnimationDemoContainerRight"),
|
|
||||||
layout = { sizing = { clay.SizingGrow(), clay.SizingGrow() }, childAlignment = { y = .Center }, padding = clay.PaddingAll(16) },
|
layout = { sizing = { clay.SizingGrow(), clay.SizingGrow() }, childAlignment = { y = .Center }, padding = clay.PaddingAll(16) },
|
||||||
backgroundColor = ColorLerp(COLOR_ORANGE, COLOR_RED, lerpValue),
|
backgroundColor = ColorLerp(COLOR_ORANGE, COLOR_RED, lerpValue),
|
||||||
}) {
|
}) {
|
||||||
|
@ -298,8 +280,7 @@ HighPerformancePage :: proc(lerpValue: f32, titleTextConfig: clay.TextElementCon
|
||||||
}
|
}
|
||||||
|
|
||||||
HighPerformancePageDesktop :: proc(lerpValue: f32) {
|
HighPerformancePageDesktop :: proc(lerpValue: f32) {
|
||||||
if clay.UI()({
|
if clay.UI(clay.ID("PerformanceDesktop"))({
|
||||||
id = clay.ID("PerformanceDesktop"),
|
|
||||||
layout = { sizing = { clay.SizingGrow(), clay.SizingFit({ min = cast(f32)windowHeight - 50 }) }, childAlignment = { y = .Center }, padding = { 82, 82, 32, 32 }, childGap = 64 },
|
layout = { sizing = { clay.SizingGrow(), clay.SizingFit({ min = cast(f32)windowHeight - 50 }) }, childAlignment = { y = .Center }, padding = { 82, 82, 32, 32 }, childGap = 64 },
|
||||||
backgroundColor = COLOR_RED,
|
backgroundColor = COLOR_RED,
|
||||||
}) {
|
}) {
|
||||||
|
@ -308,8 +289,7 @@ HighPerformancePageDesktop :: proc(lerpValue: f32) {
|
||||||
}
|
}
|
||||||
|
|
||||||
HighPerformancePageMobile :: proc(lerpValue: f32) {
|
HighPerformancePageMobile :: proc(lerpValue: f32) {
|
||||||
if clay.UI()({
|
if clay.UI(clay.ID("PerformanceMobile"))({
|
||||||
id = clay.ID("PerformanceMobile"),
|
|
||||||
layout = {
|
layout = {
|
||||||
layoutDirection = .TopToBottom,
|
layoutDirection = .TopToBottom,
|
||||||
sizing = { clay.SizingGrow(), clay.SizingFit({ min = cast(f32)windowHeight - 50 }) },
|
sizing = { clay.SizingGrow(), clay.SizingFit({ min = cast(f32)windowHeight - 50 }) },
|
||||||
|
@ -335,8 +315,7 @@ RendererButtonActive :: proc(index: i32, $text: string) {
|
||||||
|
|
||||||
RendererButtonInactive :: proc(index: u32, $text: string) {
|
RendererButtonInactive :: proc(index: u32, $text: string) {
|
||||||
if clay.UI()({ border = border2pxRed }) {
|
if clay.UI()({ border = border2pxRed }) {
|
||||||
if clay.UI()({
|
if clay.UI(clay.ID("RendererButtonInactiveInner", index))({
|
||||||
id = clay.ID("RendererButtonInactiveInner", index),
|
|
||||||
layout = { sizing = { width = clay.SizingFixed(300) }, padding = clay.PaddingAll(16) },
|
layout = { sizing = { width = clay.SizingFixed(300) }, padding = clay.PaddingAll(16) },
|
||||||
backgroundColor = COLOR_LIGHT,
|
backgroundColor = COLOR_LIGHT,
|
||||||
cornerRadius = clay.CornerRadiusAll(10)
|
cornerRadius = clay.CornerRadiusAll(10)
|
||||||
|
@ -347,7 +326,7 @@ RendererButtonInactive :: proc(index: u32, $text: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
RendererPage :: proc(titleTextConfig: clay.TextElementConfig, widthSizing: clay.SizingAxis) {
|
RendererPage :: proc(titleTextConfig: clay.TextElementConfig, widthSizing: clay.SizingAxis) {
|
||||||
if clay.UI()({ id = clay.ID("RendererLeftText"), layout = { sizing = { width = widthSizing }, layoutDirection = .TopToBottom, childGap = 8 } }) {
|
if clay.UI(clay.ID("RendererLeftText"))({ layout = { sizing = { width = widthSizing }, layoutDirection = .TopToBottom, childGap = 8 } }) {
|
||||||
clay.Text("Renderer & Platform Agnostic", clay.TextConfig(titleTextConfig))
|
clay.Text("Renderer & Platform Agnostic", clay.TextConfig(titleTextConfig))
|
||||||
if clay.UI()({ layout = { sizing = { width = clay.SizingGrow({ max = 16 }) } } }) {}
|
if clay.UI()({ layout = { sizing = { width = clay.SizingGrow({ max = 16 }) } } }) {}
|
||||||
clay.Text(
|
clay.Text(
|
||||||
|
@ -363,8 +342,7 @@ RendererPage :: proc(titleTextConfig: clay.TextElementConfig, widthSizing: clay.
|
||||||
clay.TextConfig({fontSize = 28, fontId = FONT_ID_BODY_36, textColor = COLOR_RED}),
|
clay.TextConfig({fontSize = 28, fontId = FONT_ID_BODY_36, textColor = COLOR_RED}),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if clay.UI()({
|
if clay.UI(clay.ID("RendererRightText"))({
|
||||||
id = clay.ID("RendererRightText"),
|
|
||||||
layout = { sizing = { width = widthSizing }, childAlignment = { x = .Center }, layoutDirection = .TopToBottom, childGap = 16 },
|
layout = { sizing = { width = widthSizing }, childAlignment = { x = .Center }, layoutDirection = .TopToBottom, childGap = 16 },
|
||||||
}) {
|
}) {
|
||||||
clay.Text("Try changing renderer!", clay.TextConfig({fontSize = 36, fontId = FONT_ID_BODY_36, textColor = COLOR_ORANGE}))
|
clay.Text("Try changing renderer!", clay.TextConfig({fontSize = 36, fontId = FONT_ID_BODY_36, textColor = COLOR_ORANGE}))
|
||||||
|
@ -374,12 +352,10 @@ RendererPage :: proc(titleTextConfig: clay.TextElementConfig, widthSizing: clay.
|
||||||
}
|
}
|
||||||
|
|
||||||
RendererPageDesktop :: proc() {
|
RendererPageDesktop :: proc() {
|
||||||
if clay.UI()({
|
if clay.UI(clay.ID("RendererPageDesktop"))({
|
||||||
id = clay.ID("RendererPageDesktop"),
|
|
||||||
layout = { sizing = { clay.SizingGrow(), clay.SizingFit({ min = cast(f32)windowHeight - 50 }) }, childAlignment = { y = .Center }, padding = { left = 50, right = 50 } },
|
layout = { sizing = { clay.SizingGrow(), clay.SizingFit({ min = cast(f32)windowHeight - 50 }) }, childAlignment = { y = .Center }, padding = { left = 50, right = 50 } },
|
||||||
}) {
|
}) {
|
||||||
if clay.UI()({
|
if clay.UI(clay.ID("RendererPage"))({
|
||||||
id = clay.ID("RendererPage"),
|
|
||||||
layout = { sizing = { clay.SizingGrow(), clay.SizingGrow() }, childAlignment = { y = .Center }, padding = clay.PaddingAll(32), childGap = 32 },
|
layout = { sizing = { clay.SizingGrow(), clay.SizingGrow() }, childAlignment = { y = .Center }, padding = clay.PaddingAll(32), childGap = 32 },
|
||||||
border = { COLOR_RED, { left = 2, right = 2 } },
|
border = { COLOR_RED, { left = 2, right = 2 } },
|
||||||
}) {
|
}) {
|
||||||
|
@ -389,8 +365,7 @@ RendererPageDesktop :: proc() {
|
||||||
}
|
}
|
||||||
|
|
||||||
RendererPageMobile :: proc() {
|
RendererPageMobile :: proc() {
|
||||||
if clay.UI()({
|
if clay.UI(clay.ID("RendererMobile"))({
|
||||||
id = clay.ID("RendererMobile"),
|
|
||||||
layout = {
|
layout = {
|
||||||
layoutDirection = .TopToBottom,
|
layoutDirection = .TopToBottom,
|
||||||
sizing = { clay.SizingGrow(), clay.SizingFit({ min = cast(f32)windowHeight - 50 }) },
|
sizing = { clay.SizingGrow(), clay.SizingFit({ min = cast(f32)windowHeight - 50 }) },
|
||||||
|
@ -416,28 +391,25 @@ animationLerpValue: f32 = -1.0
|
||||||
createLayout :: proc(lerpValue: f32) -> clay.ClayArray(clay.RenderCommand) {
|
createLayout :: proc(lerpValue: f32) -> clay.ClayArray(clay.RenderCommand) {
|
||||||
mobileScreen := windowWidth < 750
|
mobileScreen := windowWidth < 750
|
||||||
clay.BeginLayout()
|
clay.BeginLayout()
|
||||||
if clay.UI()({
|
if clay.UI(clay.ID("OuterContainer"))({
|
||||||
id = clay.ID("OuterContainer"),
|
|
||||||
layout = { layoutDirection = .TopToBottom, sizing = { clay.SizingGrow(), clay.SizingGrow() } },
|
layout = { layoutDirection = .TopToBottom, sizing = { clay.SizingGrow(), clay.SizingGrow() } },
|
||||||
backgroundColor = COLOR_LIGHT,
|
backgroundColor = COLOR_LIGHT,
|
||||||
}) {
|
}) {
|
||||||
if clay.UI()({
|
if clay.UI(clay.ID("Header"))({
|
||||||
id = clay.ID("Header"),
|
|
||||||
layout = { sizing = { clay.SizingGrow(), clay.SizingFixed(50) }, childAlignment = { y = .Center }, childGap = 24, padding = { left = 32, right = 32 } },
|
layout = { sizing = { clay.SizingGrow(), clay.SizingFixed(50) }, childAlignment = { y = .Center }, childGap = 24, padding = { left = 32, right = 32 } },
|
||||||
}) {
|
}) {
|
||||||
clay.Text("Clay", &headerTextConfig)
|
clay.Text("Clay", &headerTextConfig)
|
||||||
if clay.UI()({ layout = { sizing = { width = clay.SizingGrow() } } }) {}
|
if clay.UI()({ layout = { sizing = { width = clay.SizingGrow() } } }) {}
|
||||||
|
|
||||||
if (!mobileScreen) {
|
if (!mobileScreen) {
|
||||||
if clay.UI()({ id = clay.ID("LinkExamplesOuter"), backgroundColor = {0, 0, 0, 0} }) {
|
if clay.UI(clay.ID("LinkExamplesOuter"))({ backgroundColor = {0, 0, 0, 0} }) {
|
||||||
clay.Text("Examples", clay.TextConfig({fontId = FONT_ID_BODY_24, fontSize = 24, textColor = {61, 26, 5, 255}}))
|
clay.Text("Examples", clay.TextConfig({fontId = FONT_ID_BODY_24, fontSize = 24, textColor = {61, 26, 5, 255}}))
|
||||||
}
|
}
|
||||||
if clay.UI()({ id = clay.ID("LinkDocsOuter"), backgroundColor = {0, 0, 0, 0} }) {
|
if clay.UI(clay.ID("LinkDocsOuter"))({ backgroundColor = {0, 0, 0, 0} }) {
|
||||||
clay.Text("Docs", clay.TextConfig({fontId = FONT_ID_BODY_24, fontSize = 24, textColor = {61, 26, 5, 255}}))
|
clay.Text("Docs", clay.TextConfig({fontId = FONT_ID_BODY_24, fontSize = 24, textColor = {61, 26, 5, 255}}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if clay.UI()({
|
if clay.UI(clay.ID("LinkGithubOuter"))({
|
||||||
id = clay.ID("LinkGithubOuter"),
|
|
||||||
layout = { padding = { 16, 16, 6, 6 } },
|
layout = { padding = { 16, 16, 6, 6 } },
|
||||||
border = border2pxRed,
|
border = border2pxRed,
|
||||||
backgroundColor = clay.Hovered() ? COLOR_LIGHT_HOVER : COLOR_LIGHT,
|
backgroundColor = clay.Hovered() ? COLOR_LIGHT_HOVER : COLOR_LIGHT,
|
||||||
|
@ -446,13 +418,12 @@ createLayout :: proc(lerpValue: f32) -> clay.ClayArray(clay.RenderCommand) {
|
||||||
clay.Text("Github", clay.TextConfig({fontId = FONT_ID_BODY_24, fontSize = 24, textColor = {61, 26, 5, 255}}))
|
clay.Text("Github", clay.TextConfig({fontId = FONT_ID_BODY_24, fontSize = 24, textColor = {61, 26, 5, 255}}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if clay.UI()({ id = clay.ID("TopBorder1"), layout = { sizing = { clay.SizingGrow(), clay.SizingFixed(4) } }, backgroundColor = COLOR_TOP_BORDER_5 } ) {}
|
if clay.UI(clay.ID("TopBorder1"))({ layout = { sizing = { clay.SizingGrow(), clay.SizingFixed(4) } }, backgroundColor = COLOR_TOP_BORDER_5 } ) {}
|
||||||
if clay.UI()({ id = clay.ID("TopBorder2"), layout = { sizing = { clay.SizingGrow(), clay.SizingFixed(4) } }, backgroundColor = COLOR_TOP_BORDER_4 } ) {}
|
if clay.UI(clay.ID("TopBorder2"))({ layout = { sizing = { clay.SizingGrow(), clay.SizingFixed(4) } }, backgroundColor = COLOR_TOP_BORDER_4 } ) {}
|
||||||
if clay.UI()({ id = clay.ID("TopBorder3"), layout = { sizing = { clay.SizingGrow(), clay.SizingFixed(4) } }, backgroundColor = COLOR_TOP_BORDER_3 } ) {}
|
if clay.UI(clay.ID("TopBorder3"))({ layout = { sizing = { clay.SizingGrow(), clay.SizingFixed(4) } }, backgroundColor = COLOR_TOP_BORDER_3 } ) {}
|
||||||
if clay.UI()({ id = clay.ID("TopBorder4"), layout = { sizing = { clay.SizingGrow(), clay.SizingFixed(4) } }, backgroundColor = COLOR_TOP_BORDER_2 } ) {}
|
if clay.UI(clay.ID("TopBorder4"))({ layout = { sizing = { clay.SizingGrow(), clay.SizingFixed(4) } }, backgroundColor = COLOR_TOP_BORDER_2 } ) {}
|
||||||
if clay.UI()({ id = clay.ID("TopBorder5"), layout = { sizing = { clay.SizingGrow(), clay.SizingFixed(4) } }, backgroundColor = COLOR_TOP_BORDER_1 } ) {}
|
if clay.UI(clay.ID("TopBorder5"))({ layout = { sizing = { clay.SizingGrow(), clay.SizingFixed(4) } }, backgroundColor = COLOR_TOP_BORDER_1 } ) {}
|
||||||
if clay.UI()({
|
if clay.UI(clay.ID("ScrollContainerBackgroundRectangle"))({
|
||||||
id = clay.ID("ScrollContainerBackgroundRectangle"),
|
|
||||||
clip = { vertical = true, childOffset = clay.GetScrollOffset() },
|
clip = { vertical = true, childOffset = clay.GetScrollOffset() },
|
||||||
layout = { sizing = { clay.SizingGrow(), clay.SizingGrow() }, layoutDirection = clay.LayoutDirection.TopToBottom },
|
layout = { sizing = { clay.SizingGrow(), clay.SizingGrow() }, layoutDirection = clay.LayoutDirection.TopToBottom },
|
||||||
backgroundColor = COLOR_LIGHT,
|
backgroundColor = COLOR_LIGHT,
|
||||||
|
|
|
@ -21,9 +21,17 @@ measure_text :: proc "c" (text: clay.StringSlice, config: ^clay.TextElementConfi
|
||||||
|
|
||||||
font := raylib_fonts[config.fontId].font
|
font := raylib_fonts[config.fontId].font
|
||||||
|
|
||||||
for i in 0 ..< text.length {
|
byte_index := 0
|
||||||
glyph_index := text.chars[i] - 32
|
for byte_index < int(text.length) {
|
||||||
|
// handle utf-8 codepoints
|
||||||
|
codepoint_bytes: i32 = 0
|
||||||
|
codepoint := rl.GetCodepoint(
|
||||||
|
transmute(cstring)&text.chars[byte_index],
|
||||||
|
&codepoint_bytes,
|
||||||
|
)
|
||||||
|
byte_index += int(codepoint_bytes)
|
||||||
|
|
||||||
|
glyph_index := rl.GetGlyphIndex(font, codepoint)
|
||||||
glyph := font.glyphs[glyph_index]
|
glyph := font.glyphs[glyph_index]
|
||||||
|
|
||||||
if glyph.advanceX != 0 {
|
if glyph.advanceX != 0 {
|
||||||
|
@ -198,4 +206,4 @@ draw_rect :: proc(x, y, w, h: f32, color: clay.Color) {
|
||||||
@(private = "file")
|
@(private = "file")
|
||||||
draw_rect_rounded :: proc(x,y,w,h: f32, radius: f32, color: clay.Color){
|
draw_rect_rounded :: proc(x,y,w,h: f32, radius: f32, color: clay.Color){
|
||||||
rl.DrawRectangleRounded({x,y,w,h},radius,8,clay_color_to_rl_color(color))
|
rl.DrawRectangleRounded({x,y,w,h},radius,8,clay_color_to_rl_color(color))
|
||||||
}
|
}
|
||||||
|
|
226
clay.h
226
clay.h
|
@ -121,25 +121,32 @@ static inline void Clay__SuppressUnusedLatchDefinitionVariableWarning(void) { (v
|
||||||
|
|
||||||
Into calls like this:
|
Into calls like this:
|
||||||
|
|
||||||
Clay_OpenElement();
|
Clay__OpenElement();
|
||||||
Clay_ConfigureOpenElement((Clay_ElementDeclaration) {
|
Clay__ConfigureOpenElement((Clay_ElementDeclaration) {
|
||||||
.id = CLAY_ID("Container"),
|
.id = CLAY_ID("Container"),
|
||||||
.backgroundColor = { 255, 200, 200, 255 }
|
.backgroundColor = { 255, 200, 200, 255 }
|
||||||
});
|
});
|
||||||
...children declared here
|
...children declared here
|
||||||
Clay_CloseElement();
|
Clay__CloseElement();
|
||||||
|
|
||||||
The for loop will only ever run a single iteration, putting Clay__CloseElement() in the increment of the loop
|
The for loop will only ever run a single iteration, putting Clay__CloseElement() in the increment of the loop
|
||||||
means that it will run after the body - where the children are declared. It just exists to make sure you don't forget
|
means that it will run after the body - where the children are declared. It just exists to make sure you don't forget
|
||||||
to call Clay_CloseElement().
|
to call Clay_CloseElement().
|
||||||
*/
|
*/
|
||||||
#define CLAY(...) \
|
#define CLAY_AUTO_ID(...) \
|
||||||
for ( \
|
for ( \
|
||||||
CLAY__ELEMENT_DEFINITION_LATCH = (Clay__OpenElement(), Clay__ConfigureOpenElement(CLAY__CONFIG_WRAPPER(Clay_ElementDeclaration, __VA_ARGS__)), 0); \
|
CLAY__ELEMENT_DEFINITION_LATCH = (Clay__OpenElement(), Clay__ConfigureOpenElement(CLAY__CONFIG_WRAPPER(Clay_ElementDeclaration, __VA_ARGS__)), 0); \
|
||||||
CLAY__ELEMENT_DEFINITION_LATCH < 1; \
|
CLAY__ELEMENT_DEFINITION_LATCH < 1; \
|
||||||
CLAY__ELEMENT_DEFINITION_LATCH=1, Clay__CloseElement() \
|
CLAY__ELEMENT_DEFINITION_LATCH=1, Clay__CloseElement() \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
#define CLAY(id, ...) \
|
||||||
|
for ( \
|
||||||
|
CLAY__ELEMENT_DEFINITION_LATCH = (Clay__OpenElementWithId(id), Clay__ConfigureOpenElement(CLAY__CONFIG_WRAPPER(Clay_ElementDeclaration, __VA_ARGS__)), 0); \
|
||||||
|
CLAY__ELEMENT_DEFINITION_LATCH < 1; \
|
||||||
|
CLAY__ELEMENT_DEFINITION_LATCH=1, Clay__CloseElement() \
|
||||||
|
)
|
||||||
|
|
||||||
// These macros exist to allow the CLAY() macro to be called both with an inline struct definition, such as
|
// These macros exist to allow the CLAY() macro to be called both with an inline struct definition, such as
|
||||||
// CLAY({ .id = something... });
|
// CLAY({ .id = something... });
|
||||||
// As well as by passing a predefined declaration struct
|
// As well as by passing a predefined declaration struct
|
||||||
|
@ -740,9 +747,6 @@ typedef struct Clay_PointerData {
|
||||||
} Clay_PointerData;
|
} Clay_PointerData;
|
||||||
|
|
||||||
typedef struct Clay_ElementDeclaration {
|
typedef struct Clay_ElementDeclaration {
|
||||||
// Primarily created via the CLAY_ID(), CLAY_IDI(), CLAY_ID_LOCAL() and CLAY_IDI_LOCAL() macros.
|
|
||||||
// Represents a hashed string ID used for identifying and finding specific clay UI elements, required by functions such as Clay_PointerOver() and Clay_GetElementData().
|
|
||||||
Clay_ElementId id;
|
|
||||||
// Controls various settings that affect the size and position of an element, as well as the sizes and positions of any child elements.
|
// Controls various settings that affect the size and position of an element, as well as the sizes and positions of any child elements.
|
||||||
Clay_LayoutConfig layout;
|
Clay_LayoutConfig layout;
|
||||||
// Controls the background color of the resulting element.
|
// Controls the background color of the resulting element.
|
||||||
|
@ -789,6 +793,8 @@ typedef CLAY_PACKED_ENUM {
|
||||||
CLAY_ERROR_TYPE_PERCENTAGE_OVER_1,
|
CLAY_ERROR_TYPE_PERCENTAGE_OVER_1,
|
||||||
// Clay encountered an internal error. It would be wonderful if you could report this so we can fix it!
|
// Clay encountered an internal error. It would be wonderful if you could report this so we can fix it!
|
||||||
CLAY_ERROR_TYPE_INTERNAL_ERROR,
|
CLAY_ERROR_TYPE_INTERNAL_ERROR,
|
||||||
|
// Clay__OpenElement was called more times than Clay__CloseElement, so there were still remaining open elements when the layout ended.
|
||||||
|
CLAY_ERROR_TYPE_UNBALANCED_OPEN_CLOSE,
|
||||||
} Clay_ErrorType;
|
} Clay_ErrorType;
|
||||||
|
|
||||||
// Data to identify the error that clay has encountered.
|
// Data to identify the error that clay has encountered.
|
||||||
|
@ -916,6 +922,7 @@ CLAY_DLL_EXPORT void Clay_ResetMeasureTextCache(void);
|
||||||
// Internal API functions required by macros ----------------------
|
// Internal API functions required by macros ----------------------
|
||||||
|
|
||||||
CLAY_DLL_EXPORT void Clay__OpenElement(void);
|
CLAY_DLL_EXPORT void Clay__OpenElement(void);
|
||||||
|
CLAY_DLL_EXPORT void Clay__OpenElementWithId(Clay_ElementId elementId);
|
||||||
CLAY_DLL_EXPORT void Clay__ConfigureOpenElement(const Clay_ElementDeclaration config);
|
CLAY_DLL_EXPORT void Clay__ConfigureOpenElement(const Clay_ElementDeclaration config);
|
||||||
CLAY_DLL_EXPORT void Clay__ConfigureOpenElementPtr(const Clay_ElementDeclaration *config);
|
CLAY_DLL_EXPORT void Clay__ConfigureOpenElementPtr(const Clay_ElementDeclaration *config);
|
||||||
CLAY_DLL_EXPORT void Clay__CloseElement(void);
|
CLAY_DLL_EXPORT void Clay__CloseElement(void);
|
||||||
|
@ -1175,7 +1182,6 @@ typedef struct { // todo get this struct into a single cache line
|
||||||
intptr_t hoverFunctionUserData;
|
intptr_t hoverFunctionUserData;
|
||||||
int32_t nextIndex;
|
int32_t nextIndex;
|
||||||
uint32_t generation;
|
uint32_t generation;
|
||||||
uint32_t idAlias;
|
|
||||||
Clay__DebugElementData *debugData;
|
Clay__DebugElementData *debugData;
|
||||||
} Clay_LayoutElementHashMapItem;
|
} Clay_LayoutElementHashMapItem;
|
||||||
|
|
||||||
|
@ -1709,12 +1715,12 @@ bool Clay__PointIsInsideRect(Clay_Vector2 point, Clay_BoundingBox rect) {
|
||||||
return point.x >= rect.x && point.x <= rect.x + rect.width && point.y >= rect.y && point.y <= rect.y + rect.height;
|
return point.x >= rect.x && point.x <= rect.x + rect.width && point.y >= rect.y && point.y <= rect.y + rect.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
Clay_LayoutElementHashMapItem* Clay__AddHashMapItem(Clay_ElementId elementId, Clay_LayoutElement* layoutElement, uint32_t idAlias) {
|
Clay_LayoutElementHashMapItem* Clay__AddHashMapItem(Clay_ElementId elementId, Clay_LayoutElement* layoutElement) {
|
||||||
Clay_Context* context = Clay_GetCurrentContext();
|
Clay_Context* context = Clay_GetCurrentContext();
|
||||||
if (context->layoutElementsHashMapInternal.length == context->layoutElementsHashMapInternal.capacity - 1) {
|
if (context->layoutElementsHashMapInternal.length == context->layoutElementsHashMapInternal.capacity - 1) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
Clay_LayoutElementHashMapItem item = { .elementId = elementId, .layoutElement = layoutElement, .nextIndex = -1, .generation = context->generation + 1, .idAlias = idAlias };
|
Clay_LayoutElementHashMapItem item = { .elementId = elementId, .layoutElement = layoutElement, .nextIndex = -1, .generation = context->generation + 1 };
|
||||||
uint32_t hashBucket = elementId.id % context->layoutElementsHashMap.capacity;
|
uint32_t hashBucket = elementId.id % context->layoutElementsHashMap.capacity;
|
||||||
int32_t hashItemPrevious = -1;
|
int32_t hashItemPrevious = -1;
|
||||||
int32_t hashItemIndex = context->layoutElementsHashMap.internalArray[hashBucket];
|
int32_t hashItemIndex = context->layoutElementsHashMap.internalArray[hashBucket];
|
||||||
|
@ -1724,7 +1730,6 @@ Clay_LayoutElementHashMapItem* Clay__AddHashMapItem(Clay_ElementId elementId, Cl
|
||||||
item.nextIndex = hashItem->nextIndex;
|
item.nextIndex = hashItem->nextIndex;
|
||||||
if (hashItem->generation <= context->generation) { // First collision - assume this is the "same" element
|
if (hashItem->generation <= context->generation) { // First collision - assume this is the "same" element
|
||||||
hashItem->elementId = elementId; // Make sure to copy this across. If the stringId reference has changed, we should update the hash item to use the new one.
|
hashItem->elementId = elementId; // Make sure to copy this across. If the stringId reference has changed, we should update the hash item to use the new one.
|
||||||
hashItem->idAlias = idAlias;
|
|
||||||
hashItem->generation = context->generation + 1;
|
hashItem->generation = context->generation + 1;
|
||||||
hashItem->layoutElement = layoutElement;
|
hashItem->layoutElement = layoutElement;
|
||||||
hashItem->debugData->collision = false;
|
hashItem->debugData->collision = false;
|
||||||
|
@ -1773,7 +1778,7 @@ Clay_ElementId Clay__GenerateIdForAnonymousElement(Clay_LayoutElement *openLayou
|
||||||
Clay_LayoutElement *parentElement = Clay_LayoutElementArray_Get(&context->layoutElements, Clay__int32_tArray_GetValue(&context->openLayoutElementStack, context->openLayoutElementStack.length - 2));
|
Clay_LayoutElement *parentElement = Clay_LayoutElementArray_Get(&context->layoutElements, Clay__int32_tArray_GetValue(&context->openLayoutElementStack, context->openLayoutElementStack.length - 2));
|
||||||
Clay_ElementId elementId = Clay__HashNumber(parentElement->childrenOrTextContent.children.length, parentElement->id);
|
Clay_ElementId elementId = Clay__HashNumber(parentElement->childrenOrTextContent.children.length, parentElement->id);
|
||||||
openLayoutElement->id = elementId.id;
|
openLayoutElement->id = elementId.id;
|
||||||
Clay__AddHashMapItem(elementId, openLayoutElement, 0);
|
Clay__AddHashMapItem(elementId, openLayoutElement);
|
||||||
Clay__StringArray_Add(&context->layoutElementIdStrings, elementId.stringId);
|
Clay__StringArray_Add(&context->layoutElementIdStrings, elementId.stringId);
|
||||||
return elementId;
|
return elementId;
|
||||||
}
|
}
|
||||||
|
@ -1812,6 +1817,10 @@ void Clay__CloseElement(void) {
|
||||||
}
|
}
|
||||||
Clay_LayoutElement *openLayoutElement = Clay__GetOpenLayoutElement();
|
Clay_LayoutElement *openLayoutElement = Clay__GetOpenLayoutElement();
|
||||||
Clay_LayoutConfig *layoutConfig = openLayoutElement->layoutConfig;
|
Clay_LayoutConfig *layoutConfig = openLayoutElement->layoutConfig;
|
||||||
|
if (!layoutConfig) {
|
||||||
|
openLayoutElement->layoutConfig = &Clay_LayoutConfig_DEFAULT;
|
||||||
|
layoutConfig = &Clay_LayoutConfig_DEFAULT;
|
||||||
|
}
|
||||||
bool elementHasClipHorizontal = false;
|
bool elementHasClipHorizontal = false;
|
||||||
bool elementHasClipVertical = false;
|
bool elementHasClipVertical = false;
|
||||||
for (int32_t i = 0; i < openLayoutElement->elementConfigs.length; i++) {
|
for (int32_t i = 0; i < openLayoutElement->elementConfigs.length; i++) {
|
||||||
|
@ -1988,8 +1997,28 @@ void Clay__OpenElement(void) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Clay_LayoutElement layoutElement = CLAY__DEFAULT_STRUCT;
|
Clay_LayoutElement layoutElement = CLAY__DEFAULT_STRUCT;
|
||||||
Clay_LayoutElementArray_Add(&context->layoutElements, layoutElement);
|
Clay_LayoutElement* openLayoutElement = Clay_LayoutElementArray_Add(&context->layoutElements, layoutElement);
|
||||||
Clay__int32_tArray_Add(&context->openLayoutElementStack, context->layoutElements.length - 1);
|
Clay__int32_tArray_Add(&context->openLayoutElementStack, context->layoutElements.length - 1);
|
||||||
|
Clay__GenerateIdForAnonymousElement(openLayoutElement);
|
||||||
|
if (context->openClipElementStack.length > 0) {
|
||||||
|
Clay__int32_tArray_Set(&context->layoutElementClipElementIds, context->layoutElements.length - 1, Clay__int32_tArray_GetValue(&context->openClipElementStack, (int)context->openClipElementStack.length - 1));
|
||||||
|
} else {
|
||||||
|
Clay__int32_tArray_Set(&context->layoutElementClipElementIds, context->layoutElements.length - 1, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Clay__OpenElementWithId(Clay_ElementId elementId) {
|
||||||
|
Clay_Context* context = Clay_GetCurrentContext();
|
||||||
|
if (context->layoutElements.length == context->layoutElements.capacity - 1 || context->booleanWarnings.maxElementsExceeded) {
|
||||||
|
context->booleanWarnings.maxElementsExceeded = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Clay_LayoutElement layoutElement = CLAY__DEFAULT_STRUCT;
|
||||||
|
layoutElement.id = elementId.id;
|
||||||
|
Clay_LayoutElement * openLayoutElement = Clay_LayoutElementArray_Add(&context->layoutElements, layoutElement);
|
||||||
|
Clay__int32_tArray_Add(&context->openLayoutElementStack, context->layoutElements.length - 1);
|
||||||
|
Clay__AddHashMapItem(elementId, openLayoutElement);
|
||||||
|
Clay__StringArray_Add(&context->layoutElementIdStrings, elementId.stringId);
|
||||||
if (context->openClipElementStack.length > 0) {
|
if (context->openClipElementStack.length > 0) {
|
||||||
Clay__int32_tArray_Set(&context->layoutElementClipElementIds, context->layoutElements.length - 1, Clay__int32_tArray_GetValue(&context->openClipElementStack, (int)context->openClipElementStack.length - 1));
|
Clay__int32_tArray_Set(&context->layoutElementClipElementIds, context->layoutElements.length - 1, Clay__int32_tArray_GetValue(&context->openClipElementStack, (int)context->openClipElementStack.length - 1));
|
||||||
} else {
|
} else {
|
||||||
|
@ -2017,7 +2046,7 @@ void Clay__OpenTextElement(Clay_String text, Clay_TextElementConfig *textConfig)
|
||||||
Clay__MeasureTextCacheItem *textMeasured = Clay__MeasureTextCached(&text, textConfig);
|
Clay__MeasureTextCacheItem *textMeasured = Clay__MeasureTextCached(&text, textConfig);
|
||||||
Clay_ElementId elementId = Clay__HashNumber(parentElement->childrenOrTextContent.children.length, parentElement->id);
|
Clay_ElementId elementId = Clay__HashNumber(parentElement->childrenOrTextContent.children.length, parentElement->id);
|
||||||
textElement->id = elementId.id;
|
textElement->id = elementId.id;
|
||||||
Clay__AddHashMapItem(elementId, textElement, 0);
|
Clay__AddHashMapItem(elementId, textElement);
|
||||||
Clay__StringArray_Add(&context->layoutElementIdStrings, elementId.stringId);
|
Clay__StringArray_Add(&context->layoutElementIdStrings, elementId.stringId);
|
||||||
Clay_Dimensions textDimensions = { .width = textMeasured->unwrappedDimensions.width, .height = textConfig->lineHeight > 0 ? (float)textConfig->lineHeight : textMeasured->unwrappedDimensions.height };
|
Clay_Dimensions textDimensions = { .width = textMeasured->unwrappedDimensions.width, .height = textConfig->lineHeight > 0 ? (float)textConfig->lineHeight : textMeasured->unwrappedDimensions.height };
|
||||||
textElement->dimensions = textDimensions;
|
textElement->dimensions = textDimensions;
|
||||||
|
@ -2031,19 +2060,6 @@ void Clay__OpenTextElement(Clay_String text, Clay_TextElementConfig *textConfig)
|
||||||
parentElement->childrenOrTextContent.children.length++;
|
parentElement->childrenOrTextContent.children.length++;
|
||||||
}
|
}
|
||||||
|
|
||||||
Clay_ElementId Clay__AttachId(Clay_ElementId elementId) {
|
|
||||||
Clay_Context* context = Clay_GetCurrentContext();
|
|
||||||
if (context->booleanWarnings.maxElementsExceeded) {
|
|
||||||
return Clay_ElementId_DEFAULT;
|
|
||||||
}
|
|
||||||
Clay_LayoutElement *openLayoutElement = Clay__GetOpenLayoutElement();
|
|
||||||
uint32_t idAlias = openLayoutElement->id;
|
|
||||||
openLayoutElement->id = elementId.id;
|
|
||||||
Clay__AddHashMapItem(elementId, openLayoutElement, idAlias);
|
|
||||||
Clay__StringArray_Set(&context->layoutElementIdStrings, context->layoutElements.length - 1, elementId.stringId);
|
|
||||||
return elementId;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Clay__ConfigureOpenElementPtr(const Clay_ElementDeclaration *declaration) {
|
void Clay__ConfigureOpenElementPtr(const Clay_ElementDeclaration *declaration) {
|
||||||
Clay_Context* context = Clay_GetCurrentContext();
|
Clay_Context* context = Clay_GetCurrentContext();
|
||||||
Clay_LayoutElement *openLayoutElement = Clay__GetOpenLayoutElement();
|
Clay_LayoutElement *openLayoutElement = Clay__GetOpenLayoutElement();
|
||||||
|
@ -2055,8 +2071,6 @@ void Clay__ConfigureOpenElementPtr(const Clay_ElementDeclaration *declaration) {
|
||||||
.userData = context->errorHandler.userData });
|
.userData = context->errorHandler.userData });
|
||||||
}
|
}
|
||||||
|
|
||||||
Clay_ElementId openLayoutElementId = declaration->id;
|
|
||||||
|
|
||||||
openLayoutElement->elementConfigs.internalArray = &context->elementConfigs.internalArray[context->elementConfigs.length];
|
openLayoutElement->elementConfigs.internalArray = &context->elementConfigs.internalArray[context->elementConfigs.length];
|
||||||
Clay_SharedElementConfig *sharedConfig = NULL;
|
Clay_SharedElementConfig *sharedConfig = NULL;
|
||||||
if (declaration->backgroundColor.a > 0) {
|
if (declaration->backgroundColor.a > 0) {
|
||||||
|
@ -2111,9 +2125,6 @@ void Clay__ConfigureOpenElementPtr(const Clay_ElementDeclaration *declaration) {
|
||||||
} else if (declaration->floating.attachTo == CLAY_ATTACH_TO_ROOT) {
|
} else if (declaration->floating.attachTo == CLAY_ATTACH_TO_ROOT) {
|
||||||
floatingConfig.parentId = Clay__HashString(CLAY_STRING("Clay__RootContainer"), 0).id;
|
floatingConfig.parentId = Clay__HashString(CLAY_STRING("Clay__RootContainer"), 0).id;
|
||||||
}
|
}
|
||||||
if (!openLayoutElementId.id) {
|
|
||||||
openLayoutElementId = Clay__HashStringWithOffset(CLAY_STRING("Clay__FloatingContainer"), context->layoutElementTreeRoots.length, 0);
|
|
||||||
}
|
|
||||||
if (declaration->floating.clipTo == CLAY_CLIP_TO_NONE) {
|
if (declaration->floating.clipTo == CLAY_CLIP_TO_NONE) {
|
||||||
clipElementId = 0;
|
clipElementId = 0;
|
||||||
}
|
}
|
||||||
|
@ -2133,12 +2144,6 @@ void Clay__ConfigureOpenElementPtr(const Clay_ElementDeclaration *declaration) {
|
||||||
Clay__AttachElementConfig(CLAY__INIT(Clay_ElementConfigUnion) { .customElementConfig = Clay__StoreCustomElementConfig(declaration->custom) }, CLAY__ELEMENT_CONFIG_TYPE_CUSTOM);
|
Clay__AttachElementConfig(CLAY__INIT(Clay_ElementConfigUnion) { .customElementConfig = Clay__StoreCustomElementConfig(declaration->custom) }, CLAY__ELEMENT_CONFIG_TYPE_CUSTOM);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (openLayoutElementId.id != 0) {
|
|
||||||
Clay__AttachId(openLayoutElementId);
|
|
||||||
} else if (openLayoutElement->id == 0) {
|
|
||||||
openLayoutElementId = Clay__GenerateIdForAnonymousElement(openLayoutElement);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (declaration->clip.horizontal | declaration->clip.vertical) {
|
if (declaration->clip.horizontal | declaration->clip.vertical) {
|
||||||
Clay__AttachElementConfig(CLAY__INIT(Clay_ElementConfigUnion) { .clipElementConfig = Clay__StoreClipElementConfig(declaration->clip) }, CLAY__ELEMENT_CONFIG_TYPE_CLIP);
|
Clay__AttachElementConfig(CLAY__INIT(Clay_ElementConfigUnion) { .clipElementConfig = Clay__StoreClipElementConfig(declaration->clip) }, CLAY__ELEMENT_CONFIG_TYPE_CLIP);
|
||||||
Clay__int32_tArray_Add(&context->openClipElementStack, (int)openLayoutElement->id);
|
Clay__int32_tArray_Add(&context->openClipElementStack, (int)openLayoutElement->id);
|
||||||
|
@ -2787,12 +2792,6 @@ void Clay__CalculateFinalLayout(void) {
|
||||||
Clay_LayoutElementHashMapItem *hashMapItem = Clay__GetHashMapItem(currentElement->id);
|
Clay_LayoutElementHashMapItem *hashMapItem = Clay__GetHashMapItem(currentElement->id);
|
||||||
if (hashMapItem) {
|
if (hashMapItem) {
|
||||||
hashMapItem->boundingBox = currentElementBoundingBox;
|
hashMapItem->boundingBox = currentElementBoundingBox;
|
||||||
if (hashMapItem->idAlias) {
|
|
||||||
Clay_LayoutElementHashMapItem *hashMapItemAlias = Clay__GetHashMapItem(hashMapItem->idAlias);
|
|
||||||
if (hashMapItemAlias) {
|
|
||||||
hashMapItemAlias->boundingBox = currentElementBoundingBox;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t sortedConfigIndexes[20];
|
int32_t sortedConfigIndexes[20];
|
||||||
|
@ -3190,8 +3189,8 @@ Clay__RenderDebugLayoutData Clay__RenderDebugLayoutElementsList(int32_t initialR
|
||||||
Clay__int32_tArray_Add(&dfsBuffer, (int32_t)root->layoutElementIndex);
|
Clay__int32_tArray_Add(&dfsBuffer, (int32_t)root->layoutElementIndex);
|
||||||
context->treeNodeVisited.internalArray[0] = false;
|
context->treeNodeVisited.internalArray[0] = false;
|
||||||
if (rootIndex > 0) {
|
if (rootIndex > 0) {
|
||||||
CLAY({ .id = CLAY_IDI("Clay__DebugView_EmptyRowOuter", rootIndex), .layout = { .sizing = {.width = CLAY_SIZING_GROW(0)}, .padding = {CLAY__DEBUGVIEW_INDENT_WIDTH / 2, 0, 0, 0} } }) {
|
CLAY(CLAY_IDI("Clay__DebugView_EmptyRowOuter", rootIndex), { .layout = { .sizing = {.width = CLAY_SIZING_GROW(0)}, .padding = {CLAY__DEBUGVIEW_INDENT_WIDTH / 2, 0, 0, 0} } }) {
|
||||||
CLAY({ .id = CLAY_IDI("Clay__DebugView_EmptyRow", rootIndex), .layout = { .sizing = { .width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIXED((float)CLAY__DEBUGVIEW_ROW_HEIGHT) }}, .border = { .color = CLAY__DEBUGVIEW_COLOR_3, .width = { .top = 1 } } }) {}
|
CLAY(CLAY_IDI("Clay__DebugView_EmptyRow", rootIndex), { .layout = { .sizing = { .width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIXED((float)CLAY__DEBUGVIEW_ROW_HEIGHT) }}, .border = { .color = CLAY__DEBUGVIEW_COLOR_3, .width = { .top = 1 } } }) {}
|
||||||
}
|
}
|
||||||
layoutData.rowCount++;
|
layoutData.rowCount++;
|
||||||
}
|
}
|
||||||
|
@ -3221,11 +3220,10 @@ Clay__RenderDebugLayoutData Clay__RenderDebugLayoutElementsList(int32_t initialR
|
||||||
if (context->debugSelectedElementId == currentElement->id) {
|
if (context->debugSelectedElementId == currentElement->id) {
|
||||||
layoutData.selectedElementRowIndex = layoutData.rowCount;
|
layoutData.selectedElementRowIndex = layoutData.rowCount;
|
||||||
}
|
}
|
||||||
CLAY({ .id = CLAY_IDI("Clay__DebugView_ElementOuter", currentElement->id), .layout = Clay__DebugView_ScrollViewItemLayoutConfig }) {
|
CLAY(CLAY_IDI("Clay__DebugView_ElementOuter", currentElement->id), { .layout = Clay__DebugView_ScrollViewItemLayoutConfig }) {
|
||||||
// Collapse icon / button
|
// Collapse icon / button
|
||||||
if (!(Clay__ElementHasConfig(currentElement, CLAY__ELEMENT_CONFIG_TYPE_TEXT) || currentElement->childrenOrTextContent.children.length == 0)) {
|
if (!(Clay__ElementHasConfig(currentElement, CLAY__ELEMENT_CONFIG_TYPE_TEXT) || currentElement->childrenOrTextContent.children.length == 0)) {
|
||||||
CLAY({
|
CLAY(CLAY_IDI("Clay__DebugView_CollapseElement", currentElement->id), {
|
||||||
.id = CLAY_IDI("Clay__DebugView_CollapseElement", currentElement->id),
|
|
||||||
.layout = { .sizing = {CLAY_SIZING_FIXED(16), CLAY_SIZING_FIXED(16)}, .childAlignment = { CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_CENTER} },
|
.layout = { .sizing = {CLAY_SIZING_FIXED(16), CLAY_SIZING_FIXED(16)}, .childAlignment = { CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_CENTER} },
|
||||||
.cornerRadius = CLAY_CORNER_RADIUS(4),
|
.cornerRadius = CLAY_CORNER_RADIUS(4),
|
||||||
.border = { .color = CLAY__DEBUGVIEW_COLOR_3, .width = {1, 1, 1, 1, 0} },
|
.border = { .color = CLAY__DEBUGVIEW_COLOR_3, .width = {1, 1, 1, 1, 0} },
|
||||||
|
@ -3233,19 +3231,19 @@ Clay__RenderDebugLayoutData Clay__RenderDebugLayoutElementsList(int32_t initialR
|
||||||
CLAY_TEXT((currentElementData && currentElementData->debugData->collapsed) ? CLAY_STRING("+") : CLAY_STRING("-"), CLAY_TEXT_CONFIG({ .textColor = CLAY__DEBUGVIEW_COLOR_4, .fontSize = 16 }));
|
CLAY_TEXT((currentElementData && currentElementData->debugData->collapsed) ? CLAY_STRING("+") : CLAY_STRING("-"), CLAY_TEXT_CONFIG({ .textColor = CLAY__DEBUGVIEW_COLOR_4, .fontSize = 16 }));
|
||||||
}
|
}
|
||||||
} else { // Square dot for empty containers
|
} else { // Square dot for empty containers
|
||||||
CLAY({ .layout = { .sizing = {CLAY_SIZING_FIXED(16), CLAY_SIZING_FIXED(16)}, .childAlignment = { CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_CENTER } } }) {
|
CLAY_AUTO_ID({ .layout = { .sizing = {CLAY_SIZING_FIXED(16), CLAY_SIZING_FIXED(16)}, .childAlignment = { CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_CENTER } } }) {
|
||||||
CLAY({ .layout = { .sizing = {CLAY_SIZING_FIXED(8), CLAY_SIZING_FIXED(8)} }, .backgroundColor = CLAY__DEBUGVIEW_COLOR_3, .cornerRadius = CLAY_CORNER_RADIUS(2) }) {}
|
CLAY_AUTO_ID({ .layout = { .sizing = {CLAY_SIZING_FIXED(8), CLAY_SIZING_FIXED(8)} }, .backgroundColor = CLAY__DEBUGVIEW_COLOR_3, .cornerRadius = CLAY_CORNER_RADIUS(2) }) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Collisions and offscreen info
|
// Collisions and offscreen info
|
||||||
if (currentElementData) {
|
if (currentElementData) {
|
||||||
if (currentElementData->debugData->collision) {
|
if (currentElementData->debugData->collision) {
|
||||||
CLAY({ .layout = { .padding = { 8, 8, 2, 2 }}, .border = { .color = {177, 147, 8, 255}, .width = {1, 1, 1, 1, 0} } }) {
|
CLAY_AUTO_ID({ .layout = { .padding = { 8, 8, 2, 2 }}, .border = { .color = {177, 147, 8, 255}, .width = {1, 1, 1, 1, 0} } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("Duplicate ID"), CLAY_TEXT_CONFIG({ .textColor = CLAY__DEBUGVIEW_COLOR_3, .fontSize = 16 }));
|
CLAY_TEXT(CLAY_STRING("Duplicate ID"), CLAY_TEXT_CONFIG({ .textColor = CLAY__DEBUGVIEW_COLOR_3, .fontSize = 16 }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (offscreen) {
|
if (offscreen) {
|
||||||
CLAY({ .layout = { .padding = { 8, 8, 2, 2 } }, .border = { .color = CLAY__DEBUGVIEW_COLOR_3, .width = { 1, 1, 1, 1, 0} } }) {
|
CLAY_AUTO_ID({ .layout = { .padding = { 8, 8, 2, 2 } }, .border = { .color = CLAY__DEBUGVIEW_COLOR_3, .width = { 1, 1, 1, 1, 0} } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("Offscreen"), CLAY_TEXT_CONFIG({ .textColor = CLAY__DEBUGVIEW_COLOR_3, .fontSize = 16 }));
|
CLAY_TEXT(CLAY_STRING("Offscreen"), CLAY_TEXT_CONFIG({ .textColor = CLAY__DEBUGVIEW_COLOR_3, .fontSize = 16 }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3262,12 +3260,12 @@ Clay__RenderDebugLayoutData Clay__RenderDebugLayoutElementsList(int32_t initialR
|
||||||
Clay_Color backgroundColor = elementConfig->config.sharedElementConfig->backgroundColor;
|
Clay_Color backgroundColor = elementConfig->config.sharedElementConfig->backgroundColor;
|
||||||
Clay_CornerRadius radius = elementConfig->config.sharedElementConfig->cornerRadius;
|
Clay_CornerRadius radius = elementConfig->config.sharedElementConfig->cornerRadius;
|
||||||
if (backgroundColor.a > 0) {
|
if (backgroundColor.a > 0) {
|
||||||
CLAY({ .layout = { .padding = { 8, 8, 2, 2 } }, .backgroundColor = labelColor, .cornerRadius = CLAY_CORNER_RADIUS(4), .border = { .color = labelColor, .width = { 1, 1, 1, 1, 0} } }) {
|
CLAY_AUTO_ID({ .layout = { .padding = { 8, 8, 2, 2 } }, .backgroundColor = labelColor, .cornerRadius = CLAY_CORNER_RADIUS(4), .border = { .color = labelColor, .width = { 1, 1, 1, 1, 0} } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("Color"), CLAY_TEXT_CONFIG({ .textColor = offscreen ? CLAY__DEBUGVIEW_COLOR_3 : CLAY__DEBUGVIEW_COLOR_4, .fontSize = 16 }));
|
CLAY_TEXT(CLAY_STRING("Color"), CLAY_TEXT_CONFIG({ .textColor = offscreen ? CLAY__DEBUGVIEW_COLOR_3 : CLAY__DEBUGVIEW_COLOR_4, .fontSize = 16 }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (radius.bottomLeft > 0) {
|
if (radius.bottomLeft > 0) {
|
||||||
CLAY({ .layout = { .padding = { 8, 8, 2, 2 } }, .backgroundColor = labelColor, .cornerRadius = CLAY_CORNER_RADIUS(4), .border = { .color = labelColor, .width = { 1, 1, 1, 1, 0 } } }) {
|
CLAY_AUTO_ID({ .layout = { .padding = { 8, 8, 2, 2 } }, .backgroundColor = labelColor, .cornerRadius = CLAY_CORNER_RADIUS(4), .border = { .color = labelColor, .width = { 1, 1, 1, 1, 0 } } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("Radius"), CLAY_TEXT_CONFIG({ .textColor = offscreen ? CLAY__DEBUGVIEW_COLOR_3 : CLAY__DEBUGVIEW_COLOR_4, .fontSize = 16 }));
|
CLAY_TEXT(CLAY_STRING("Radius"), CLAY_TEXT_CONFIG({ .textColor = offscreen ? CLAY__DEBUGVIEW_COLOR_3 : CLAY__DEBUGVIEW_COLOR_4, .fontSize = 16 }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3276,7 +3274,7 @@ Clay__RenderDebugLayoutData Clay__RenderDebugLayoutElementsList(int32_t initialR
|
||||||
Clay__DebugElementConfigTypeLabelConfig config = Clay__DebugGetElementConfigTypeLabel(elementConfig->type);
|
Clay__DebugElementConfigTypeLabelConfig config = Clay__DebugGetElementConfigTypeLabel(elementConfig->type);
|
||||||
Clay_Color backgroundColor = config.color;
|
Clay_Color backgroundColor = config.color;
|
||||||
backgroundColor.a = 90;
|
backgroundColor.a = 90;
|
||||||
CLAY({ .layout = { .padding = { 8, 8, 2, 2 } }, .backgroundColor = backgroundColor, .cornerRadius = CLAY_CORNER_RADIUS(4), .border = { .color = config.color, .width = { 1, 1, 1, 1, 0 } } }) {
|
CLAY_AUTO_ID({ .layout = { .padding = { 8, 8, 2, 2 } }, .backgroundColor = backgroundColor, .cornerRadius = CLAY_CORNER_RADIUS(4), .border = { .color = config.color, .width = { 1, 1, 1, 1, 0 } } }) {
|
||||||
CLAY_TEXT(config.label, CLAY_TEXT_CONFIG({ .textColor = offscreen ? CLAY__DEBUGVIEW_COLOR_3 : CLAY__DEBUGVIEW_COLOR_4, .fontSize = 16 }));
|
CLAY_TEXT(config.label, CLAY_TEXT_CONFIG({ .textColor = offscreen ? CLAY__DEBUGVIEW_COLOR_3 : CLAY__DEBUGVIEW_COLOR_4, .fontSize = 16 }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3287,8 +3285,8 @@ Clay__RenderDebugLayoutData Clay__RenderDebugLayoutElementsList(int32_t initialR
|
||||||
layoutData.rowCount++;
|
layoutData.rowCount++;
|
||||||
Clay__TextElementData *textElementData = currentElement->childrenOrTextContent.textElementData;
|
Clay__TextElementData *textElementData = currentElement->childrenOrTextContent.textElementData;
|
||||||
Clay_TextElementConfig *rawTextConfig = offscreen ? CLAY_TEXT_CONFIG({ .textColor = CLAY__DEBUGVIEW_COLOR_3, .fontSize = 16 }) : &Clay__DebugView_TextNameConfig;
|
Clay_TextElementConfig *rawTextConfig = offscreen ? CLAY_TEXT_CONFIG({ .textColor = CLAY__DEBUGVIEW_COLOR_3, .fontSize = 16 }) : &Clay__DebugView_TextNameConfig;
|
||||||
CLAY({ .layout = { .sizing = { .height = CLAY_SIZING_FIXED(CLAY__DEBUGVIEW_ROW_HEIGHT)}, .childAlignment = { .y = CLAY_ALIGN_Y_CENTER } } }) {
|
CLAY_AUTO_ID({ .layout = { .sizing = { .height = CLAY_SIZING_FIXED(CLAY__DEBUGVIEW_ROW_HEIGHT)}, .childAlignment = { .y = CLAY_ALIGN_Y_CENTER } } }) {
|
||||||
CLAY({ .layout = { .sizing = {.width = CLAY_SIZING_FIXED(CLAY__DEBUGVIEW_INDENT_WIDTH + 16) } } }) {}
|
CLAY_AUTO_ID({ .layout = { .sizing = {.width = CLAY_SIZING_FIXED(CLAY__DEBUGVIEW_INDENT_WIDTH + 16) } } }) {}
|
||||||
CLAY_TEXT(CLAY_STRING("\""), rawTextConfig);
|
CLAY_TEXT(CLAY_STRING("\""), rawTextConfig);
|
||||||
CLAY_TEXT(textElementData->text.length > 40 ? (CLAY__INIT(Clay_String) { .length = 40, .chars = textElementData->text.chars }) : textElementData->text, rawTextConfig);
|
CLAY_TEXT(textElementData->text.length > 40 ? (CLAY__INIT(Clay_String) { .length = 40, .chars = textElementData->text.chars }) : textElementData->text, rawTextConfig);
|
||||||
if (textElementData->text.length > 40) {
|
if (textElementData->text.length > 40) {
|
||||||
|
@ -3328,8 +3326,8 @@ Clay__RenderDebugLayoutData Clay__RenderDebugLayoutElementsList(int32_t initialR
|
||||||
}
|
}
|
||||||
|
|
||||||
if (highlightedElementId) {
|
if (highlightedElementId) {
|
||||||
CLAY({ .id = CLAY_ID("Clay__DebugView_ElementHighlight"), .layout = { .sizing = {CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0)} }, .floating = { .parentId = highlightedElementId, .zIndex = 32767, .pointerCaptureMode = CLAY_POINTER_CAPTURE_MODE_PASSTHROUGH, .attachTo = CLAY_ATTACH_TO_ELEMENT_WITH_ID } }) {
|
CLAY(CLAY_ID("Clay__DebugView_ElementHighlight"), { .layout = { .sizing = {CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0)} }, .floating = { .parentId = highlightedElementId, .zIndex = 32767, .pointerCaptureMode = CLAY_POINTER_CAPTURE_MODE_PASSTHROUGH, .attachTo = CLAY_ATTACH_TO_ELEMENT_WITH_ID } }) {
|
||||||
CLAY({ .id = CLAY_ID("Clay__DebugView_ElementHighlightRectangle"), .layout = { .sizing = {CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0)} }, .backgroundColor = Clay__debugViewHighlightColor }) {}
|
CLAY(CLAY_ID("Clay__DebugView_ElementHighlightRectangle"), { .layout = { .sizing = {CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0)} }, .backgroundColor = Clay__debugViewHighlightColor }) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return layoutData;
|
return layoutData;
|
||||||
|
@ -3370,17 +3368,17 @@ void Clay__RenderDebugViewElementConfigHeader(Clay_String elementId, Clay__Eleme
|
||||||
Clay__DebugElementConfigTypeLabelConfig config = Clay__DebugGetElementConfigTypeLabel(type);
|
Clay__DebugElementConfigTypeLabelConfig config = Clay__DebugGetElementConfigTypeLabel(type);
|
||||||
Clay_Color backgroundColor = config.color;
|
Clay_Color backgroundColor = config.color;
|
||||||
backgroundColor.a = 90;
|
backgroundColor.a = 90;
|
||||||
CLAY({ .layout = { .sizing = { .width = CLAY_SIZING_GROW(0) }, .padding = CLAY_PADDING_ALL(CLAY__DEBUGVIEW_OUTER_PADDING), .childAlignment = { .y = CLAY_ALIGN_Y_CENTER } } }) {
|
CLAY_AUTO_ID({ .layout = { .sizing = { .width = CLAY_SIZING_GROW(0) }, .padding = CLAY_PADDING_ALL(CLAY__DEBUGVIEW_OUTER_PADDING), .childAlignment = { .y = CLAY_ALIGN_Y_CENTER } } }) {
|
||||||
CLAY({ .layout = { .padding = { 8, 8, 2, 2 } }, .backgroundColor = backgroundColor, .cornerRadius = CLAY_CORNER_RADIUS(4), .border = { .color = config.color, .width = { 1, 1, 1, 1, 0 } } }) {
|
CLAY_AUTO_ID({ .layout = { .padding = { 8, 8, 2, 2 } }, .backgroundColor = backgroundColor, .cornerRadius = CLAY_CORNER_RADIUS(4), .border = { .color = config.color, .width = { 1, 1, 1, 1, 0 } } }) {
|
||||||
CLAY_TEXT(config.label, CLAY_TEXT_CONFIG({ .textColor = CLAY__DEBUGVIEW_COLOR_4, .fontSize = 16 }));
|
CLAY_TEXT(config.label, CLAY_TEXT_CONFIG({ .textColor = CLAY__DEBUGVIEW_COLOR_4, .fontSize = 16 }));
|
||||||
}
|
}
|
||||||
CLAY({ .layout = { .sizing = { .width = CLAY_SIZING_GROW(0) } } }) {}
|
CLAY_AUTO_ID({ .layout = { .sizing = { .width = CLAY_SIZING_GROW(0) } } }) {}
|
||||||
CLAY_TEXT(elementId, CLAY_TEXT_CONFIG({ .textColor = CLAY__DEBUGVIEW_COLOR_3, .fontSize = 16, .wrapMode = CLAY_TEXT_WRAP_NONE }));
|
CLAY_TEXT(elementId, CLAY_TEXT_CONFIG({ .textColor = CLAY__DEBUGVIEW_COLOR_3, .fontSize = 16, .wrapMode = CLAY_TEXT_WRAP_NONE }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clay__RenderDebugViewColor(Clay_Color color, Clay_TextElementConfig *textConfig) {
|
void Clay__RenderDebugViewColor(Clay_Color color, Clay_TextElementConfig *textConfig) {
|
||||||
CLAY({ .layout = { .childAlignment = {.y = CLAY_ALIGN_Y_CENTER} } }) {
|
CLAY_AUTO_ID({ .layout = { .childAlignment = {.y = CLAY_ALIGN_Y_CENTER} } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("{ r: "), textConfig);
|
CLAY_TEXT(CLAY_STRING("{ r: "), textConfig);
|
||||||
CLAY_TEXT(Clay__IntToString(color.r), textConfig);
|
CLAY_TEXT(Clay__IntToString(color.r), textConfig);
|
||||||
CLAY_TEXT(CLAY_STRING(", g: "), textConfig);
|
CLAY_TEXT(CLAY_STRING(", g: "), textConfig);
|
||||||
|
@ -3390,13 +3388,13 @@ void Clay__RenderDebugViewColor(Clay_Color color, Clay_TextElementConfig *textCo
|
||||||
CLAY_TEXT(CLAY_STRING(", a: "), textConfig);
|
CLAY_TEXT(CLAY_STRING(", a: "), textConfig);
|
||||||
CLAY_TEXT(Clay__IntToString(color.a), textConfig);
|
CLAY_TEXT(Clay__IntToString(color.a), textConfig);
|
||||||
CLAY_TEXT(CLAY_STRING(" }"), textConfig);
|
CLAY_TEXT(CLAY_STRING(" }"), textConfig);
|
||||||
CLAY({ .layout = { .sizing = { .width = CLAY_SIZING_FIXED(10) } } }) {}
|
CLAY_AUTO_ID({ .layout = { .sizing = { .width = CLAY_SIZING_FIXED(10) } } }) {}
|
||||||
CLAY({ .layout = { .sizing = { CLAY_SIZING_FIXED(CLAY__DEBUGVIEW_ROW_HEIGHT - 8), CLAY_SIZING_FIXED(CLAY__DEBUGVIEW_ROW_HEIGHT - 8)} }, .backgroundColor = color, .cornerRadius = CLAY_CORNER_RADIUS(4), .border = { .color = CLAY__DEBUGVIEW_COLOR_4, .width = { 1, 1, 1, 1, 0 } } }) {}
|
CLAY_AUTO_ID({ .layout = { .sizing = { CLAY_SIZING_FIXED(CLAY__DEBUGVIEW_ROW_HEIGHT - 8), CLAY_SIZING_FIXED(CLAY__DEBUGVIEW_ROW_HEIGHT - 8)} }, .backgroundColor = color, .cornerRadius = CLAY_CORNER_RADIUS(4), .border = { .color = CLAY__DEBUGVIEW_COLOR_4, .width = { 1, 1, 1, 1, 0 } } }) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clay__RenderDebugViewCornerRadius(Clay_CornerRadius cornerRadius, Clay_TextElementConfig *textConfig) {
|
void Clay__RenderDebugViewCornerRadius(Clay_CornerRadius cornerRadius, Clay_TextElementConfig *textConfig) {
|
||||||
CLAY({ .layout = { .childAlignment = {.y = CLAY_ALIGN_Y_CENTER} } }) {
|
CLAY_AUTO_ID({ .layout = { .childAlignment = {.y = CLAY_ALIGN_Y_CENTER} } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("{ topLeft: "), textConfig);
|
CLAY_TEXT(CLAY_STRING("{ topLeft: "), textConfig);
|
||||||
CLAY_TEXT(Clay__IntToString(cornerRadius.topLeft), textConfig);
|
CLAY_TEXT(Clay__IntToString(cornerRadius.topLeft), textConfig);
|
||||||
CLAY_TEXT(CLAY_STRING(", topRight: "), textConfig);
|
CLAY_TEXT(CLAY_STRING(", topRight: "), textConfig);
|
||||||
|
@ -3455,16 +3453,16 @@ void Clay__RenderDebugView(void) {
|
||||||
highlightedRow = -1;
|
highlightedRow = -1;
|
||||||
}
|
}
|
||||||
Clay__RenderDebugLayoutData layoutData = CLAY__DEFAULT_STRUCT;
|
Clay__RenderDebugLayoutData layoutData = CLAY__DEFAULT_STRUCT;
|
||||||
CLAY({ .id = CLAY_ID("Clay__DebugView"),
|
CLAY(CLAY_ID("Clay__DebugView"), {
|
||||||
.layout = { .sizing = { CLAY_SIZING_FIXED((float)Clay__debugViewWidth) , CLAY_SIZING_FIXED(context->layoutDimensions.height) }, .layoutDirection = CLAY_TOP_TO_BOTTOM },
|
.layout = { .sizing = { CLAY_SIZING_FIXED((float)Clay__debugViewWidth) , CLAY_SIZING_FIXED(context->layoutDimensions.height) }, .layoutDirection = CLAY_TOP_TO_BOTTOM },
|
||||||
.floating = { .zIndex = 32765, .attachPoints = { .element = CLAY_ATTACH_POINT_LEFT_CENTER, .parent = CLAY_ATTACH_POINT_RIGHT_CENTER }, .attachTo = CLAY_ATTACH_TO_ROOT, .clipTo = CLAY_CLIP_TO_ATTACHED_PARENT },
|
.floating = { .zIndex = 32765, .attachPoints = { .element = CLAY_ATTACH_POINT_LEFT_CENTER, .parent = CLAY_ATTACH_POINT_RIGHT_CENTER }, .attachTo = CLAY_ATTACH_TO_ROOT, .clipTo = CLAY_CLIP_TO_ATTACHED_PARENT },
|
||||||
.border = { .color = CLAY__DEBUGVIEW_COLOR_3, .width = { .bottom = 1 } }
|
.border = { .color = CLAY__DEBUGVIEW_COLOR_3, .width = { .bottom = 1 } }
|
||||||
}) {
|
}) {
|
||||||
CLAY({ .layout = { .sizing = {CLAY_SIZING_GROW(0), CLAY_SIZING_FIXED(CLAY__DEBUGVIEW_ROW_HEIGHT)}, .padding = {CLAY__DEBUGVIEW_OUTER_PADDING, CLAY__DEBUGVIEW_OUTER_PADDING, 0, 0 }, .childAlignment = {.y = CLAY_ALIGN_Y_CENTER} }, .backgroundColor = CLAY__DEBUGVIEW_COLOR_2 }) {
|
CLAY_AUTO_ID({ .layout = { .sizing = {CLAY_SIZING_GROW(0), CLAY_SIZING_FIXED(CLAY__DEBUGVIEW_ROW_HEIGHT)}, .padding = {CLAY__DEBUGVIEW_OUTER_PADDING, CLAY__DEBUGVIEW_OUTER_PADDING, 0, 0 }, .childAlignment = {.y = CLAY_ALIGN_Y_CENTER} }, .backgroundColor = CLAY__DEBUGVIEW_COLOR_2 }) {
|
||||||
CLAY_TEXT(CLAY_STRING("Clay Debug Tools"), infoTextConfig);
|
CLAY_TEXT(CLAY_STRING("Clay Debug Tools"), infoTextConfig);
|
||||||
CLAY({ .layout = { .sizing = { .width = CLAY_SIZING_GROW(0) } } }) {}
|
CLAY_AUTO_ID({ .layout = { .sizing = { .width = CLAY_SIZING_GROW(0) } } }) {}
|
||||||
// Close button
|
// Close button
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = { .sizing = {CLAY_SIZING_FIXED(CLAY__DEBUGVIEW_ROW_HEIGHT - 10), CLAY_SIZING_FIXED(CLAY__DEBUGVIEW_ROW_HEIGHT - 10)}, .childAlignment = {CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_CENTER} },
|
.layout = { .sizing = {CLAY_SIZING_FIXED(CLAY__DEBUGVIEW_ROW_HEIGHT - 10), CLAY_SIZING_FIXED(CLAY__DEBUGVIEW_ROW_HEIGHT - 10)}, .childAlignment = {CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_CENTER} },
|
||||||
.backgroundColor = {217,91,67,80},
|
.backgroundColor = {217,91,67,80},
|
||||||
.cornerRadius = CLAY_CORNER_RADIUS(4),
|
.cornerRadius = CLAY_CORNER_RADIUS(4),
|
||||||
|
@ -3474,18 +3472,18 @@ void Clay__RenderDebugView(void) {
|
||||||
CLAY_TEXT(CLAY_STRING("x"), CLAY_TEXT_CONFIG({ .textColor = CLAY__DEBUGVIEW_COLOR_4, .fontSize = 16 }));
|
CLAY_TEXT(CLAY_STRING("x"), CLAY_TEXT_CONFIG({ .textColor = CLAY__DEBUGVIEW_COLOR_4, .fontSize = 16 }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CLAY({ .layout = { .sizing = {CLAY_SIZING_GROW(0), CLAY_SIZING_FIXED(1)} }, .backgroundColor = CLAY__DEBUGVIEW_COLOR_3 } ) {}
|
CLAY_AUTO_ID({ .layout = { .sizing = {CLAY_SIZING_GROW(0), CLAY_SIZING_FIXED(1)} }, .backgroundColor = CLAY__DEBUGVIEW_COLOR_3 } ) {}
|
||||||
CLAY({ .id = scrollId, .layout = { .sizing = {CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0)} }, .clip = { .horizontal = true, .vertical = true, .childOffset = Clay_GetScrollOffset() } }) {
|
CLAY(scrollId, { .layout = { .sizing = {CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0)} }, .clip = { .horizontal = true, .vertical = true, .childOffset = Clay_GetScrollOffset() } }) {
|
||||||
CLAY({ .layout = { .sizing = {CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0)}, .layoutDirection = CLAY_TOP_TO_BOTTOM }, .backgroundColor = ((initialElementsLength + initialRootsLength) & 1) == 0 ? CLAY__DEBUGVIEW_COLOR_2 : CLAY__DEBUGVIEW_COLOR_1 }) {
|
CLAY_AUTO_ID({ .layout = { .sizing = {CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0)}, .layoutDirection = CLAY_TOP_TO_BOTTOM }, .backgroundColor = ((initialElementsLength + initialRootsLength) & 1) == 0 ? CLAY__DEBUGVIEW_COLOR_2 : CLAY__DEBUGVIEW_COLOR_1 }) {
|
||||||
Clay_ElementId panelContentsId = Clay__HashString(CLAY_STRING("Clay__DebugViewPaneOuter"), 0);
|
Clay_ElementId panelContentsId = Clay__HashString(CLAY_STRING("Clay__DebugViewPaneOuter"), 0);
|
||||||
// Element list
|
// Element list
|
||||||
CLAY({ .id = panelContentsId, .layout = { .sizing = {CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0)} }, .floating = { .zIndex = 32766, .pointerCaptureMode = CLAY_POINTER_CAPTURE_MODE_PASSTHROUGH, .attachTo = CLAY_ATTACH_TO_PARENT, .clipTo = CLAY_CLIP_TO_ATTACHED_PARENT } }) {
|
CLAY(panelContentsId, { .layout = { .sizing = {CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0)} }, .floating = { .zIndex = 32766, .pointerCaptureMode = CLAY_POINTER_CAPTURE_MODE_PASSTHROUGH, .attachTo = CLAY_ATTACH_TO_PARENT, .clipTo = CLAY_CLIP_TO_ATTACHED_PARENT } }) {
|
||||||
CLAY({ .layout = { .sizing = {CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0)}, .padding = { CLAY__DEBUGVIEW_OUTER_PADDING, CLAY__DEBUGVIEW_OUTER_PADDING, 0, 0 }, .layoutDirection = CLAY_TOP_TO_BOTTOM } }) {
|
CLAY_AUTO_ID({ .layout = { .sizing = {CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0)}, .padding = { CLAY__DEBUGVIEW_OUTER_PADDING, CLAY__DEBUGVIEW_OUTER_PADDING, 0, 0 }, .layoutDirection = CLAY_TOP_TO_BOTTOM } }) {
|
||||||
layoutData = Clay__RenderDebugLayoutElementsList((int32_t)initialRootsLength, highlightedRow);
|
layoutData = Clay__RenderDebugLayoutElementsList((int32_t)initialRootsLength, highlightedRow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
float contentWidth = Clay__GetHashMapItem(panelContentsId.id)->layoutElement->dimensions.width;
|
float contentWidth = Clay__GetHashMapItem(panelContentsId.id)->layoutElement->dimensions.width;
|
||||||
CLAY({ .layout = { .sizing = {.width = CLAY_SIZING_FIXED(contentWidth) }, .layoutDirection = CLAY_TOP_TO_BOTTOM } }) {}
|
CLAY_AUTO_ID({ .layout = { .sizing = {.width = CLAY_SIZING_FIXED(contentWidth) }, .layoutDirection = CLAY_TOP_TO_BOTTOM } }) {}
|
||||||
for (int32_t i = 0; i < layoutData.rowCount; i++) {
|
for (int32_t i = 0; i < layoutData.rowCount; i++) {
|
||||||
Clay_Color rowColor = (i & 1) == 0 ? CLAY__DEBUGVIEW_COLOR_2 : CLAY__DEBUGVIEW_COLOR_1;
|
Clay_Color rowColor = (i & 1) == 0 ? CLAY__DEBUGVIEW_COLOR_2 : CLAY__DEBUGVIEW_COLOR_1;
|
||||||
if (i == layoutData.selectedElementRowIndex) {
|
if (i == layoutData.selectedElementRowIndex) {
|
||||||
|
@ -3496,22 +3494,22 @@ void Clay__RenderDebugView(void) {
|
||||||
rowColor.g *= 1.25f;
|
rowColor.g *= 1.25f;
|
||||||
rowColor.b *= 1.25f;
|
rowColor.b *= 1.25f;
|
||||||
}
|
}
|
||||||
CLAY({ .layout = { .sizing = {CLAY_SIZING_GROW(0), CLAY_SIZING_FIXED(CLAY__DEBUGVIEW_ROW_HEIGHT)}, .layoutDirection = CLAY_TOP_TO_BOTTOM }, .backgroundColor = rowColor } ) {}
|
CLAY_AUTO_ID({ .layout = { .sizing = {CLAY_SIZING_GROW(0), CLAY_SIZING_FIXED(CLAY__DEBUGVIEW_ROW_HEIGHT)}, .layoutDirection = CLAY_TOP_TO_BOTTOM }, .backgroundColor = rowColor } ) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CLAY({ .layout = { .sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIXED(1)} }, .backgroundColor = CLAY__DEBUGVIEW_COLOR_3 }) {}
|
CLAY_AUTO_ID({ .layout = { .sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIXED(1)} }, .backgroundColor = CLAY__DEBUGVIEW_COLOR_3 }) {}
|
||||||
if (context->debugSelectedElementId != 0) {
|
if (context->debugSelectedElementId != 0) {
|
||||||
Clay_LayoutElementHashMapItem *selectedItem = Clay__GetHashMapItem(context->debugSelectedElementId);
|
Clay_LayoutElementHashMapItem *selectedItem = Clay__GetHashMapItem(context->debugSelectedElementId);
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = { .sizing = {CLAY_SIZING_GROW(0), CLAY_SIZING_FIXED(300)}, .layoutDirection = CLAY_TOP_TO_BOTTOM },
|
.layout = { .sizing = {CLAY_SIZING_GROW(0), CLAY_SIZING_FIXED(300)}, .layoutDirection = CLAY_TOP_TO_BOTTOM },
|
||||||
.backgroundColor = CLAY__DEBUGVIEW_COLOR_2 ,
|
.backgroundColor = CLAY__DEBUGVIEW_COLOR_2 ,
|
||||||
.clip = { .vertical = true, .childOffset = Clay_GetScrollOffset() },
|
.clip = { .vertical = true, .childOffset = Clay_GetScrollOffset() },
|
||||||
.border = { .color = CLAY__DEBUGVIEW_COLOR_3, .width = { .betweenChildren = 1 } }
|
.border = { .color = CLAY__DEBUGVIEW_COLOR_3, .width = { .betweenChildren = 1 } }
|
||||||
}) {
|
}) {
|
||||||
CLAY({ .layout = { .sizing = {CLAY_SIZING_GROW(0), CLAY_SIZING_FIXED(CLAY__DEBUGVIEW_ROW_HEIGHT + 8)}, .padding = {CLAY__DEBUGVIEW_OUTER_PADDING, CLAY__DEBUGVIEW_OUTER_PADDING, 0, 0 }, .childAlignment = {.y = CLAY_ALIGN_Y_CENTER} } }) {
|
CLAY_AUTO_ID({ .layout = { .sizing = {CLAY_SIZING_GROW(0), CLAY_SIZING_FIXED(CLAY__DEBUGVIEW_ROW_HEIGHT + 8)}, .padding = {CLAY__DEBUGVIEW_OUTER_PADDING, CLAY__DEBUGVIEW_OUTER_PADDING, 0, 0 }, .childAlignment = {.y = CLAY_ALIGN_Y_CENTER} } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("Layout Config"), infoTextConfig);
|
CLAY_TEXT(CLAY_STRING("Layout Config"), infoTextConfig);
|
||||||
CLAY({ .layout = { .sizing = { .width = CLAY_SIZING_GROW(0) } } }) {}
|
CLAY_AUTO_ID({ .layout = { .sizing = { .width = CLAY_SIZING_GROW(0) } } }) {}
|
||||||
if (selectedItem->elementId.stringId.length != 0) {
|
if (selectedItem->elementId.stringId.length != 0) {
|
||||||
CLAY_TEXT(selectedItem->elementId.stringId, infoTitleConfig);
|
CLAY_TEXT(selectedItem->elementId.stringId, infoTitleConfig);
|
||||||
if (selectedItem->elementId.offset != 0) {
|
if (selectedItem->elementId.offset != 0) {
|
||||||
|
@ -3523,10 +3521,10 @@ void Clay__RenderDebugView(void) {
|
||||||
}
|
}
|
||||||
Clay_Padding attributeConfigPadding = {CLAY__DEBUGVIEW_OUTER_PADDING, CLAY__DEBUGVIEW_OUTER_PADDING, 8, 8};
|
Clay_Padding attributeConfigPadding = {CLAY__DEBUGVIEW_OUTER_PADDING, CLAY__DEBUGVIEW_OUTER_PADDING, 8, 8};
|
||||||
// Clay_LayoutConfig debug info
|
// Clay_LayoutConfig debug info
|
||||||
CLAY({ .layout = { .padding = attributeConfigPadding, .childGap = 8, .layoutDirection = CLAY_TOP_TO_BOTTOM } }) {
|
CLAY_AUTO_ID({ .layout = { .padding = attributeConfigPadding, .childGap = 8, .layoutDirection = CLAY_TOP_TO_BOTTOM } }) {
|
||||||
// .boundingBox
|
// .boundingBox
|
||||||
CLAY_TEXT(CLAY_STRING("Bounding Box"), infoTitleConfig);
|
CLAY_TEXT(CLAY_STRING("Bounding Box"), infoTitleConfig);
|
||||||
CLAY({ .layout = { .layoutDirection = CLAY_LEFT_TO_RIGHT } }) {
|
CLAY_AUTO_ID({ .layout = { .layoutDirection = CLAY_LEFT_TO_RIGHT } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("{ x: "), infoTextConfig);
|
CLAY_TEXT(CLAY_STRING("{ x: "), infoTextConfig);
|
||||||
CLAY_TEXT(Clay__IntToString(selectedItem->boundingBox.x), infoTextConfig);
|
CLAY_TEXT(Clay__IntToString(selectedItem->boundingBox.x), infoTextConfig);
|
||||||
CLAY_TEXT(CLAY_STRING(", y: "), infoTextConfig);
|
CLAY_TEXT(CLAY_STRING(", y: "), infoTextConfig);
|
||||||
|
@ -3543,17 +3541,17 @@ void Clay__RenderDebugView(void) {
|
||||||
CLAY_TEXT(layoutConfig->layoutDirection == CLAY_TOP_TO_BOTTOM ? CLAY_STRING("TOP_TO_BOTTOM") : CLAY_STRING("LEFT_TO_RIGHT"), infoTextConfig);
|
CLAY_TEXT(layoutConfig->layoutDirection == CLAY_TOP_TO_BOTTOM ? CLAY_STRING("TOP_TO_BOTTOM") : CLAY_STRING("LEFT_TO_RIGHT"), infoTextConfig);
|
||||||
// .sizing
|
// .sizing
|
||||||
CLAY_TEXT(CLAY_STRING("Sizing"), infoTitleConfig);
|
CLAY_TEXT(CLAY_STRING("Sizing"), infoTitleConfig);
|
||||||
CLAY({ .layout = { .layoutDirection = CLAY_LEFT_TO_RIGHT } }) {
|
CLAY_AUTO_ID({ .layout = { .layoutDirection = CLAY_LEFT_TO_RIGHT } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("width: "), infoTextConfig);
|
CLAY_TEXT(CLAY_STRING("width: "), infoTextConfig);
|
||||||
Clay__RenderDebugLayoutSizing(layoutConfig->sizing.width, infoTextConfig);
|
Clay__RenderDebugLayoutSizing(layoutConfig->sizing.width, infoTextConfig);
|
||||||
}
|
}
|
||||||
CLAY({ .layout = { .layoutDirection = CLAY_LEFT_TO_RIGHT } }) {
|
CLAY_AUTO_ID({ .layout = { .layoutDirection = CLAY_LEFT_TO_RIGHT } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("height: "), infoTextConfig);
|
CLAY_TEXT(CLAY_STRING("height: "), infoTextConfig);
|
||||||
Clay__RenderDebugLayoutSizing(layoutConfig->sizing.height, infoTextConfig);
|
Clay__RenderDebugLayoutSizing(layoutConfig->sizing.height, infoTextConfig);
|
||||||
}
|
}
|
||||||
// .padding
|
// .padding
|
||||||
CLAY_TEXT(CLAY_STRING("Padding"), infoTitleConfig);
|
CLAY_TEXT(CLAY_STRING("Padding"), infoTitleConfig);
|
||||||
CLAY({ .id = CLAY_ID("Clay__DebugViewElementInfoPadding") }) {
|
CLAY(CLAY_ID("Clay__DebugViewElementInfoPadding"), { }) {
|
||||||
CLAY_TEXT(CLAY_STRING("{ left: "), infoTextConfig);
|
CLAY_TEXT(CLAY_STRING("{ left: "), infoTextConfig);
|
||||||
CLAY_TEXT(Clay__IntToString(layoutConfig->padding.left), infoTextConfig);
|
CLAY_TEXT(Clay__IntToString(layoutConfig->padding.left), infoTextConfig);
|
||||||
CLAY_TEXT(CLAY_STRING(", right: "), infoTextConfig);
|
CLAY_TEXT(CLAY_STRING(", right: "), infoTextConfig);
|
||||||
|
@ -3569,7 +3567,7 @@ void Clay__RenderDebugView(void) {
|
||||||
CLAY_TEXT(Clay__IntToString(layoutConfig->childGap), infoTextConfig);
|
CLAY_TEXT(Clay__IntToString(layoutConfig->childGap), infoTextConfig);
|
||||||
// .childAlignment
|
// .childAlignment
|
||||||
CLAY_TEXT(CLAY_STRING("Child Alignment"), infoTitleConfig);
|
CLAY_TEXT(CLAY_STRING("Child Alignment"), infoTitleConfig);
|
||||||
CLAY({ .layout = { .layoutDirection = CLAY_LEFT_TO_RIGHT } }) {
|
CLAY_AUTO_ID({ .layout = { .layoutDirection = CLAY_LEFT_TO_RIGHT } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("{ x: "), infoTextConfig);
|
CLAY_TEXT(CLAY_STRING("{ x: "), infoTextConfig);
|
||||||
Clay_String alignX = CLAY_STRING("LEFT");
|
Clay_String alignX = CLAY_STRING("LEFT");
|
||||||
if (layoutConfig->childAlignment.x == CLAY_ALIGN_X_CENTER) {
|
if (layoutConfig->childAlignment.x == CLAY_ALIGN_X_CENTER) {
|
||||||
|
@ -3595,7 +3593,7 @@ void Clay__RenderDebugView(void) {
|
||||||
switch (elementConfig->type) {
|
switch (elementConfig->type) {
|
||||||
case CLAY__ELEMENT_CONFIG_TYPE_SHARED: {
|
case CLAY__ELEMENT_CONFIG_TYPE_SHARED: {
|
||||||
Clay_SharedElementConfig *sharedConfig = elementConfig->config.sharedElementConfig;
|
Clay_SharedElementConfig *sharedConfig = elementConfig->config.sharedElementConfig;
|
||||||
CLAY({ .layout = { .padding = attributeConfigPadding, .childGap = 8, .layoutDirection = CLAY_TOP_TO_BOTTOM }}) {
|
CLAY_AUTO_ID({ .layout = { .padding = attributeConfigPadding, .childGap = 8, .layoutDirection = CLAY_TOP_TO_BOTTOM }}) {
|
||||||
// .backgroundColor
|
// .backgroundColor
|
||||||
CLAY_TEXT(CLAY_STRING("Background Color"), infoTitleConfig);
|
CLAY_TEXT(CLAY_STRING("Background Color"), infoTitleConfig);
|
||||||
Clay__RenderDebugViewColor(sharedConfig->backgroundColor, infoTextConfig);
|
Clay__RenderDebugViewColor(sharedConfig->backgroundColor, infoTextConfig);
|
||||||
|
@ -3607,7 +3605,7 @@ void Clay__RenderDebugView(void) {
|
||||||
}
|
}
|
||||||
case CLAY__ELEMENT_CONFIG_TYPE_TEXT: {
|
case CLAY__ELEMENT_CONFIG_TYPE_TEXT: {
|
||||||
Clay_TextElementConfig *textConfig = elementConfig->config.textElementConfig;
|
Clay_TextElementConfig *textConfig = elementConfig->config.textElementConfig;
|
||||||
CLAY({ .layout = { .padding = attributeConfigPadding, .childGap = 8, .layoutDirection = CLAY_TOP_TO_BOTTOM } }) {
|
CLAY_AUTO_ID({ .layout = { .padding = attributeConfigPadding, .childGap = 8, .layoutDirection = CLAY_TOP_TO_BOTTOM } }) {
|
||||||
// .fontSize
|
// .fontSize
|
||||||
CLAY_TEXT(CLAY_STRING("Font Size"), infoTitleConfig);
|
CLAY_TEXT(CLAY_STRING("Font Size"), infoTitleConfig);
|
||||||
CLAY_TEXT(Clay__IntToString(textConfig->fontSize), infoTextConfig);
|
CLAY_TEXT(Clay__IntToString(textConfig->fontSize), infoTextConfig);
|
||||||
|
@ -3646,10 +3644,10 @@ void Clay__RenderDebugView(void) {
|
||||||
}
|
}
|
||||||
case CLAY__ELEMENT_CONFIG_TYPE_ASPECT: {
|
case CLAY__ELEMENT_CONFIG_TYPE_ASPECT: {
|
||||||
Clay_AspectRatioElementConfig *aspectRatioConfig = elementConfig->config.aspectRatioElementConfig;
|
Clay_AspectRatioElementConfig *aspectRatioConfig = elementConfig->config.aspectRatioElementConfig;
|
||||||
CLAY({ .id = CLAY_ID("Clay__DebugViewElementInfoAspectRatioBody"), .layout = { .padding = attributeConfigPadding, .childGap = 8, .layoutDirection = CLAY_TOP_TO_BOTTOM } }) {
|
CLAY(CLAY_ID("Clay__DebugViewElementInfoAspectRatioBody"), { .layout = { .padding = attributeConfigPadding, .childGap = 8, .layoutDirection = CLAY_TOP_TO_BOTTOM } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("Aspect Ratio"), infoTitleConfig);
|
CLAY_TEXT(CLAY_STRING("Aspect Ratio"), infoTitleConfig);
|
||||||
// Aspect Ratio
|
// Aspect Ratio
|
||||||
CLAY({ .id = CLAY_ID("Clay__DebugViewElementInfoAspectRatio") }) {
|
CLAY(CLAY_ID("Clay__DebugViewElementInfoAspectRatio"), { }) {
|
||||||
CLAY_TEXT(Clay__IntToString(aspectRatioConfig->aspectRatio), infoTextConfig);
|
CLAY_TEXT(Clay__IntToString(aspectRatioConfig->aspectRatio), infoTextConfig);
|
||||||
CLAY_TEXT(CLAY_STRING("."), infoTextConfig);
|
CLAY_TEXT(CLAY_STRING("."), infoTextConfig);
|
||||||
float frac = aspectRatioConfig->aspectRatio - (int)(aspectRatioConfig->aspectRatio);
|
float frac = aspectRatioConfig->aspectRatio - (int)(aspectRatioConfig->aspectRatio);
|
||||||
|
@ -3668,16 +3666,16 @@ void Clay__RenderDebugView(void) {
|
||||||
if (Clay__ElementHasConfig(selectedItem->layoutElement, CLAY__ELEMENT_CONFIG_TYPE_ASPECT)) {
|
if (Clay__ElementHasConfig(selectedItem->layoutElement, CLAY__ELEMENT_CONFIG_TYPE_ASPECT)) {
|
||||||
aspectConfig = *Clay__FindElementConfigWithType(selectedItem->layoutElement, CLAY__ELEMENT_CONFIG_TYPE_ASPECT).aspectRatioElementConfig;
|
aspectConfig = *Clay__FindElementConfigWithType(selectedItem->layoutElement, CLAY__ELEMENT_CONFIG_TYPE_ASPECT).aspectRatioElementConfig;
|
||||||
}
|
}
|
||||||
CLAY({ .id = CLAY_ID("Clay__DebugViewElementInfoImageBody"), .layout = { .padding = attributeConfigPadding, .childGap = 8, .layoutDirection = CLAY_TOP_TO_BOTTOM } }) {
|
CLAY(CLAY_ID("Clay__DebugViewElementInfoImageBody"), { .layout = { .padding = attributeConfigPadding, .childGap = 8, .layoutDirection = CLAY_TOP_TO_BOTTOM } }) {
|
||||||
// Image Preview
|
// Image Preview
|
||||||
CLAY_TEXT(CLAY_STRING("Preview"), infoTitleConfig);
|
CLAY_TEXT(CLAY_STRING("Preview"), infoTitleConfig);
|
||||||
CLAY({ .layout = { .sizing = { .width = CLAY_SIZING_GROW(64, 128), .height = CLAY_SIZING_GROW(64, 128) }}, .aspectRatio = aspectConfig, .image = *imageConfig }) {}
|
CLAY_AUTO_ID({ .layout = { .sizing = { .width = CLAY_SIZING_GROW(64, 128), .height = CLAY_SIZING_GROW(64, 128) }}, .aspectRatio = aspectConfig, .image = *imageConfig }) {}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CLAY__ELEMENT_CONFIG_TYPE_CLIP: {
|
case CLAY__ELEMENT_CONFIG_TYPE_CLIP: {
|
||||||
Clay_ClipElementConfig *clipConfig = elementConfig->config.clipElementConfig;
|
Clay_ClipElementConfig *clipConfig = elementConfig->config.clipElementConfig;
|
||||||
CLAY({ .layout = { .padding = attributeConfigPadding, .childGap = 8, .layoutDirection = CLAY_TOP_TO_BOTTOM } }) {
|
CLAY_AUTO_ID({ .layout = { .padding = attributeConfigPadding, .childGap = 8, .layoutDirection = CLAY_TOP_TO_BOTTOM } }) {
|
||||||
// .vertical
|
// .vertical
|
||||||
CLAY_TEXT(CLAY_STRING("Vertical"), infoTitleConfig);
|
CLAY_TEXT(CLAY_STRING("Vertical"), infoTitleConfig);
|
||||||
CLAY_TEXT(clipConfig->vertical ? CLAY_STRING("true") : CLAY_STRING("false") , infoTextConfig);
|
CLAY_TEXT(clipConfig->vertical ? CLAY_STRING("true") : CLAY_STRING("false") , infoTextConfig);
|
||||||
|
@ -3689,10 +3687,10 @@ void Clay__RenderDebugView(void) {
|
||||||
}
|
}
|
||||||
case CLAY__ELEMENT_CONFIG_TYPE_FLOATING: {
|
case CLAY__ELEMENT_CONFIG_TYPE_FLOATING: {
|
||||||
Clay_FloatingElementConfig *floatingConfig = elementConfig->config.floatingElementConfig;
|
Clay_FloatingElementConfig *floatingConfig = elementConfig->config.floatingElementConfig;
|
||||||
CLAY({ .layout = { .padding = attributeConfigPadding, .childGap = 8, .layoutDirection = CLAY_TOP_TO_BOTTOM } }) {
|
CLAY_AUTO_ID({ .layout = { .padding = attributeConfigPadding, .childGap = 8, .layoutDirection = CLAY_TOP_TO_BOTTOM } }) {
|
||||||
// .offset
|
// .offset
|
||||||
CLAY_TEXT(CLAY_STRING("Offset"), infoTitleConfig);
|
CLAY_TEXT(CLAY_STRING("Offset"), infoTitleConfig);
|
||||||
CLAY({ .layout = { .layoutDirection = CLAY_LEFT_TO_RIGHT } }) {
|
CLAY_AUTO_ID({ .layout = { .layoutDirection = CLAY_LEFT_TO_RIGHT } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("{ x: "), infoTextConfig);
|
CLAY_TEXT(CLAY_STRING("{ x: "), infoTextConfig);
|
||||||
CLAY_TEXT(Clay__IntToString(floatingConfig->offset.x), infoTextConfig);
|
CLAY_TEXT(Clay__IntToString(floatingConfig->offset.x), infoTextConfig);
|
||||||
CLAY_TEXT(CLAY_STRING(", y: "), infoTextConfig);
|
CLAY_TEXT(CLAY_STRING(", y: "), infoTextConfig);
|
||||||
|
@ -3701,7 +3699,7 @@ void Clay__RenderDebugView(void) {
|
||||||
}
|
}
|
||||||
// .expand
|
// .expand
|
||||||
CLAY_TEXT(CLAY_STRING("Expand"), infoTitleConfig);
|
CLAY_TEXT(CLAY_STRING("Expand"), infoTitleConfig);
|
||||||
CLAY({ .layout = { .layoutDirection = CLAY_LEFT_TO_RIGHT } }) {
|
CLAY_AUTO_ID({ .layout = { .layoutDirection = CLAY_LEFT_TO_RIGHT } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("{ width: "), infoTextConfig);
|
CLAY_TEXT(CLAY_STRING("{ width: "), infoTextConfig);
|
||||||
CLAY_TEXT(Clay__IntToString(floatingConfig->expand.width), infoTextConfig);
|
CLAY_TEXT(Clay__IntToString(floatingConfig->expand.width), infoTextConfig);
|
||||||
CLAY_TEXT(CLAY_STRING(", height: "), infoTextConfig);
|
CLAY_TEXT(CLAY_STRING(", height: "), infoTextConfig);
|
||||||
|
@ -3717,7 +3715,7 @@ void Clay__RenderDebugView(void) {
|
||||||
CLAY_TEXT(hashItem->elementId.stringId, infoTextConfig);
|
CLAY_TEXT(hashItem->elementId.stringId, infoTextConfig);
|
||||||
// .attachPoints
|
// .attachPoints
|
||||||
CLAY_TEXT(CLAY_STRING("Attach Points"), infoTitleConfig);
|
CLAY_TEXT(CLAY_STRING("Attach Points"), infoTitleConfig);
|
||||||
CLAY({ .layout = { .layoutDirection = CLAY_LEFT_TO_RIGHT } }) {
|
CLAY_AUTO_ID({ .layout = { .layoutDirection = CLAY_LEFT_TO_RIGHT } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("{ element: "), infoTextConfig);
|
CLAY_TEXT(CLAY_STRING("{ element: "), infoTextConfig);
|
||||||
Clay_String attachPointElement = CLAY_STRING("LEFT_TOP");
|
Clay_String attachPointElement = CLAY_STRING("LEFT_TOP");
|
||||||
if (floatingConfig->attachPoints.element == CLAY_ATTACH_POINT_LEFT_CENTER) {
|
if (floatingConfig->attachPoints.element == CLAY_ATTACH_POINT_LEFT_CENTER) {
|
||||||
|
@ -3790,9 +3788,9 @@ void Clay__RenderDebugView(void) {
|
||||||
}
|
}
|
||||||
case CLAY__ELEMENT_CONFIG_TYPE_BORDER: {
|
case CLAY__ELEMENT_CONFIG_TYPE_BORDER: {
|
||||||
Clay_BorderElementConfig *borderConfig = elementConfig->config.borderElementConfig;
|
Clay_BorderElementConfig *borderConfig = elementConfig->config.borderElementConfig;
|
||||||
CLAY({ .id = CLAY_ID("Clay__DebugViewElementInfoBorderBody"), .layout = { .padding = attributeConfigPadding, .childGap = 8, .layoutDirection = CLAY_TOP_TO_BOTTOM } }) {
|
CLAY(CLAY_ID("Clay__DebugViewElementInfoBorderBody"), { .layout = { .padding = attributeConfigPadding, .childGap = 8, .layoutDirection = CLAY_TOP_TO_BOTTOM } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("Border Widths"), infoTitleConfig);
|
CLAY_TEXT(CLAY_STRING("Border Widths"), infoTitleConfig);
|
||||||
CLAY({ .layout = { .layoutDirection = CLAY_LEFT_TO_RIGHT } }) {
|
CLAY_AUTO_ID({ .layout = { .layoutDirection = CLAY_LEFT_TO_RIGHT } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("{ left: "), infoTextConfig);
|
CLAY_TEXT(CLAY_STRING("{ left: "), infoTextConfig);
|
||||||
CLAY_TEXT(Clay__IntToString(borderConfig->width.left), infoTextConfig);
|
CLAY_TEXT(Clay__IntToString(borderConfig->width.left), infoTextConfig);
|
||||||
CLAY_TEXT(CLAY_STRING(", right: "), infoTextConfig);
|
CLAY_TEXT(CLAY_STRING(", right: "), infoTextConfig);
|
||||||
|
@ -3815,16 +3813,16 @@ void Clay__RenderDebugView(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CLAY({ .id = CLAY_ID("Clay__DebugViewWarningsScrollPane"), .layout = { .sizing = {CLAY_SIZING_GROW(0), CLAY_SIZING_FIXED(300)}, .childGap = 6, .layoutDirection = CLAY_TOP_TO_BOTTOM }, .backgroundColor = CLAY__DEBUGVIEW_COLOR_2, .clip = { .horizontal = true, .vertical = true, .childOffset = Clay_GetScrollOffset() } }) {
|
CLAY(CLAY_ID("Clay__DebugViewWarningsScrollPane"), { .layout = { .sizing = {CLAY_SIZING_GROW(0), CLAY_SIZING_FIXED(300)}, .childGap = 6, .layoutDirection = CLAY_TOP_TO_BOTTOM }, .backgroundColor = CLAY__DEBUGVIEW_COLOR_2, .clip = { .horizontal = true, .vertical = true, .childOffset = Clay_GetScrollOffset() } }) {
|
||||||
Clay_TextElementConfig *warningConfig = CLAY_TEXT_CONFIG({ .textColor = CLAY__DEBUGVIEW_COLOR_4, .fontSize = 16, .wrapMode = CLAY_TEXT_WRAP_NONE });
|
Clay_TextElementConfig *warningConfig = CLAY_TEXT_CONFIG({ .textColor = CLAY__DEBUGVIEW_COLOR_4, .fontSize = 16, .wrapMode = CLAY_TEXT_WRAP_NONE });
|
||||||
CLAY({ .id = CLAY_ID("Clay__DebugViewWarningItemHeader"), .layout = { .sizing = {.height = CLAY_SIZING_FIXED(CLAY__DEBUGVIEW_ROW_HEIGHT)}, .padding = {CLAY__DEBUGVIEW_OUTER_PADDING, CLAY__DEBUGVIEW_OUTER_PADDING, 0, 0 }, .childGap = 8, .childAlignment = {.y = CLAY_ALIGN_Y_CENTER} } }) {
|
CLAY(CLAY_ID("Clay__DebugViewWarningItemHeader"), { .layout = { .sizing = {.height = CLAY_SIZING_FIXED(CLAY__DEBUGVIEW_ROW_HEIGHT)}, .padding = {CLAY__DEBUGVIEW_OUTER_PADDING, CLAY__DEBUGVIEW_OUTER_PADDING, 0, 0 }, .childGap = 8, .childAlignment = {.y = CLAY_ALIGN_Y_CENTER} } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("Warnings"), warningConfig);
|
CLAY_TEXT(CLAY_STRING("Warnings"), warningConfig);
|
||||||
}
|
}
|
||||||
CLAY({ .id = CLAY_ID("Clay__DebugViewWarningsTopBorder"), .layout = { .sizing = { .width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIXED(1)} }, .backgroundColor = {200, 200, 200, 255} }) {}
|
CLAY(CLAY_ID("Clay__DebugViewWarningsTopBorder"), { .layout = { .sizing = { .width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIXED(1)} }, .backgroundColor = {200, 200, 200, 255} }) {}
|
||||||
int32_t previousWarningsLength = context->warnings.length;
|
int32_t previousWarningsLength = context->warnings.length;
|
||||||
for (int32_t i = 0; i < previousWarningsLength; i++) {
|
for (int32_t i = 0; i < previousWarningsLength; i++) {
|
||||||
Clay__Warning warning = context->warnings.internalArray[i];
|
Clay__Warning warning = context->warnings.internalArray[i];
|
||||||
CLAY({ .id = CLAY_IDI("Clay__DebugViewWarningItem", i), .layout = { .sizing = {.height = CLAY_SIZING_FIXED(CLAY__DEBUGVIEW_ROW_HEIGHT)}, .padding = {CLAY__DEBUGVIEW_OUTER_PADDING, CLAY__DEBUGVIEW_OUTER_PADDING, 0, 0 }, .childGap = 8, .childAlignment = {.y = CLAY_ALIGN_Y_CENTER} } }) {
|
CLAY(CLAY_IDI("Clay__DebugViewWarningItem", i), { .layout = { .sizing = {.height = CLAY_SIZING_FIXED(CLAY__DEBUGVIEW_ROW_HEIGHT)}, .padding = {CLAY__DEBUGVIEW_OUTER_PADDING, CLAY__DEBUGVIEW_OUTER_PADDING, 0, 0 }, .childGap = 8, .childAlignment = {.y = CLAY_ALIGN_Y_CENTER} } }) {
|
||||||
CLAY_TEXT(warning.baseMessage, warningConfig);
|
CLAY_TEXT(warning.baseMessage, warningConfig);
|
||||||
if (warning.dynamicMessage.length > 0) {
|
if (warning.dynamicMessage.length > 0) {
|
||||||
CLAY_TEXT(warning.dynamicMessage, warningConfig);
|
CLAY_TEXT(warning.dynamicMessage, warningConfig);
|
||||||
|
@ -3995,10 +3993,6 @@ void Clay_SetPointerState(Clay_Vector2 position, bool isPointerDown) {
|
||||||
}
|
}
|
||||||
Clay_ElementIdArray_Add(&context->pointerOverIds, mapItem->elementId);
|
Clay_ElementIdArray_Add(&context->pointerOverIds, mapItem->elementId);
|
||||||
found = true;
|
found = true;
|
||||||
|
|
||||||
if (mapItem->idAlias != 0) {
|
|
||||||
Clay_ElementIdArray_Add(&context->pointerOverIds, CLAY__INIT(Clay_ElementId) { .id = mapItem->idAlias });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (Clay__ElementHasConfig(currentElement, CLAY__ELEMENT_CONFIG_TYPE_TEXT)) {
|
if (Clay__ElementHasConfig(currentElement, CLAY__ELEMENT_CONFIG_TYPE_TEXT)) {
|
||||||
dfsBuffer.length--;
|
dfsBuffer.length--;
|
||||||
|
@ -4222,10 +4216,9 @@ void Clay_BeginLayout(void) {
|
||||||
rootDimensions.width -= (float)Clay__debugViewWidth;
|
rootDimensions.width -= (float)Clay__debugViewWidth;
|
||||||
}
|
}
|
||||||
context->booleanWarnings = CLAY__INIT(Clay_BooleanWarnings) CLAY__DEFAULT_STRUCT;
|
context->booleanWarnings = CLAY__INIT(Clay_BooleanWarnings) CLAY__DEFAULT_STRUCT;
|
||||||
Clay__OpenElement();
|
Clay__OpenElementWithId(CLAY_ID("Clay__RootContainer"));
|
||||||
Clay__ConfigureOpenElement(CLAY__INIT(Clay_ElementDeclaration) {
|
Clay__ConfigureOpenElement(CLAY__INIT(Clay_ElementDeclaration) {
|
||||||
.id = CLAY_ID("Clay__RootContainer"),
|
.layout = { .sizing = {CLAY_SIZING_FIXED((rootDimensions.width)), CLAY_SIZING_FIXED(rootDimensions.height)} }
|
||||||
.layout = { .sizing = {CLAY_SIZING_FIXED((rootDimensions.width)), CLAY_SIZING_FIXED(rootDimensions.height)} }
|
|
||||||
});
|
});
|
||||||
Clay__int32_tArray_Add(&context->openLayoutElementStack, 0);
|
Clay__int32_tArray_Add(&context->openLayoutElementStack, 0);
|
||||||
Clay__LayoutElementTreeRootArray_Add(&context->layoutElementTreeRoots, CLAY__INIT(Clay__LayoutElementTreeRoot) { .layoutElementIndex = 0 });
|
Clay__LayoutElementTreeRootArray_Add(&context->layoutElementTreeRoots, CLAY__INIT(Clay__LayoutElementTreeRoot) { .layoutElementIndex = 0 });
|
||||||
|
@ -4253,9 +4246,14 @@ Clay_RenderCommandArray Clay_EndLayout(void) {
|
||||||
.renderData = { .text = { .stringContents = CLAY__INIT(Clay_StringSlice) { .length = message.length, .chars = message.chars, .baseChars = message.chars }, .textColor = {255, 0, 0, 255}, .fontSize = 16 } },
|
.renderData = { .text = { .stringContents = CLAY__INIT(Clay_StringSlice) { .length = message.length, .chars = message.chars, .baseChars = message.chars }, .textColor = {255, 0, 0, 255}, .fontSize = 16 } },
|
||||||
.commandType = CLAY_RENDER_COMMAND_TYPE_TEXT
|
.commandType = CLAY_RENDER_COMMAND_TYPE_TEXT
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
Clay__CalculateFinalLayout();
|
|
||||||
}
|
}
|
||||||
|
if (context->openLayoutElementStack.length > 1) {
|
||||||
|
context->errorHandler.errorHandlerFunction(CLAY__INIT(Clay_ErrorData) {
|
||||||
|
.errorType = CLAY_ERROR_TYPE_UNBALANCED_OPEN_CLOSE,
|
||||||
|
.errorText = CLAY_STRING("There were still open layout elements when EndLayout was called. This results from an unequal number of calls to Clay__OpenElement and Clay__CloseElement."),
|
||||||
|
.userData = context->errorHandler.userData });
|
||||||
|
}
|
||||||
|
Clay__CalculateFinalLayout();
|
||||||
return context->renderCommands;
|
return context->renderCommands;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ Clay_RenderCommandArray ClayImageSample_CreateLayout() {
|
||||||
.height = CLAY_SIZING_GROW(0)
|
.height = CLAY_SIZING_GROW(0)
|
||||||
};
|
};
|
||||||
|
|
||||||
CLAY({ .id = CLAY_ID("OuterContainer"),
|
CLAY(CLAY_ID("OuterContainer"), {
|
||||||
.layout = {
|
.layout = {
|
||||||
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
||||||
.sizing = layoutExpand,
|
.sizing = layoutExpand,
|
||||||
|
@ -61,8 +61,7 @@ Clay_RenderCommandArray ClayImageSample_CreateLayout() {
|
||||||
.childGap = 16
|
.childGap = 16
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
CLAY({
|
CLAY(CLAY_ID("SampleImage"), {
|
||||||
.id = CLAY_ID("SampleImage"),
|
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = layoutExpand
|
.sizing = layoutExpand
|
||||||
},
|
},
|
||||||
|
|
|
@ -40,12 +40,12 @@ void Layout() {
|
||||||
static Clay_Color BACKGROUND = { 0xF4, 0xEB, 0xE6, 255 };
|
static Clay_Color BACKGROUND = { 0xF4, 0xEB, 0xE6, 255 };
|
||||||
static Clay_Color ACCENT = { 0xFA, 0xE0, 0xD4, 255 };
|
static Clay_Color ACCENT = { 0xFA, 0xE0, 0xD4, 255 };
|
||||||
|
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0) },
|
.layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0) },
|
||||||
.layoutDirection = CLAY_TOP_TO_BOTTOM },
|
.layoutDirection = CLAY_TOP_TO_BOTTOM },
|
||||||
.backgroundColor = BACKGROUND
|
.backgroundColor = BACKGROUND
|
||||||
}) {
|
}) {
|
||||||
CLAY({ .id = CLAY_ID("PageMargins"), .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0) },
|
CLAY(CLAY_ID("PageMargins"), { .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0) },
|
||||||
.padding = { 70, 70, 50, 50 }, // Some nice looking page margins
|
.padding = { 70, 70, 50, 50 }, // Some nice looking page margins
|
||||||
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
||||||
.childGap = 10}
|
.childGap = 10}
|
||||||
|
@ -54,9 +54,9 @@ void Layout() {
|
||||||
CLAY_TEXT(CLAY_STRING("Features Overview"), CLAY_TEXT_CONFIG({ .fontId = FONT_CALLISTOGA, .textColor = PRIMARY, .fontSize = 24 }));
|
CLAY_TEXT(CLAY_STRING("Features Overview"), CLAY_TEXT_CONFIG({ .fontId = FONT_CALLISTOGA, .textColor = PRIMARY, .fontSize = 24 }));
|
||||||
|
|
||||||
// Feature Box
|
// Feature Box
|
||||||
CLAY({ .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_FIT(0) }, .childGap = 10 }}) {
|
CLAY_AUTO_ID({ .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_FIT(0) }, .childGap = 10 }}) {
|
||||||
CLAY({ .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_FIT(0) }}, .backgroundColor = ACCENT, .cornerRadius = CLAY_CORNER_RADIUS(12) }) {
|
CLAY_AUTO_ID({ .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_FIT(0) }}, .backgroundColor = ACCENT, .cornerRadius = CLAY_CORNER_RADIUS(12) }) {
|
||||||
CLAY({ .layout = {.padding = CLAY_PADDING_ALL(20), .childGap = 4, .layoutDirection = CLAY_TOP_TO_BOTTOM }}) {
|
CLAY_AUTO_ID({ .layout = {.padding = CLAY_PADDING_ALL(20), .childGap = 4, .layoutDirection = CLAY_TOP_TO_BOTTOM }}) {
|
||||||
CLAY_TEXT(CLAY_STRING("- High performance"),
|
CLAY_TEXT(CLAY_STRING("- High performance"),
|
||||||
CLAY_TEXT_CONFIG({ .textColor = PRIMARY, .fontSize = 14, .fontId = FONT_QUICKSAND }));
|
CLAY_TEXT_CONFIG({ .textColor = PRIMARY, .fontSize = 14, .fontId = FONT_QUICKSAND }));
|
||||||
CLAY_TEXT(CLAY_STRING("- Declarative syntax"),
|
CLAY_TEXT(CLAY_STRING("- Declarative syntax"),
|
||||||
|
@ -69,7 +69,7 @@ void Layout() {
|
||||||
CLAY_TEXT_CONFIG({ .textColor = PRIMARY, .fontSize = 14, .fontId = FONT_QUICKSAND }));
|
CLAY_TEXT_CONFIG({ .textColor = PRIMARY, .fontSize = 14, .fontId = FONT_QUICKSAND }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = {CLAY_SIZING_FIT(0), CLAY_SIZING_GROW(0)},
|
.sizing = {CLAY_SIZING_FIT(0), CLAY_SIZING_GROW(0)},
|
||||||
.padding = CLAY_PADDING_ALL(10),
|
.padding = CLAY_PADDING_ALL(10),
|
||||||
|
@ -81,23 +81,23 @@ void Layout() {
|
||||||
.cornerRadius = CLAY_CORNER_RADIUS(8)
|
.cornerRadius = CLAY_CORNER_RADIUS(8)
|
||||||
}) {
|
}) {
|
||||||
// Profile picture
|
// Profile picture
|
||||||
CLAY({ .layout = {
|
CLAY_AUTO_ID({ .layout = {
|
||||||
.sizing = {CLAY_SIZING_FIT(0), CLAY_SIZING_GROW(0)},
|
.sizing = {CLAY_SIZING_FIT(0), CLAY_SIZING_GROW(0)},
|
||||||
.padding = { 30, 30, 0, 0 },
|
.padding = { 30, 30, 0, 0 },
|
||||||
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
||||||
.childAlignment = { CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_CENTER }},
|
.childAlignment = { CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_CENTER }},
|
||||||
.border = { .color = PRIMARY, .width = 2, 2, 2, 2 }, .cornerRadius = 10
|
.border = { .color = PRIMARY, .width = 2, 2, 2, 2 }, .cornerRadius = 10
|
||||||
}) {
|
}) {
|
||||||
CLAY({ .layout = { .sizing = { CLAY_SIZING_FIXED(32), CLAY_SIZING_FIXED(32) } }, .image = { .imageData = "resources/check.png" }});
|
CLAY_AUTO_ID({ .layout = { .sizing = { CLAY_SIZING_FIXED(32), CLAY_SIZING_FIXED(32) } }, .image = { .imageData = "resources/check.png" }});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CLAY({ .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_FIXED(16) } }});
|
CLAY_AUTO_ID({ .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_FIXED(16) } }});
|
||||||
|
|
||||||
CLAY({ .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0) }, .childGap = 10, .layoutDirection = CLAY_TOP_TO_BOTTOM }}) {
|
CLAY_AUTO_ID({ .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0) }, .childGap = 10, .layoutDirection = CLAY_TOP_TO_BOTTOM }}) {
|
||||||
CLAY_TEXT(CLAY_STRING("Cairo"), CLAY_TEXT_CONFIG({ .fontId = FONT_CALLISTOGA, .fontSize = 24, .textColor = PRIMARY }));
|
CLAY_TEXT(CLAY_STRING("Cairo"), CLAY_TEXT_CONFIG({ .fontId = FONT_CALLISTOGA, .fontSize = 24, .textColor = PRIMARY }));
|
||||||
CLAY({ .layout = { .padding = CLAY_PADDING_ALL(10) }, .backgroundColor = ACCENT, .cornerRadius = 10 }) {
|
CLAY_AUTO_ID({ .layout = { .padding = CLAY_PADDING_ALL(10) }, .backgroundColor = ACCENT, .cornerRadius = 10 }) {
|
||||||
CLAY_TEXT(CLAY_STRING("Officiis quia quia qui inventore ratione voluptas et. Quidem sunt unde similique. Qui est et exercitationem cumque harum illum. Numquam placeat aliquid quo voluptatem. "
|
CLAY_TEXT(CLAY_STRING("Officiis quia quia qui inventore ratione voluptas et. Quidem sunt unde similique. Qui est et exercitationem cumque harum illum. Numquam placeat aliquid quo voluptatem. "
|
||||||
"Deleniti saepe nihil exercitationem nemo illo. Consequatur beatae repellat provident similique. Provident qui exercitationem deserunt sapiente. Quam qui dolor corporis odit. "
|
"Deleniti saepe nihil exercitationem nemo illo. Consequatur beatae repellat provident similique. Provident qui exercitationem deserunt sapiente. Quam qui dolor corporis odit. "
|
||||||
"Assumenda corrupti sunt culpa pariatur. Vero sit ut minima. In est consequatur minus et cum sint illum aperiam. Qui ipsa quas nisi omnis aut quia nobis. "
|
"Assumenda corrupti sunt culpa pariatur. Vero sit ut minima. In est consequatur minus et cum sint illum aperiam. Qui ipsa quas nisi omnis aut quia nobis. "
|
||||||
|
|
|
@ -65,21 +65,21 @@ Clay_String* FrameAllocateString(Clay_String string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LandingPageBlob(int index, int fontSize, Clay_Color color, Clay_String text, Clay_String imageURL) {
|
void LandingPageBlob(int index, int fontSize, Clay_Color color, Clay_String text, Clay_String imageURL) {
|
||||||
CLAY({ .id = CLAY_IDI("HeroBlob", index), .layout = { .sizing = { CLAY_SIZING_GROW(.max = 480) }, .padding = CLAY_PADDING_ALL(16), .childGap = 16, .childAlignment = {.y = CLAY_ALIGN_Y_CENTER} }, .border = { .color = color, .width = { 2, 2, 2, 2 }}, .cornerRadius = CLAY_CORNER_RADIUS(10) }) {
|
CLAY(CLAY_IDI("HeroBlob", index), { .layout = { .sizing = { CLAY_SIZING_GROW(.max = 480) }, .padding = CLAY_PADDING_ALL(16), .childGap = 16, .childAlignment = {.y = CLAY_ALIGN_Y_CENTER} }, .border = { .color = color, .width = { 2, 2, 2, 2 }}, .cornerRadius = CLAY_CORNER_RADIUS(10) }) {
|
||||||
CLAY({ .id = CLAY_IDI("CheckImage", index), .layout = { .sizing = { CLAY_SIZING_FIXED(32) } }, .aspectRatio = { 1 }, .image = { .imageData = FrameAllocateString(imageURL) } }) {}
|
CLAY(CLAY_IDI("CheckImage", index), { .layout = { .sizing = { CLAY_SIZING_FIXED(32) } }, .aspectRatio = { 1 }, .image = { .imageData = FrameAllocateString(imageURL) } }) {}
|
||||||
CLAY_TEXT(text, CLAY_TEXT_CONFIG({ .fontSize = fontSize, .fontId = FONT_ID_BODY_24, .textColor = color }));
|
CLAY_TEXT(text, CLAY_TEXT_CONFIG({ .fontSize = fontSize, .fontId = FONT_ID_BODY_24, .textColor = color }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LandingPageDesktop() {
|
void LandingPageDesktop() {
|
||||||
CLAY({ .id = CLAY_ID("LandingPage1Desktop"), .layout = { .sizing = { .width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIT(.min = windowHeight - 70) }, .childAlignment = {.y = CLAY_ALIGN_Y_CENTER}, .padding = { 50, 50 } } }) {
|
CLAY(CLAY_ID("LandingPage1Desktop"), { .layout = { .sizing = { .width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIT(.min = windowHeight - 70) }, .childAlignment = {.y = CLAY_ALIGN_Y_CENTER}, .padding = { 50, 50 } } }) {
|
||||||
CLAY({ .id = CLAY_ID("LandingPage1"), .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0) }, .childAlignment = {.y = CLAY_ALIGN_Y_CENTER}, .padding = CLAY_PADDING_ALL(32), .childGap = 32 }, .border = { .width = { .left = 2, .right = 2 }, .color = COLOR_RED } }) {
|
CLAY(CLAY_ID("LandingPage1"), { .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0) }, .childAlignment = {.y = CLAY_ALIGN_Y_CENTER}, .padding = CLAY_PADDING_ALL(32), .childGap = 32 }, .border = { .width = { .left = 2, .right = 2 }, .color = COLOR_RED } }) {
|
||||||
CLAY({ .id = CLAY_ID("LeftText"), .layout = { .sizing = { .width = CLAY_SIZING_PERCENT(0.55f) }, .layoutDirection = CLAY_TOP_TO_BOTTOM, .childGap = 8 } }) {
|
CLAY(CLAY_ID("LeftText"), { .layout = { .sizing = { .width = CLAY_SIZING_PERCENT(0.55f) }, .layoutDirection = CLAY_TOP_TO_BOTTOM, .childGap = 8 } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("Clay is a flex-box style UI auto layout library in C, with declarative syntax and microsecond performance."), CLAY_TEXT_CONFIG({ .fontSize = 56, .fontId = FONT_ID_TITLE_56, .textColor = COLOR_RED }));
|
CLAY_TEXT(CLAY_STRING("Clay is a flex-box style UI auto layout library in C, with declarative syntax and microsecond performance."), CLAY_TEXT_CONFIG({ .fontSize = 56, .fontId = FONT_ID_TITLE_56, .textColor = COLOR_RED }));
|
||||||
CLAY({ .id = CLAY_ID("LandingPageSpacer"), .layout = { .sizing = { .width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIXED(32) } } }) {}
|
CLAY(CLAY_ID("LandingPageSpacer"), { .layout = { .sizing = { .width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIXED(32) } } }) {}
|
||||||
CLAY_TEXT(CLAY_STRING("Clay is laying out this webpage right now!"), CLAY_TEXT_CONFIG({ .fontSize = 36, .fontId = FONT_ID_TITLE_36, .textColor = COLOR_ORANGE }));
|
CLAY_TEXT(CLAY_STRING("Clay is laying out this webpage right now!"), CLAY_TEXT_CONFIG({ .fontSize = 36, .fontId = FONT_ID_TITLE_36, .textColor = COLOR_ORANGE }));
|
||||||
}
|
}
|
||||||
CLAY({ .id = CLAY_ID("HeroImageOuter"), .layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM, .sizing = { .width = CLAY_SIZING_PERCENT(0.45f) }, .childAlignment = { CLAY_ALIGN_X_CENTER }, .childGap = 16 } }) {
|
CLAY(CLAY_ID("HeroImageOuter"), { .layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM, .sizing = { .width = CLAY_SIZING_PERCENT(0.45f) }, .childAlignment = { CLAY_ALIGN_X_CENTER }, .childGap = 16 } }) {
|
||||||
LandingPageBlob(1, 32, COLOR_BLOB_BORDER_5, CLAY_STRING("High performance"), CLAY_STRING("/clay/images/check_5.png"));
|
LandingPageBlob(1, 32, COLOR_BLOB_BORDER_5, CLAY_STRING("High performance"), CLAY_STRING("/clay/images/check_5.png"));
|
||||||
LandingPageBlob(2, 32, COLOR_BLOB_BORDER_4, CLAY_STRING("Flexbox-style responsive layout"), CLAY_STRING("/clay/images/check_4.png"));
|
LandingPageBlob(2, 32, COLOR_BLOB_BORDER_4, CLAY_STRING("Flexbox-style responsive layout"), CLAY_STRING("/clay/images/check_4.png"));
|
||||||
LandingPageBlob(3, 32, COLOR_BLOB_BORDER_3, CLAY_STRING("Declarative syntax"), CLAY_STRING("/clay/images/check_3.png"));
|
LandingPageBlob(3, 32, COLOR_BLOB_BORDER_3, CLAY_STRING("Declarative syntax"), CLAY_STRING("/clay/images/check_3.png"));
|
||||||
|
@ -91,13 +91,13 @@ void LandingPageDesktop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LandingPageMobile() {
|
void LandingPageMobile() {
|
||||||
CLAY({ .id = CLAY_ID("LandingPage1Mobile"), .layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM, .sizing = { .width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIT(.min = windowHeight - 70) }, .childAlignment = {CLAY_ALIGN_X_CENTER, .y = CLAY_ALIGN_Y_CENTER}, .padding = { 16, 16, 32, 32 }, .childGap = 32 } }) {
|
CLAY(CLAY_ID("LandingPage1Mobile"), { .layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM, .sizing = { .width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIT(.min = windowHeight - 70) }, .childAlignment = {CLAY_ALIGN_X_CENTER, .y = CLAY_ALIGN_Y_CENTER}, .padding = { 16, 16, 32, 32 }, .childGap = 32 } }) {
|
||||||
CLAY({ .id = CLAY_ID("LeftText"), .layout = { .sizing = { .width = CLAY_SIZING_GROW(0) }, .layoutDirection = CLAY_TOP_TO_BOTTOM, .childGap = 8 } }) {
|
CLAY(CLAY_ID("LeftText"), { .layout = { .sizing = { .width = CLAY_SIZING_GROW(0) }, .layoutDirection = CLAY_TOP_TO_BOTTOM, .childGap = 8 } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("Clay is a flex-box style UI auto layout library in C, with declarative syntax and microsecond performance."), CLAY_TEXT_CONFIG({ .fontSize = 48, .fontId = FONT_ID_TITLE_56, .textColor = COLOR_RED }));
|
CLAY_TEXT(CLAY_STRING("Clay is a flex-box style UI auto layout library in C, with declarative syntax and microsecond performance."), CLAY_TEXT_CONFIG({ .fontSize = 48, .fontId = FONT_ID_TITLE_56, .textColor = COLOR_RED }));
|
||||||
CLAY({ .id = CLAY_ID("LandingPageSpacer"), .layout = { .sizing = { .width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIXED(32) } } }) {}
|
CLAY(CLAY_ID("LandingPageSpacer"), { .layout = { .sizing = { .width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIXED(32) } } }) {}
|
||||||
CLAY_TEXT(CLAY_STRING("Clay is laying out this webpage right now!"), CLAY_TEXT_CONFIG({ .fontSize = 32, .fontId = FONT_ID_TITLE_36, .textColor = COLOR_ORANGE }));
|
CLAY_TEXT(CLAY_STRING("Clay is laying out this webpage right now!"), CLAY_TEXT_CONFIG({ .fontSize = 32, .fontId = FONT_ID_TITLE_36, .textColor = COLOR_ORANGE }));
|
||||||
}
|
}
|
||||||
CLAY({ .id = CLAY_ID("HeroImageOuter"), .layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM, .sizing = { .width = CLAY_SIZING_GROW(0) }, .childAlignment = { CLAY_ALIGN_X_CENTER }, .childGap = 16 } }) {
|
CLAY(CLAY_ID("HeroImageOuter"), { .layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM, .sizing = { .width = CLAY_SIZING_GROW(0) }, .childAlignment = { CLAY_ALIGN_X_CENTER }, .childGap = 16 } }) {
|
||||||
LandingPageBlob(1, 28, COLOR_BLOB_BORDER_5, CLAY_STRING("High performance"), CLAY_STRING("/clay/images/check_5.png"));
|
LandingPageBlob(1, 28, COLOR_BLOB_BORDER_5, CLAY_STRING("High performance"), CLAY_STRING("/clay/images/check_5.png"));
|
||||||
LandingPageBlob(2, 28, COLOR_BLOB_BORDER_4, CLAY_STRING("Flexbox-style responsive layout"), CLAY_STRING("/clay/images/check_4.png"));
|
LandingPageBlob(2, 28, COLOR_BLOB_BORDER_4, CLAY_STRING("Flexbox-style responsive layout"), CLAY_STRING("/clay/images/check_4.png"));
|
||||||
LandingPageBlob(3, 28, COLOR_BLOB_BORDER_3, CLAY_STRING("Declarative syntax"), CLAY_STRING("/clay/images/check_3.png"));
|
LandingPageBlob(3, 28, COLOR_BLOB_BORDER_3, CLAY_STRING("Declarative syntax"), CLAY_STRING("/clay/images/check_3.png"));
|
||||||
|
@ -108,17 +108,17 @@ void LandingPageMobile() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FeatureBlocksDesktop() {
|
void FeatureBlocksDesktop() {
|
||||||
CLAY({ .id = CLAY_ID("FeatureBlocksOuter"), .layout = { .sizing = { CLAY_SIZING_GROW(0) } } }) {
|
CLAY(CLAY_ID("FeatureBlocksOuter"), { .layout = { .sizing = { CLAY_SIZING_GROW(0) } } }) {
|
||||||
CLAY({ .id = CLAY_ID("FeatureBlocksInner"), .layout = { .sizing = { CLAY_SIZING_GROW(0) }, .childAlignment = { .y = CLAY_ALIGN_Y_CENTER } }, .border = { .width = { .betweenChildren = 2 }, .color = COLOR_RED } }) {
|
CLAY(CLAY_ID("FeatureBlocksInner"), { .layout = { .sizing = { CLAY_SIZING_GROW(0) }, .childAlignment = { .y = CLAY_ALIGN_Y_CENTER } }, .border = { .width = { .betweenChildren = 2 }, .color = COLOR_RED } }) {
|
||||||
Clay_TextElementConfig *textConfig = CLAY_TEXT_CONFIG({ .fontSize = 24, .fontId = FONT_ID_BODY_24, .textColor = COLOR_RED });
|
Clay_TextElementConfig *textConfig = CLAY_TEXT_CONFIG({ .fontSize = 24, .fontId = FONT_ID_BODY_24, .textColor = COLOR_RED });
|
||||||
CLAY({ .id = CLAY_ID("HFileBoxOuter"), .layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM, .sizing = { CLAY_SIZING_PERCENT(0.5f) }, .childAlignment = {0, CLAY_ALIGN_Y_CENTER}, .padding = {50, 50, 32, 32}, .childGap = 8 } }) {
|
CLAY(CLAY_ID("HFileBoxOuter"), { .layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM, .sizing = { CLAY_SIZING_PERCENT(0.5f) }, .childAlignment = {0, CLAY_ALIGN_Y_CENTER}, .padding = {50, 50, 32, 32}, .childGap = 8 } }) {
|
||||||
CLAY({ .id = CLAY_ID("HFileIncludeOuter"), .layout = { .padding = {8, 4} }, .backgroundColor = COLOR_RED, .cornerRadius = CLAY_CORNER_RADIUS(8) }) {
|
CLAY(CLAY_ID("HFileIncludeOuter"), { .layout = { .padding = {8, 4} }, .backgroundColor = COLOR_RED, .cornerRadius = CLAY_CORNER_RADIUS(8) }) {
|
||||||
CLAY_TEXT(CLAY_STRING("#include clay.h"), CLAY_TEXT_CONFIG({ .fontSize = 24, .fontId = FONT_ID_BODY_24, .textColor = COLOR_LIGHT }));
|
CLAY_TEXT(CLAY_STRING("#include clay.h"), CLAY_TEXT_CONFIG({ .fontSize = 24, .fontId = FONT_ID_BODY_24, .textColor = COLOR_LIGHT }));
|
||||||
}
|
}
|
||||||
CLAY_TEXT(CLAY_STRING("~2000 lines of C99."), textConfig);
|
CLAY_TEXT(CLAY_STRING("~2000 lines of C99."), textConfig);
|
||||||
CLAY_TEXT(CLAY_STRING("Zero dependencies, including no C standard library."), textConfig);
|
CLAY_TEXT(CLAY_STRING("Zero dependencies, including no C standard library."), textConfig);
|
||||||
}
|
}
|
||||||
CLAY({ .id = CLAY_ID("BringYourOwnRendererOuter"), .layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM, .sizing = { CLAY_SIZING_PERCENT(0.5f) }, .childAlignment = {0, CLAY_ALIGN_Y_CENTER}, .padding = {50, 50, 32, 32}, .childGap = 8 } }) {
|
CLAY(CLAY_ID("BringYourOwnRendererOuter"), { .layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM, .sizing = { CLAY_SIZING_PERCENT(0.5f) }, .childAlignment = {0, CLAY_ALIGN_Y_CENTER}, .padding = {50, 50, 32, 32}, .childGap = 8 } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("Renderer agnostic."), CLAY_TEXT_CONFIG({ .fontId = FONT_ID_BODY_24, .fontSize = 24, .textColor = COLOR_ORANGE }));
|
CLAY_TEXT(CLAY_STRING("Renderer agnostic."), CLAY_TEXT_CONFIG({ .fontId = FONT_ID_BODY_24, .fontSize = 24, .textColor = COLOR_ORANGE }));
|
||||||
CLAY_TEXT(CLAY_STRING("Layout with clay, then render with Raylib, WebGL Canvas or even as HTML."), textConfig);
|
CLAY_TEXT(CLAY_STRING("Layout with clay, then render with Raylib, WebGL Canvas or even as HTML."), textConfig);
|
||||||
CLAY_TEXT(CLAY_STRING("Flexible output for easy compositing in your custom engine or environment."), textConfig);
|
CLAY_TEXT(CLAY_STRING("Flexible output for easy compositing in your custom engine or environment."), textConfig);
|
||||||
|
@ -128,16 +128,16 @@ void FeatureBlocksDesktop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FeatureBlocksMobile() {
|
void FeatureBlocksMobile() {
|
||||||
CLAY({ .id = CLAY_ID("FeatureBlocksInner"), .layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM, .sizing = { CLAY_SIZING_GROW(0) } }, .border = { .width = { .betweenChildren = 2 }, .color = COLOR_RED } }) {
|
CLAY(CLAY_ID("FeatureBlocksInner"), { .layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM, .sizing = { CLAY_SIZING_GROW(0) } }, .border = { .width = { .betweenChildren = 2 }, .color = COLOR_RED } }) {
|
||||||
Clay_TextElementConfig *textConfig = CLAY_TEXT_CONFIG({ .fontSize = 24, .fontId = FONT_ID_BODY_24, .textColor = COLOR_RED });
|
Clay_TextElementConfig *textConfig = CLAY_TEXT_CONFIG({ .fontSize = 24, .fontId = FONT_ID_BODY_24, .textColor = COLOR_RED });
|
||||||
CLAY({ .id = CLAY_ID("HFileBoxOuter"), .layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM, .sizing = { CLAY_SIZING_GROW(0) }, .childAlignment = {0, CLAY_ALIGN_Y_CENTER}, .padding = {16, 16, 32, 32}, .childGap = 8 } }) {
|
CLAY(CLAY_ID("HFileBoxOuter"), { .layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM, .sizing = { CLAY_SIZING_GROW(0) }, .childAlignment = {0, CLAY_ALIGN_Y_CENTER}, .padding = {16, 16, 32, 32}, .childGap = 8 } }) {
|
||||||
CLAY({ .id = CLAY_ID("HFileIncludeOuter"), .layout = { .padding = {8, 4} }, .backgroundColor = COLOR_RED, .cornerRadius = CLAY_CORNER_RADIUS(8) }) {
|
CLAY(CLAY_ID("HFileIncludeOuter"), { .layout = { .padding = {8, 4} }, .backgroundColor = COLOR_RED, .cornerRadius = CLAY_CORNER_RADIUS(8) }) {
|
||||||
CLAY_TEXT(CLAY_STRING("#include clay.h"), CLAY_TEXT_CONFIG({ .fontSize = 24, .fontId = FONT_ID_BODY_24, .textColor = COLOR_LIGHT }));
|
CLAY_TEXT(CLAY_STRING("#include clay.h"), CLAY_TEXT_CONFIG({ .fontSize = 24, .fontId = FONT_ID_BODY_24, .textColor = COLOR_LIGHT }));
|
||||||
}
|
}
|
||||||
CLAY_TEXT(CLAY_STRING("~2000 lines of C99."), textConfig);
|
CLAY_TEXT(CLAY_STRING("~2000 lines of C99."), textConfig);
|
||||||
CLAY_TEXT(CLAY_STRING("Zero dependencies, including no C standard library."), textConfig);
|
CLAY_TEXT(CLAY_STRING("Zero dependencies, including no C standard library."), textConfig);
|
||||||
}
|
}
|
||||||
CLAY({ .id = CLAY_ID("BringYourOwnRendererOuter"), .layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM, .sizing = { CLAY_SIZING_GROW(0) }, .childAlignment = {0, CLAY_ALIGN_Y_CENTER}, .padding = {16, 16, 32, 32}, .childGap = 8 } }) {
|
CLAY(CLAY_ID("BringYourOwnRendererOuter"), { .layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM, .sizing = { CLAY_SIZING_GROW(0) }, .childAlignment = {0, CLAY_ALIGN_Y_CENTER}, .padding = {16, 16, 32, 32}, .childGap = 8 } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("Renderer agnostic."), CLAY_TEXT_CONFIG({ .fontId = FONT_ID_BODY_24, .fontSize = 24, .textColor = COLOR_ORANGE }));
|
CLAY_TEXT(CLAY_STRING("Renderer agnostic."), CLAY_TEXT_CONFIG({ .fontId = FONT_ID_BODY_24, .fontSize = 24, .textColor = COLOR_ORANGE }));
|
||||||
CLAY_TEXT(CLAY_STRING("Layout with clay, then render with Raylib, WebGL Canvas or even as HTML."), textConfig);
|
CLAY_TEXT(CLAY_STRING("Layout with clay, then render with Raylib, WebGL Canvas or even as HTML."), textConfig);
|
||||||
CLAY_TEXT(CLAY_STRING("Flexible output for easy compositing in your custom engine or environment."), textConfig);
|
CLAY_TEXT(CLAY_STRING("Flexible output for easy compositing in your custom engine or environment."), textConfig);
|
||||||
|
@ -146,33 +146,33 @@ void FeatureBlocksMobile() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeclarativeSyntaxPageDesktop() {
|
void DeclarativeSyntaxPageDesktop() {
|
||||||
CLAY({ .id = CLAY_ID("SyntaxPageDesktop"), .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_FIT(.min = windowHeight - 50) }, .childAlignment = {0, CLAY_ALIGN_Y_CENTER}, .padding = { 50, 50 } } }) {
|
CLAY(CLAY_ID("SyntaxPageDesktop"), { .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_FIT(.min = windowHeight - 50) }, .childAlignment = {0, CLAY_ALIGN_Y_CENTER}, .padding = { 50, 50 } } }) {
|
||||||
CLAY({ .id = CLAY_ID("SyntaxPage"), .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0) }, .childAlignment = { 0, CLAY_ALIGN_Y_CENTER }, .padding = CLAY_PADDING_ALL(32), .childGap = 32 }, .border = { .width = { .left = 2, .right = 2 }, .color = COLOR_RED }}) {
|
CLAY(CLAY_ID("SyntaxPage"), { .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0) }, .childAlignment = { 0, CLAY_ALIGN_Y_CENTER }, .padding = CLAY_PADDING_ALL(32), .childGap = 32 }, .border = { .width = { .left = 2, .right = 2 }, .color = COLOR_RED }}) {
|
||||||
CLAY({ .id = CLAY_ID("SyntaxPageLeftText"), .layout = { .sizing = { CLAY_SIZING_PERCENT(0.5) }, .layoutDirection = CLAY_TOP_TO_BOTTOM, .childGap = 8 } }) {
|
CLAY(CLAY_ID("SyntaxPageLeftText"), { .layout = { .sizing = { CLAY_SIZING_PERCENT(0.5) }, .layoutDirection = CLAY_TOP_TO_BOTTOM, .childGap = 8 } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("Declarative Syntax"), CLAY_TEXT_CONFIG({ .fontSize = 52, .fontId = FONT_ID_TITLE_56, .textColor = COLOR_RED }));
|
CLAY_TEXT(CLAY_STRING("Declarative Syntax"), CLAY_TEXT_CONFIG({ .fontSize = 52, .fontId = FONT_ID_TITLE_56, .textColor = COLOR_RED }));
|
||||||
CLAY({ .id = CLAY_ID("SyntaxSpacer"), .layout = { .sizing = { CLAY_SIZING_GROW(.max = 16) } } }) {}
|
CLAY(CLAY_ID("SyntaxSpacer"), { .layout = { .sizing = { CLAY_SIZING_GROW(.max = 16) } } }) {}
|
||||||
CLAY_TEXT(CLAY_STRING("Flexible and readable declarative syntax with nested UI element hierarchies."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_RED }));
|
CLAY_TEXT(CLAY_STRING("Flexible and readable declarative syntax with nested UI element hierarchies."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_RED }));
|
||||||
CLAY_TEXT(CLAY_STRING("Mix elements with standard C code like loops, conditionals and functions."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_RED }));
|
CLAY_TEXT(CLAY_STRING("Mix elements with standard C code like loops, conditionals and functions."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_RED }));
|
||||||
CLAY_TEXT(CLAY_STRING("Create your own library of re-usable components from UI primitives like text, images and rectangles."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_RED }));
|
CLAY_TEXT(CLAY_STRING("Create your own library of re-usable components from UI primitives like text, images and rectangles."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_RED }));
|
||||||
}
|
}
|
||||||
CLAY({ .id = CLAY_ID("SyntaxPageRightImage"), .layout = { .sizing = { CLAY_SIZING_PERCENT(0.50) }, .childAlignment = {.x = CLAY_ALIGN_X_CENTER} } }) {
|
CLAY(CLAY_ID("SyntaxPageRightImage"), { .layout = { .sizing = { CLAY_SIZING_PERCENT(0.50) }, .childAlignment = {.x = CLAY_ALIGN_X_CENTER} } }) {
|
||||||
CLAY({ .id = CLAY_ID("SyntaxPageRightImageInner"), .layout = { .sizing = { CLAY_SIZING_GROW(.max = 568) } }, .aspectRatio = { 1136.0 / 1194.0 }, .image = { .imageData = FrameAllocateString(CLAY_STRING("/clay/images/declarative.png")) } }) {}
|
CLAY(CLAY_ID("SyntaxPageRightImageInner"), { .layout = { .sizing = { CLAY_SIZING_GROW(.max = 568) } }, .aspectRatio = { 1136.0 / 1194.0 }, .image = { .imageData = FrameAllocateString(CLAY_STRING("/clay/images/declarative.png")) } }) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeclarativeSyntaxPageMobile() {
|
void DeclarativeSyntaxPageMobile() {
|
||||||
CLAY({ .id = CLAY_ID("SyntaxPageDesktop"), .layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM, .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_FIT(.min = windowHeight - 50) }, .childAlignment = {CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_CENTER}, .padding = {16, 16, 32, 32}, .childGap = 16 } }) {
|
CLAY(CLAY_ID("SyntaxPageDesktop"), { .layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM, .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_FIT(.min = windowHeight - 50) }, .childAlignment = {CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_CENTER}, .padding = {16, 16, 32, 32}, .childGap = 16 } }) {
|
||||||
CLAY({ .id = CLAY_ID("SyntaxPageLeftText"), .layout = { .sizing = { CLAY_SIZING_GROW(0) }, .layoutDirection = CLAY_TOP_TO_BOTTOM, .childGap = 8 } }) {
|
CLAY(CLAY_ID("SyntaxPageLeftText"), { .layout = { .sizing = { CLAY_SIZING_GROW(0) }, .layoutDirection = CLAY_TOP_TO_BOTTOM, .childGap = 8 } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("Declarative Syntax"), CLAY_TEXT_CONFIG({ .fontSize = 48, .fontId = FONT_ID_TITLE_56, .textColor = COLOR_RED }));
|
CLAY_TEXT(CLAY_STRING("Declarative Syntax"), CLAY_TEXT_CONFIG({ .fontSize = 48, .fontId = FONT_ID_TITLE_56, .textColor = COLOR_RED }));
|
||||||
CLAY({ .id = CLAY_ID("SyntaxSpacer"), .layout = { .sizing = { CLAY_SIZING_GROW(.max = 16) } } }) {}
|
CLAY(CLAY_ID("SyntaxSpacer"), { .layout = { .sizing = { CLAY_SIZING_GROW(.max = 16) } } }) {}
|
||||||
CLAY_TEXT(CLAY_STRING("Flexible and readable declarative syntax with nested UI element hierarchies."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_RED }));
|
CLAY_TEXT(CLAY_STRING("Flexible and readable declarative syntax with nested UI element hierarchies."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_RED }));
|
||||||
CLAY_TEXT(CLAY_STRING("Mix elements with standard C code like loops, conditionals and functions."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_RED }));
|
CLAY_TEXT(CLAY_STRING("Mix elements with standard C code like loops, conditionals and functions."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_RED }));
|
||||||
CLAY_TEXT(CLAY_STRING("Create your own library of re-usable components from UI primitives like text, images and rectangles."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_RED }));
|
CLAY_TEXT(CLAY_STRING("Create your own library of re-usable components from UI primitives like text, images and rectangles."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_RED }));
|
||||||
}
|
}
|
||||||
CLAY({ .id = CLAY_ID("SyntaxPageRightImage"), .layout = { .sizing = { CLAY_SIZING_GROW(0) }, .childAlignment = {.x = CLAY_ALIGN_X_CENTER} } }) {
|
CLAY(CLAY_ID("SyntaxPageRightImage"), { .layout = { .sizing = { CLAY_SIZING_GROW(0) }, .childAlignment = {.x = CLAY_ALIGN_X_CENTER} } }) {
|
||||||
CLAY({ .id = CLAY_ID("SyntaxPageRightImageInner"), .layout = { .sizing = { CLAY_SIZING_GROW(.max = 568) } }, .aspectRatio = { 1136.0 / 1194.0 }, .image = { .imageData = FrameAllocateString(CLAY_STRING("/clay/images/declarative.png")) } }) {}
|
CLAY(CLAY_ID("SyntaxPageRightImageInner"), { .layout = { .sizing = { CLAY_SIZING_GROW(.max = 568) } }, .aspectRatio = { 1136.0 / 1194.0 }, .image = { .imageData = FrameAllocateString(CLAY_STRING("/clay/images/declarative.png")) } }) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,20 +189,20 @@ Clay_Color ColorLerp(Clay_Color a, Clay_Color b, float amount) {
|
||||||
Clay_String LOREM_IPSUM_TEXT = CLAY_STRING("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
|
Clay_String LOREM_IPSUM_TEXT = CLAY_STRING("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
|
||||||
|
|
||||||
void HighPerformancePageDesktop(float lerpValue) {
|
void HighPerformancePageDesktop(float lerpValue) {
|
||||||
CLAY({ .id = CLAY_ID("PerformanceOuter"), .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_FIT(.min = windowHeight - 50) }, .childAlignment = {0, CLAY_ALIGN_Y_CENTER}, .padding = {82, 82, 32, 32}, .childGap = 64 }, .backgroundColor = COLOR_RED }) {
|
CLAY(CLAY_ID("PerformanceOuter"), { .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_FIT(.min = windowHeight - 50) }, .childAlignment = {0, CLAY_ALIGN_Y_CENTER}, .padding = {82, 82, 32, 32}, .childGap = 64 }, .backgroundColor = COLOR_RED }) {
|
||||||
CLAY({ .id = CLAY_ID("PerformanceLeftText"), .layout = { .sizing = { CLAY_SIZING_PERCENT(0.5) }, .layoutDirection = CLAY_TOP_TO_BOTTOM, .childGap = 8 } }) {
|
CLAY(CLAY_ID("PerformanceLeftText"), { .layout = { .sizing = { CLAY_SIZING_PERCENT(0.5) }, .layoutDirection = CLAY_TOP_TO_BOTTOM, .childGap = 8 } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("High Performance"), CLAY_TEXT_CONFIG({ .fontSize = 52, .fontId = FONT_ID_TITLE_56, .textColor = COLOR_LIGHT }));
|
CLAY_TEXT(CLAY_STRING("High Performance"), CLAY_TEXT_CONFIG({ .fontSize = 52, .fontId = FONT_ID_TITLE_56, .textColor = COLOR_LIGHT }));
|
||||||
CLAY({ .id = CLAY_ID("PerformanceSpacer"), .layout = { .sizing = { CLAY_SIZING_GROW(.max = 16) }} }) {}
|
CLAY(CLAY_ID("PerformanceSpacer"), { .layout = { .sizing = { CLAY_SIZING_GROW(.max = 16) }} }) {}
|
||||||
CLAY_TEXT(CLAY_STRING("Fast enough to recompute your entire UI every frame."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_LIGHT }));
|
CLAY_TEXT(CLAY_STRING("Fast enough to recompute your entire UI every frame."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_LIGHT }));
|
||||||
CLAY_TEXT(CLAY_STRING("Small memory footprint (3.5mb default) with static allocation & reuse. No malloc / free."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_LIGHT }));
|
CLAY_TEXT(CLAY_STRING("Small memory footprint (3.5mb default) with static allocation & reuse. No malloc / free."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_LIGHT }));
|
||||||
CLAY_TEXT(CLAY_STRING("Simplify animations and reactive UI design by avoiding the standard performance hacks."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_LIGHT }));
|
CLAY_TEXT(CLAY_STRING("Simplify animations and reactive UI design by avoiding the standard performance hacks."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_LIGHT }));
|
||||||
}
|
}
|
||||||
CLAY({ .id = CLAY_ID("PerformanceRightImageOuter"), .layout = { .sizing = { CLAY_SIZING_PERCENT(0.50) }, .childAlignment = {CLAY_ALIGN_X_CENTER} } }) {
|
CLAY(CLAY_ID("PerformanceRightImageOuter"), { .layout = { .sizing = { CLAY_SIZING_PERCENT(0.50) }, .childAlignment = {CLAY_ALIGN_X_CENTER} } }) {
|
||||||
CLAY({ .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_FIXED(400) } }, .border = { .width = {2, 2, 2, 2}, .color = COLOR_LIGHT } }) {
|
CLAY_AUTO_ID({ .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_FIXED(400) } }, .border = { .width = {2, 2, 2, 2}, .color = COLOR_LIGHT } }) {
|
||||||
CLAY({ .id = CLAY_ID("AnimationDemoContainerLeft"), .layout = { .sizing = { CLAY_SIZING_PERCENT(0.3f + 0.4f * lerpValue), CLAY_SIZING_GROW(0) }, .childAlignment = {.y = CLAY_ALIGN_Y_CENTER}, .padding = CLAY_PADDING_ALL(32) }, .backgroundColor = ColorLerp(COLOR_RED, COLOR_ORANGE, lerpValue) }) {
|
CLAY(CLAY_ID("AnimationDemoContainerLeft"), { .layout = { .sizing = { CLAY_SIZING_PERCENT(0.3f + 0.4f * lerpValue), CLAY_SIZING_GROW(0) }, .childAlignment = {.y = CLAY_ALIGN_Y_CENTER}, .padding = CLAY_PADDING_ALL(32) }, .backgroundColor = ColorLerp(COLOR_RED, COLOR_ORANGE, lerpValue) }) {
|
||||||
CLAY_TEXT(LOREM_IPSUM_TEXT, CLAY_TEXT_CONFIG({ .fontSize = 24, .fontId = FONT_ID_TITLE_56, .textColor = COLOR_LIGHT }));
|
CLAY_TEXT(LOREM_IPSUM_TEXT, CLAY_TEXT_CONFIG({ .fontSize = 24, .fontId = FONT_ID_TITLE_56, .textColor = COLOR_LIGHT }));
|
||||||
}
|
}
|
||||||
CLAY({ .id = CLAY_ID("AnimationDemoContainerRight"), .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0) }, .childAlignment = {.y = CLAY_ALIGN_Y_CENTER}, .padding = CLAY_PADDING_ALL(32) }, .backgroundColor = ColorLerp(COLOR_ORANGE, COLOR_RED, lerpValue) }) {
|
CLAY(CLAY_ID("AnimationDemoContainerRight"), { .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0) }, .childAlignment = {.y = CLAY_ALIGN_Y_CENTER}, .padding = CLAY_PADDING_ALL(32) }, .backgroundColor = ColorLerp(COLOR_ORANGE, COLOR_RED, lerpValue) }) {
|
||||||
CLAY_TEXT(LOREM_IPSUM_TEXT, CLAY_TEXT_CONFIG({ .fontSize = 24, .fontId = FONT_ID_TITLE_56, .textColor = COLOR_LIGHT }));
|
CLAY_TEXT(LOREM_IPSUM_TEXT, CLAY_TEXT_CONFIG({ .fontSize = 24, .fontId = FONT_ID_TITLE_56, .textColor = COLOR_LIGHT }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -211,20 +211,20 @@ void HighPerformancePageDesktop(float lerpValue) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void HighPerformancePageMobile(float lerpValue) {
|
void HighPerformancePageMobile(float lerpValue) {
|
||||||
CLAY({ .id = CLAY_ID("PerformanceOuter"), .layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM, .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_FIT(.min = windowHeight - 50) }, .childAlignment = {CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_CENTER}, .padding = {16, 16, 32, 32}, .childGap = 32 }, .backgroundColor = COLOR_RED }) {
|
CLAY(CLAY_ID("PerformanceOuter"), { .layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM, .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_FIT(.min = windowHeight - 50) }, .childAlignment = {CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_CENTER}, .padding = {16, 16, 32, 32}, .childGap = 32 }, .backgroundColor = COLOR_RED }) {
|
||||||
CLAY({ .id = CLAY_ID("PerformanceLeftText"), .layout = { .sizing = { CLAY_SIZING_GROW(0) }, .layoutDirection = CLAY_TOP_TO_BOTTOM, .childGap = 8 } }) {
|
CLAY(CLAY_ID("PerformanceLeftText"), { .layout = { .sizing = { CLAY_SIZING_GROW(0) }, .layoutDirection = CLAY_TOP_TO_BOTTOM, .childGap = 8 } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("High Performance"), CLAY_TEXT_CONFIG({ .fontSize = 48, .fontId = FONT_ID_TITLE_56, .textColor = COLOR_LIGHT }));
|
CLAY_TEXT(CLAY_STRING("High Performance"), CLAY_TEXT_CONFIG({ .fontSize = 48, .fontId = FONT_ID_TITLE_56, .textColor = COLOR_LIGHT }));
|
||||||
CLAY({ .id = CLAY_ID("PerformanceSpacer"), .layout = { .sizing = { CLAY_SIZING_GROW(.max = 16) }} }) {}
|
CLAY(CLAY_ID("PerformanceSpacer"), { .layout = { .sizing = { CLAY_SIZING_GROW(.max = 16) }} }) {}
|
||||||
CLAY_TEXT(CLAY_STRING("Fast enough to recompute your entire UI every frame."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_LIGHT }));
|
CLAY_TEXT(CLAY_STRING("Fast enough to recompute your entire UI every frame."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_LIGHT }));
|
||||||
CLAY_TEXT(CLAY_STRING("Small memory footprint (3.5mb default) with static allocation & reuse. No malloc / free."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_LIGHT }));
|
CLAY_TEXT(CLAY_STRING("Small memory footprint (3.5mb default) with static allocation & reuse. No malloc / free."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_LIGHT }));
|
||||||
CLAY_TEXT(CLAY_STRING("Simplify animations and reactive UI design by avoiding the standard performance hacks."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_LIGHT }));
|
CLAY_TEXT(CLAY_STRING("Simplify animations and reactive UI design by avoiding the standard performance hacks."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_LIGHT }));
|
||||||
}
|
}
|
||||||
CLAY({ .id = CLAY_ID("PerformanceRightImageOuter"), .layout = { .sizing = { CLAY_SIZING_GROW(0) }, .childAlignment = {CLAY_ALIGN_X_CENTER} } }) {
|
CLAY(CLAY_ID("PerformanceRightImageOuter"), { .layout = { .sizing = { CLAY_SIZING_GROW(0) }, .childAlignment = {CLAY_ALIGN_X_CENTER} } }) {
|
||||||
CLAY({ .id = CLAY_ID(""), .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_FIXED(400) } }, .border = { .width = { 2, 2, 2, 2 }, .color = COLOR_LIGHT }}) {
|
CLAY_AUTO_ID({ .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_FIXED(400) } }, .border = { .width = { 2, 2, 2, 2 }, .color = COLOR_LIGHT }}) {
|
||||||
CLAY({ .id = CLAY_ID("AnimationDemoContainerLeft"), .layout = { .sizing = { CLAY_SIZING_PERCENT(0.35f + 0.3f * lerpValue), CLAY_SIZING_GROW(0) }, .childAlignment = {.y = CLAY_ALIGN_Y_CENTER}, .padding = CLAY_PADDING_ALL(16) }, .backgroundColor = ColorLerp(COLOR_RED, COLOR_ORANGE, lerpValue) }) {
|
CLAY(CLAY_ID("AnimationDemoContainerLeft"), { .layout = { .sizing = { CLAY_SIZING_PERCENT(0.35f + 0.3f * lerpValue), CLAY_SIZING_GROW(0) }, .childAlignment = {.y = CLAY_ALIGN_Y_CENTER}, .padding = CLAY_PADDING_ALL(16) }, .backgroundColor = ColorLerp(COLOR_RED, COLOR_ORANGE, lerpValue) }) {
|
||||||
CLAY_TEXT(LOREM_IPSUM_TEXT, CLAY_TEXT_CONFIG({ .fontSize = 24, .fontId = FONT_ID_TITLE_56, .textColor = COLOR_LIGHT }));
|
CLAY_TEXT(LOREM_IPSUM_TEXT, CLAY_TEXT_CONFIG({ .fontSize = 24, .fontId = FONT_ID_TITLE_56, .textColor = COLOR_LIGHT }));
|
||||||
}
|
}
|
||||||
CLAY({ .id = CLAY_ID("AnimationDemoContainerRight"), .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0) }, .childAlignment = {.y = CLAY_ALIGN_Y_CENTER}, .padding = CLAY_PADDING_ALL(16) }, .backgroundColor = ColorLerp(COLOR_ORANGE, COLOR_RED, lerpValue) }) {
|
CLAY(CLAY_ID("AnimationDemoContainerRight"), { .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0) }, .childAlignment = {.y = CLAY_ALIGN_Y_CENTER}, .padding = CLAY_PADDING_ALL(16) }, .backgroundColor = ColorLerp(COLOR_ORANGE, COLOR_RED, lerpValue) }) {
|
||||||
CLAY_TEXT(LOREM_IPSUM_TEXT, CLAY_TEXT_CONFIG({ .fontSize = 24, .fontId = FONT_ID_TITLE_56, .textColor = COLOR_LIGHT }));
|
CLAY_TEXT(LOREM_IPSUM_TEXT, CLAY_TEXT_CONFIG({ .fontSize = 24, .fontId = FONT_ID_TITLE_56, .textColor = COLOR_LIGHT }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -241,7 +241,7 @@ void HandleRendererButtonInteraction(Clay_ElementId elementId, Clay_PointerData
|
||||||
}
|
}
|
||||||
|
|
||||||
void RendererButtonActive(Clay_String text) {
|
void RendererButtonActive(Clay_String text) {
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = { .sizing = {CLAY_SIZING_FIXED(300) }, .padding = CLAY_PADDING_ALL(16) },
|
.layout = { .sizing = {CLAY_SIZING_FIXED(300) }, .padding = CLAY_PADDING_ALL(16) },
|
||||||
.backgroundColor = Clay_Hovered() ? COLOR_RED_HOVER : COLOR_RED,
|
.backgroundColor = Clay_Hovered() ? COLOR_RED_HOVER : COLOR_RED,
|
||||||
.cornerRadius = CLAY_CORNER_RADIUS(10),
|
.cornerRadius = CLAY_CORNER_RADIUS(10),
|
||||||
|
@ -252,7 +252,7 @@ void RendererButtonActive(Clay_String text) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void RendererButtonInactive(Clay_String text, size_t rendererIndex) {
|
void RendererButtonInactive(Clay_String text, size_t rendererIndex) {
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = { .sizing = {CLAY_SIZING_FIXED(300)}, .padding = CLAY_PADDING_ALL(16) },
|
.layout = { .sizing = {CLAY_SIZING_FIXED(300)}, .padding = CLAY_PADDING_ALL(16) },
|
||||||
.border = { .width = {2, 2, 2, 2}, .color = COLOR_RED },
|
.border = { .width = {2, 2, 2, 2}, .color = COLOR_RED },
|
||||||
.backgroundColor = Clay_Hovered() ? COLOR_LIGHT_HOVER : COLOR_LIGHT,
|
.backgroundColor = Clay_Hovered() ? COLOR_LIGHT_HOVER : COLOR_LIGHT,
|
||||||
|
@ -265,18 +265,18 @@ void RendererButtonInactive(Clay_String text, size_t rendererIndex) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void RendererPageDesktop() {
|
void RendererPageDesktop() {
|
||||||
CLAY({ .id = CLAY_ID("RendererPageDesktop"), .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_FIT(.min = windowHeight - 50) }, .childAlignment = {0, CLAY_ALIGN_Y_CENTER}, .padding = { 50, 50 } } }) {
|
CLAY(CLAY_ID("RendererPageDesktop"), { .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_FIT(.min = windowHeight - 50) }, .childAlignment = {0, CLAY_ALIGN_Y_CENTER}, .padding = { 50, 50 } } }) {
|
||||||
CLAY({ .id = CLAY_ID("RendererPage"), .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0) }, .childAlignment = { 0, CLAY_ALIGN_Y_CENTER }, .padding = CLAY_PADDING_ALL(32), .childGap = 32 }, .border = { .width = { .left = 2, .right = 2 }, .color = COLOR_RED } }) {
|
CLAY(CLAY_ID("RendererPage"), { .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0) }, .childAlignment = { 0, CLAY_ALIGN_Y_CENTER }, .padding = CLAY_PADDING_ALL(32), .childGap = 32 }, .border = { .width = { .left = 2, .right = 2 }, .color = COLOR_RED } }) {
|
||||||
CLAY({ .id = CLAY_ID("RendererLeftText"), .layout = { .sizing = { CLAY_SIZING_PERCENT(0.5) }, .layoutDirection = CLAY_TOP_TO_BOTTOM, .childGap = 8 } }) {
|
CLAY(CLAY_ID("RendererLeftText"), { .layout = { .sizing = { CLAY_SIZING_PERCENT(0.5) }, .layoutDirection = CLAY_TOP_TO_BOTTOM, .childGap = 8 } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("Renderer & Platform Agnostic"), CLAY_TEXT_CONFIG({ .fontSize = 52, .fontId = FONT_ID_TITLE_56, .textColor = COLOR_RED }));
|
CLAY_TEXT(CLAY_STRING("Renderer & Platform Agnostic"), CLAY_TEXT_CONFIG({ .fontSize = 52, .fontId = FONT_ID_TITLE_56, .textColor = COLOR_RED }));
|
||||||
CLAY({ .id = CLAY_ID("RendererSpacerLeft"), .layout = { .sizing = { CLAY_SIZING_GROW(.max = 16) }} }) {}
|
CLAY(CLAY_ID("RendererSpacerLeft"), { .layout = { .sizing = { CLAY_SIZING_GROW(.max = 16) }} }) {}
|
||||||
CLAY_TEXT(CLAY_STRING("Clay outputs a sorted array of primitive render commands, such as RECTANGLE, TEXT or IMAGE."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_RED }));
|
CLAY_TEXT(CLAY_STRING("Clay outputs a sorted array of primitive render commands, such as RECTANGLE, TEXT or IMAGE."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_RED }));
|
||||||
CLAY_TEXT(CLAY_STRING("Write your own renderer in a few hundred lines of code, or use the provided examples for Raylib, WebGL canvas and more."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_RED }));
|
CLAY_TEXT(CLAY_STRING("Write your own renderer in a few hundred lines of code, or use the provided examples for Raylib, WebGL canvas and more."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_RED }));
|
||||||
CLAY_TEXT(CLAY_STRING("There's even an HTML renderer - you're looking at it right now!"), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_RED }));
|
CLAY_TEXT(CLAY_STRING("There's even an HTML renderer - you're looking at it right now!"), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_RED }));
|
||||||
}
|
}
|
||||||
CLAY({ .id = CLAY_ID("RendererRightText"), .layout = { .sizing = { CLAY_SIZING_PERCENT(0.5) }, .childAlignment = {CLAY_ALIGN_X_CENTER}, .layoutDirection = CLAY_TOP_TO_BOTTOM, .childGap = 16 } }) {
|
CLAY(CLAY_ID("RendererRightText"), { .layout = { .sizing = { CLAY_SIZING_PERCENT(0.5) }, .childAlignment = {CLAY_ALIGN_X_CENTER}, .layoutDirection = CLAY_TOP_TO_BOTTOM, .childGap = 16 } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("Try changing renderer!"), CLAY_TEXT_CONFIG({ .fontSize = 36, .fontId = FONT_ID_BODY_36, .textColor = COLOR_ORANGE }));
|
CLAY_TEXT(CLAY_STRING("Try changing renderer!"), CLAY_TEXT_CONFIG({ .fontSize = 36, .fontId = FONT_ID_BODY_36, .textColor = COLOR_ORANGE }));
|
||||||
CLAY({ .id = CLAY_ID("RendererSpacerRight"), .layout = { .sizing = { CLAY_SIZING_GROW(.max = 32) } } }) {}
|
CLAY(CLAY_ID("RendererSpacerRight"), { .layout = { .sizing = { CLAY_SIZING_GROW(.max = 32) } } }) {}
|
||||||
if (ACTIVE_RENDERER_INDEX == 0) {
|
if (ACTIVE_RENDERER_INDEX == 0) {
|
||||||
RendererButtonActive(CLAY_STRING("HTML Renderer"));
|
RendererButtonActive(CLAY_STRING("HTML Renderer"));
|
||||||
RendererButtonInactive(CLAY_STRING("Canvas Renderer"), 1);
|
RendererButtonInactive(CLAY_STRING("Canvas Renderer"), 1);
|
||||||
|
@ -290,17 +290,17 @@ void RendererPageDesktop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void RendererPageMobile() {
|
void RendererPageMobile() {
|
||||||
CLAY({ .id = CLAY_ID("RendererMobile"), .layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM, .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_FIT(.min = windowHeight - 50) }, .childAlignment = {.x = CLAY_ALIGN_X_CENTER, .y = CLAY_ALIGN_Y_CENTER}, .padding = { 16, 16, 32, 32}, .childGap = 32 }, .backgroundColor = COLOR_LIGHT }) {
|
CLAY(CLAY_ID("RendererMobile"), { .layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM, .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_FIT(.min = windowHeight - 50) }, .childAlignment = {.x = CLAY_ALIGN_X_CENTER, .y = CLAY_ALIGN_Y_CENTER}, .padding = { 16, 16, 32, 32}, .childGap = 32 }, .backgroundColor = COLOR_LIGHT }) {
|
||||||
CLAY({ .id = CLAY_ID("RendererLeftText"), .layout = { .sizing = { CLAY_SIZING_GROW(0) }, .layoutDirection = CLAY_TOP_TO_BOTTOM, .childGap = 8 } }) {
|
CLAY(CLAY_ID("RendererLeftText"), { .layout = { .sizing = { CLAY_SIZING_GROW(0) }, .layoutDirection = CLAY_TOP_TO_BOTTOM, .childGap = 8 } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("Renderer & Platform Agnostic"), CLAY_TEXT_CONFIG({ .fontSize = 48, .fontId = FONT_ID_TITLE_56, .textColor = COLOR_RED }));
|
CLAY_TEXT(CLAY_STRING("Renderer & Platform Agnostic"), CLAY_TEXT_CONFIG({ .fontSize = 48, .fontId = FONT_ID_TITLE_56, .textColor = COLOR_RED }));
|
||||||
CLAY({ .id = CLAY_ID("RendererSpacerLeft"), .layout = { .sizing = { CLAY_SIZING_GROW(.max = 16) }} }) {}
|
CLAY(CLAY_ID("RendererSpacerLeft"), { .layout = { .sizing = { CLAY_SIZING_GROW(.max = 16) }} }) {}
|
||||||
CLAY_TEXT(CLAY_STRING("Clay outputs a sorted array of primitive render commands, such as RECTANGLE, TEXT or IMAGE."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_RED }));
|
CLAY_TEXT(CLAY_STRING("Clay outputs a sorted array of primitive render commands, such as RECTANGLE, TEXT or IMAGE."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_RED }));
|
||||||
CLAY_TEXT(CLAY_STRING("Write your own renderer in a few hundred lines of code, or use the provided examples for Raylib, WebGL canvas and more."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_RED }));
|
CLAY_TEXT(CLAY_STRING("Write your own renderer in a few hundred lines of code, or use the provided examples for Raylib, WebGL canvas and more."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_RED }));
|
||||||
CLAY_TEXT(CLAY_STRING("There's even an HTML renderer - you're looking at it right now!"), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_RED }));
|
CLAY_TEXT(CLAY_STRING("There's even an HTML renderer - you're looking at it right now!"), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_RED }));
|
||||||
}
|
}
|
||||||
CLAY({ .id = CLAY_ID("RendererRightText"), .layout = { .sizing = { CLAY_SIZING_GROW(0) }, .layoutDirection = CLAY_TOP_TO_BOTTOM, .childGap = 16 } }) {
|
CLAY(CLAY_ID("RendererRightText"), { .layout = { .sizing = { CLAY_SIZING_GROW(0) }, .layoutDirection = CLAY_TOP_TO_BOTTOM, .childGap = 16 } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("Try changing renderer!"), CLAY_TEXT_CONFIG({ .fontSize = 36, .fontId = FONT_ID_BODY_36, .textColor = COLOR_ORANGE }));
|
CLAY_TEXT(CLAY_STRING("Try changing renderer!"), CLAY_TEXT_CONFIG({ .fontSize = 36, .fontId = FONT_ID_BODY_36, .textColor = COLOR_ORANGE }));
|
||||||
CLAY({ .id = CLAY_ID("RendererSpacerRight"), .layout = { .sizing = { CLAY_SIZING_GROW(.max = 32) }} }) {}
|
CLAY(CLAY_ID("RendererSpacerRight"), { .layout = { .sizing = { CLAY_SIZING_GROW(.max = 32) }} }) {}
|
||||||
if (ACTIVE_RENDERER_INDEX == 0) {
|
if (ACTIVE_RENDERER_INDEX == 0) {
|
||||||
RendererButtonActive(CLAY_STRING("HTML Renderer"));
|
RendererButtonActive(CLAY_STRING("HTML Renderer"));
|
||||||
RendererButtonInactive(CLAY_STRING("Canvas Renderer"), 1);
|
RendererButtonInactive(CLAY_STRING("Canvas Renderer"), 1);
|
||||||
|
@ -313,17 +313,17 @@ void RendererPageMobile() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerPageDesktop() {
|
void DebuggerPageDesktop() {
|
||||||
CLAY({ .id = CLAY_ID("DebuggerDesktop"), .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_FIT(.min = windowHeight - 50) }, .childAlignment = {0, CLAY_ALIGN_Y_CENTER}, .padding = { 82, 82, 32, 32 }, .childGap = 64 }, .backgroundColor = COLOR_RED }) {
|
CLAY(CLAY_ID("DebuggerDesktop"), { .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_FIT(.min = windowHeight - 50) }, .childAlignment = {0, CLAY_ALIGN_Y_CENTER}, .padding = { 82, 82, 32, 32 }, .childGap = 64 }, .backgroundColor = COLOR_RED }) {
|
||||||
CLAY({ .id = CLAY_ID("DebuggerLeftText"), .layout = { .sizing = { CLAY_SIZING_PERCENT(0.5) }, .layoutDirection = CLAY_TOP_TO_BOTTOM, .childGap = 8 } }) {
|
CLAY(CLAY_ID("DebuggerLeftText"), { .layout = { .sizing = { CLAY_SIZING_PERCENT(0.5) }, .layoutDirection = CLAY_TOP_TO_BOTTOM, .childGap = 8 } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("Integrated Debug Tools"), CLAY_TEXT_CONFIG({ .fontSize = 52, .fontId = FONT_ID_TITLE_56, .textColor = COLOR_LIGHT }));
|
CLAY_TEXT(CLAY_STRING("Integrated Debug Tools"), CLAY_TEXT_CONFIG({ .fontSize = 52, .fontId = FONT_ID_TITLE_56, .textColor = COLOR_LIGHT }));
|
||||||
CLAY({ .id = CLAY_ID("DebuggerSpacer"), .layout = { .sizing = { CLAY_SIZING_GROW(.max = 16) }} }) {}
|
CLAY(CLAY_ID("DebuggerSpacer"), { .layout = { .sizing = { CLAY_SIZING_GROW(.max = 16) }} }) {}
|
||||||
CLAY_TEXT(CLAY_STRING("Clay includes built in \"Chrome Inspector\"-style debug tooling."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_LIGHT }));
|
CLAY_TEXT(CLAY_STRING("Clay includes built in \"Chrome Inspector\"-style debug tooling."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_LIGHT }));
|
||||||
CLAY_TEXT(CLAY_STRING("View your layout hierarchy and config in real time."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_LIGHT }));
|
CLAY_TEXT(CLAY_STRING("View your layout hierarchy and config in real time."), CLAY_TEXT_CONFIG({ .fontSize = 28, .fontId = FONT_ID_BODY_36, .textColor = COLOR_LIGHT }));
|
||||||
CLAY({ .id = CLAY_ID("DebuggerPageSpacer"), .layout = { .sizing = { .width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIXED(32) } } }) {}
|
CLAY(CLAY_ID("DebuggerPageSpacer"), { .layout = { .sizing = { .width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIXED(32) } } }) {}
|
||||||
CLAY_TEXT(CLAY_STRING("Press the \"d\" key to try it out now!"), CLAY_TEXT_CONFIG({ .fontSize = 32, .fontId = FONT_ID_TITLE_36, .textColor = COLOR_ORANGE }));
|
CLAY_TEXT(CLAY_STRING("Press the \"d\" key to try it out now!"), CLAY_TEXT_CONFIG({ .fontSize = 32, .fontId = FONT_ID_TITLE_36, .textColor = COLOR_ORANGE }));
|
||||||
}
|
}
|
||||||
CLAY({ .id = CLAY_ID("DebuggerRightImageOuter"), .layout = { .sizing = { CLAY_SIZING_PERCENT(0.50) }, .childAlignment = {CLAY_ALIGN_X_CENTER} } }) {
|
CLAY(CLAY_ID("DebuggerRightImageOuter"), { .layout = { .sizing = { CLAY_SIZING_PERCENT(0.50) }, .childAlignment = {CLAY_ALIGN_X_CENTER} } }) {
|
||||||
CLAY({ .id = CLAY_ID("DebuggerPageRightImageInner"), .layout = { .sizing = { CLAY_SIZING_GROW(.max = 558) } }, .aspectRatio = { 1620.0 / 1474.0 }, .image = {.imageData = FrameAllocateString(CLAY_STRING("/clay/images/debugger.png")) } }) {}
|
CLAY(CLAY_ID("DebuggerPageRightImageInner"), { .layout = { .sizing = { CLAY_SIZING_GROW(.max = 558) } }, .aspectRatio = { 1620.0 / 1474.0 }, .image = {.imageData = FrameAllocateString(CLAY_STRING("/clay/images/debugger.png")) } }) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -340,26 +340,26 @@ float animationLerpValue = -1.0f;
|
||||||
|
|
||||||
Clay_RenderCommandArray CreateLayout(bool mobileScreen, float lerpValue) {
|
Clay_RenderCommandArray CreateLayout(bool mobileScreen, float lerpValue) {
|
||||||
Clay_BeginLayout();
|
Clay_BeginLayout();
|
||||||
CLAY({ .id = CLAY_ID("OuterContainer"), .layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM, .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0) } }, .backgroundColor = COLOR_LIGHT }) {
|
CLAY(CLAY_ID("OuterContainer"), { .layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM, .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0) } }, .backgroundColor = COLOR_LIGHT }) {
|
||||||
CLAY({ .id = CLAY_ID("Header"), .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_FIXED(50) }, .childAlignment = { 0, CLAY_ALIGN_Y_CENTER }, .childGap = 16, .padding = { 32, 32 } } }) {
|
CLAY(CLAY_ID("Header"), { .layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_FIXED(50) }, .childAlignment = { 0, CLAY_ALIGN_Y_CENTER }, .childGap = 16, .padding = { 32, 32 } } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("Clay"), &headerTextConfig);
|
CLAY_TEXT(CLAY_STRING("Clay"), &headerTextConfig);
|
||||||
CLAY({ .id = CLAY_ID("Spacer"), .layout = { .sizing = { .width = CLAY_SIZING_GROW(0) } } }) {}
|
CLAY(CLAY_ID("Spacer"), { .layout = { .sizing = { .width = CLAY_SIZING_GROW(0) } } }) {}
|
||||||
if (!mobileScreen) {
|
if (!mobileScreen) {
|
||||||
CLAY({ .id = CLAY_ID("LinkExamplesOuter"), .layout = { .padding = {8, 8} } }) {
|
CLAY(CLAY_ID("LinkExamplesOuter"), { .layout = { .padding = {8, 8} } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("Examples"), CLAY_TEXT_CONFIG({
|
CLAY_TEXT(CLAY_STRING("Examples"), CLAY_TEXT_CONFIG({
|
||||||
.userData = FrameAllocateCustomData((CustomHTMLData) {
|
.userData = FrameAllocateCustomData((CustomHTMLData) {
|
||||||
.link = CLAY_STRING("https://github.com/nicbarker/clay/tree/main/examples")
|
.link = CLAY_STRING("https://github.com/nicbarker/clay/tree/main/examples")
|
||||||
}),
|
}),
|
||||||
.fontId = FONT_ID_BODY_24, .fontSize = 24, .textColor = {61, 26, 5, 255} }));
|
.fontId = FONT_ID_BODY_24, .fontSize = 24, .textColor = {61, 26, 5, 255} }));
|
||||||
}
|
}
|
||||||
CLAY({ .id = CLAY_ID("LinkDocsOuter"), .layout = { .padding = {8, 8} } }) {
|
CLAY(CLAY_ID("LinkDocsOuter"), { .layout = { .padding = {8, 8} } }) {
|
||||||
CLAY_TEXT(CLAY_STRING("Docs"), CLAY_TEXT_CONFIG({
|
CLAY_TEXT(CLAY_STRING("Docs"), CLAY_TEXT_CONFIG({
|
||||||
.userData = FrameAllocateCustomData((CustomHTMLData) { .link = CLAY_STRING("https://github.com/nicbarker/clay/blob/main/README.md") }),
|
.userData = FrameAllocateCustomData((CustomHTMLData) { .link = CLAY_STRING("https://github.com/nicbarker/clay/blob/main/README.md") }),
|
||||||
.fontId = FONT_ID_BODY_24, .fontSize = 24, .textColor = {61, 26, 5, 255} })
|
.fontId = FONT_ID_BODY_24, .fontSize = 24, .textColor = {61, 26, 5, 255} })
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = { .padding = {16, 16, 6, 6} },
|
.layout = { .padding = {16, 16, 6, 6} },
|
||||||
.backgroundColor = Clay_Hovered() ? COLOR_LIGHT_HOVER : COLOR_LIGHT,
|
.backgroundColor = Clay_Hovered() ? COLOR_LIGHT_HOVER : COLOR_LIGHT,
|
||||||
.border = { .width = {2, 2, 2, 2}, .color = COLOR_RED },
|
.border = { .width = {2, 2, 2, 2}, .color = COLOR_RED },
|
||||||
|
@ -370,7 +370,7 @@ Clay_RenderCommandArray CreateLayout(bool mobileScreen, float lerpValue) {
|
||||||
.userData = FrameAllocateCustomData((CustomHTMLData) { .disablePointerEvents = true }),
|
.userData = FrameAllocateCustomData((CustomHTMLData) { .disablePointerEvents = true }),
|
||||||
.fontId = FONT_ID_BODY_24, .fontSize = 24, .textColor = {61, 26, 5, 255} }));
|
.fontId = FONT_ID_BODY_24, .fontSize = 24, .textColor = {61, 26, 5, 255} }));
|
||||||
}
|
}
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = { .padding = {16, 16, 6, 6} },
|
.layout = { .padding = {16, 16, 6, 6} },
|
||||||
.backgroundColor = Clay_Hovered() ? COLOR_LIGHT_HOVER : COLOR_LIGHT,
|
.backgroundColor = Clay_Hovered() ? COLOR_LIGHT_HOVER : COLOR_LIGHT,
|
||||||
.border = { .width = {2, 2, 2, 2}, .color = COLOR_RED },
|
.border = { .width = {2, 2, 2, 2}, .color = COLOR_RED },
|
||||||
|
@ -383,12 +383,12 @@ Clay_RenderCommandArray CreateLayout(bool mobileScreen, float lerpValue) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Clay_LayoutConfig topBorderConfig = (Clay_LayoutConfig) { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_FIXED(4) }};
|
Clay_LayoutConfig topBorderConfig = (Clay_LayoutConfig) { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_FIXED(4) }};
|
||||||
CLAY({ .id = CLAY_ID("TopBorder1"), .layout = topBorderConfig, .backgroundColor = COLOR_TOP_BORDER_5 }) {}
|
CLAY(CLAY_ID("TopBorder1"), { .layout = topBorderConfig, .backgroundColor = COLOR_TOP_BORDER_5 }) {}
|
||||||
CLAY({ .id = CLAY_ID("TopBorder2"), .layout = topBorderConfig, .backgroundColor = COLOR_TOP_BORDER_4 }) {}
|
CLAY(CLAY_ID("TopBorder2"), { .layout = topBorderConfig, .backgroundColor = COLOR_TOP_BORDER_4 }) {}
|
||||||
CLAY({ .id = CLAY_ID("TopBorder3"), .layout = topBorderConfig, .backgroundColor = COLOR_TOP_BORDER_3 }) {}
|
CLAY(CLAY_ID("TopBorder3"), { .layout = topBorderConfig, .backgroundColor = COLOR_TOP_BORDER_3 }) {}
|
||||||
CLAY({ .id = CLAY_ID("TopBorder4"), .layout = topBorderConfig, .backgroundColor = COLOR_TOP_BORDER_2 }) {}
|
CLAY(CLAY_ID("TopBorder4"), { .layout = topBorderConfig, .backgroundColor = COLOR_TOP_BORDER_2 }) {}
|
||||||
CLAY({ .id = CLAY_ID("TopBorder5"), .layout = topBorderConfig, .backgroundColor = COLOR_TOP_BORDER_1 }) {}
|
CLAY(CLAY_ID("TopBorder5"), { .layout = topBorderConfig, .backgroundColor = COLOR_TOP_BORDER_1 }) {}
|
||||||
CLAY({ .id = CLAY_ID("OuterScrollContainer"),
|
CLAY(CLAY_ID("OuterScrollContainer"), {
|
||||||
.layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0) }, .layoutDirection = CLAY_TOP_TO_BOTTOM },
|
.layout = { .sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0) }, .layoutDirection = CLAY_TOP_TO_BOTTOM },
|
||||||
.clip = { .vertical = true, .childOffset = Clay_GetScrollOffset() },
|
.clip = { .vertical = true, .childOffset = Clay_GetScrollOffset() },
|
||||||
.border = { .width = { .betweenChildren = 2 }, .color = COLOR_RED }
|
.border = { .width = { .betweenChildren = 2 }, .color = COLOR_RED }
|
||||||
|
@ -419,8 +419,7 @@ Clay_RenderCommandArray CreateLayout(bool mobileScreen, float lerpValue) {
|
||||||
scrollbarColor = (Clay_Color){225, 138, 50, 160};
|
scrollbarColor = (Clay_Color){225, 138, 50, 160};
|
||||||
}
|
}
|
||||||
float scrollHeight = scrollData.scrollContainerDimensions.height - 12;
|
float scrollHeight = scrollData.scrollContainerDimensions.height - 12;
|
||||||
CLAY({
|
CLAY(CLAY_ID("ScrollBar"), {
|
||||||
.id = CLAY_ID("ScrollBar"),
|
|
||||||
.floating = { .offset = { .x = -6, .y = -(scrollData.scrollPosition->y / scrollData.contentDimensions.height) * scrollHeight + 6}, .zIndex = 1, .parentId = Clay_GetElementId(CLAY_STRING("OuterScrollContainer")).id, .attachPoints = {.element = CLAY_ATTACH_POINT_RIGHT_TOP, .parent = CLAY_ATTACH_POINT_RIGHT_TOP }, .attachTo = CLAY_ATTACH_TO_PARENT },
|
.floating = { .offset = { .x = -6, .y = -(scrollData.scrollPosition->y / scrollData.contentDimensions.height) * scrollHeight + 6}, .zIndex = 1, .parentId = Clay_GetElementId(CLAY_STRING("OuterScrollContainer")).id, .attachPoints = {.element = CLAY_ATTACH_POINT_RIGHT_TOP, .parent = CLAY_ATTACH_POINT_RIGHT_TOP }, .attachTo = CLAY_ATTACH_TO_PARENT },
|
||||||
.layout = { .sizing = {CLAY_SIZING_FIXED(10), CLAY_SIZING_FIXED((scrollHeight / scrollData.contentDimensions.height) * scrollHeight)} },
|
.layout = { .sizing = {CLAY_SIZING_FIXED(10), CLAY_SIZING_FIXED((scrollHeight / scrollData.contentDimensions.height) * scrollHeight)} },
|
||||||
.backgroundColor = scrollbarColor,
|
.backgroundColor = scrollbarColor,
|
||||||
|
|
|
@ -13,7 +13,7 @@ int main(void) {
|
||||||
Clay_Arena clayMemory = Clay_CreateArenaWithCapacityAndMemory(totalMemorySize, (char *)malloc(totalMemorySize));
|
Clay_Arena clayMemory = Clay_CreateArenaWithCapacityAndMemory(totalMemorySize, (char *)malloc(totalMemorySize));
|
||||||
Clay_Initialize(clayMemory, Clay_Dimensions {1024,768}, Clay_ErrorHandler { HandleClayErrors });
|
Clay_Initialize(clayMemory, Clay_Dimensions {1024,768}, Clay_ErrorHandler { HandleClayErrors });
|
||||||
Clay_BeginLayout();
|
Clay_BeginLayout();
|
||||||
CLAY({ .layout = layoutElement, .backgroundColor = {255,255,255,0} }) {
|
CLAY_AUTO_ID({ .layout = layoutElement, .backgroundColor = {255,255,255,0} }) {
|
||||||
CLAY_TEXT(CLAY_STRING(""), CLAY_TEXT_CONFIG({ .fontId = 0 }));
|
CLAY_TEXT(CLAY_STRING(""), CLAY_TEXT_CONFIG({ .fontId = 0 }));
|
||||||
}
|
}
|
||||||
Clay_EndLayout();
|
Clay_EndLayout();
|
||||||
|
|
|
@ -18,7 +18,7 @@ Clay_Color COLOR_WHITE = { 255, 255, 255, 255 };
|
||||||
Clay_Color COLOR_BLACK = { 0, 0, 0, 255 };
|
Clay_Color COLOR_BLACK = { 0, 0, 0, 255 };
|
||||||
|
|
||||||
void RenderHeaderButton(Clay_String text) {
|
void RenderHeaderButton(Clay_String text) {
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = { .padding = { 8, 8, 4, 4 } },
|
.layout = { .padding = { 8, 8, 4, 4 } },
|
||||||
.backgroundColor = COLOR_BLACK,
|
.backgroundColor = COLOR_BLACK,
|
||||||
.cornerRadius = CLAY_CORNER_RADIUS(4)
|
.cornerRadius = CLAY_CORNER_RADIUS(4)
|
||||||
|
@ -212,8 +212,7 @@ Clay_RenderCommandArray ClayVideoDemoPlaydate_CreateLayout(int selectedDocumentI
|
||||||
};
|
};
|
||||||
|
|
||||||
// Build UI here
|
// Build UI here
|
||||||
CLAY({
|
CLAY(CLAY_ID("OuterContainer"), {
|
||||||
.id = CLAY_ID("OuterContainer"),
|
|
||||||
.backgroundColor = COLOR_WHITE,
|
.backgroundColor = COLOR_WHITE,
|
||||||
.layout = {
|
.layout = {
|
||||||
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
||||||
|
@ -223,8 +222,7 @@ Clay_RenderCommandArray ClayVideoDemoPlaydate_CreateLayout(int selectedDocumentI
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
// Child elements go inside braces
|
// Child elements go inside braces
|
||||||
CLAY({
|
CLAY(CLAY_ID("HeaderBar"), {
|
||||||
.id = CLAY_ID("HeaderBar"),
|
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = {
|
.sizing = {
|
||||||
.height = CLAY_SIZING_FIXED(30),
|
.height = CLAY_SIZING_FIXED(30),
|
||||||
|
@ -235,8 +233,7 @@ Clay_RenderCommandArray ClayVideoDemoPlaydate_CreateLayout(int selectedDocumentI
|
||||||
},
|
},
|
||||||
}) {
|
}) {
|
||||||
// Header buttons go here
|
// Header buttons go here
|
||||||
CLAY({
|
CLAY(CLAY_ID("FileButton"), {
|
||||||
.id = CLAY_ID("FileButton"),
|
|
||||||
.layout = {
|
.layout = {
|
||||||
.padding = { 8, 8, 4, 4 }
|
.padding = { 8, 8, 4, 4 }
|
||||||
},
|
},
|
||||||
|
@ -252,18 +249,16 @@ Clay_RenderCommandArray ClayVideoDemoPlaydate_CreateLayout(int selectedDocumentI
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
RenderHeaderButton(CLAY_STRING("Edit"));
|
RenderHeaderButton(CLAY_STRING("Edit"));
|
||||||
CLAY({ .layout = { .sizing = { CLAY_SIZING_GROW(0) } } }) {}
|
CLAY_AUTO_ID({ .layout = { .sizing = { CLAY_SIZING_GROW(0) } } }) {}
|
||||||
RenderHeaderButton(CLAY_STRING("Upload"));
|
RenderHeaderButton(CLAY_STRING("Upload"));
|
||||||
RenderHeaderButton(CLAY_STRING("Media"));
|
RenderHeaderButton(CLAY_STRING("Media"));
|
||||||
RenderHeaderButton(CLAY_STRING("Support"));
|
RenderHeaderButton(CLAY_STRING("Support"));
|
||||||
}
|
}
|
||||||
|
|
||||||
CLAY({
|
CLAY(CLAY_ID("LowerContent"), {
|
||||||
.id = CLAY_ID("LowerContent"),
|
|
||||||
.layout = { .sizing = layoutExpand, .childGap = 8 },
|
.layout = { .sizing = layoutExpand, .childGap = 8 },
|
||||||
}) {
|
}) {
|
||||||
CLAY({
|
CLAY(CLAY_ID("Sidebar"), {
|
||||||
.id = CLAY_ID("Sidebar"),
|
|
||||||
.border = contentBorders,
|
.border = contentBorders,
|
||||||
.cornerRadius = CLAY_CORNER_RADIUS(4),
|
.cornerRadius = CLAY_CORNER_RADIUS(4),
|
||||||
.layout = {
|
.layout = {
|
||||||
|
@ -284,7 +279,7 @@ Clay_RenderCommandArray ClayVideoDemoPlaydate_CreateLayout(int selectedDocumentI
|
||||||
};
|
};
|
||||||
|
|
||||||
if (i == selectedDocumentIndex) {
|
if (i == selectedDocumentIndex) {
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = sidebarButtonLayout,
|
.layout = sidebarButtonLayout,
|
||||||
.backgroundColor = COLOR_BLACK,
|
.backgroundColor = COLOR_BLACK,
|
||||||
.cornerRadius = CLAY_CORNER_RADIUS(4)
|
.cornerRadius = CLAY_CORNER_RADIUS(4)
|
||||||
|
@ -298,7 +293,7 @@ Clay_RenderCommandArray ClayVideoDemoPlaydate_CreateLayout(int selectedDocumentI
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = sidebarButtonLayout,
|
.layout = sidebarButtonLayout,
|
||||||
.backgroundColor = (Clay_Color){ 0, 0, 0, Clay_Hovered() ? 120 : 0 },
|
.backgroundColor = (Clay_Color){ 0, 0, 0, Clay_Hovered() ? 120 : 0 },
|
||||||
.cornerRadius = CLAY_CORNER_RADIUS(4),
|
.cornerRadius = CLAY_CORNER_RADIUS(4),
|
||||||
|
@ -316,8 +311,7 @@ Clay_RenderCommandArray ClayVideoDemoPlaydate_CreateLayout(int selectedDocumentI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CLAY({
|
CLAY(CLAY_ID("MainContent"), {
|
||||||
.id = CLAY_ID("MainContent"),
|
|
||||||
.border = contentBorders,
|
.border = contentBorders,
|
||||||
.cornerRadius = CLAY_CORNER_RADIUS(4),
|
.cornerRadius = CLAY_CORNER_RADIUS(4),
|
||||||
.clip = { .vertical = true, .childOffset = Clay_GetScrollOffset() },
|
.clip = { .vertical = true, .childOffset = Clay_GetScrollOffset() },
|
||||||
|
@ -329,7 +323,7 @@ Clay_RenderCommandArray ClayVideoDemoPlaydate_CreateLayout(int selectedDocumentI
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
Document selectedDocument = documents.documents[selectedDocumentIndex];
|
Document selectedDocument = documents.documents[selectedDocumentIndex];
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.layoutDirection = CLAY_LEFT_TO_RIGHT,
|
.layoutDirection = CLAY_LEFT_TO_RIGHT,
|
||||||
.childGap = 4,
|
.childGap = 4,
|
||||||
|
@ -340,7 +334,7 @@ Clay_RenderCommandArray ClayVideoDemoPlaydate_CreateLayout(int selectedDocumentI
|
||||||
selectedDocument.title,
|
selectedDocument.title,
|
||||||
CLAY_TEXT_CONFIG({ .fontId = FONT_ID_BODY, .textColor = COLOR_BLACK })
|
CLAY_TEXT_CONFIG({ .fontId = FONT_ID_BODY, .textColor = COLOR_BLACK })
|
||||||
);
|
);
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = {
|
.sizing = {
|
||||||
.width = CLAY_SIZING_FIXED(32),
|
.width = CLAY_SIZING_FIXED(32),
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -3,7 +3,7 @@
|
||||||
// NOTE: This file only exists to make sure that clay works when included in multiple translation units.
|
// NOTE: This file only exists to make sure that clay works when included in multiple translation units.
|
||||||
|
|
||||||
void SatisfyCompiler(void) {
|
void SatisfyCompiler(void) {
|
||||||
CLAY({ .id = CLAY_ID("SatisfyCompiler") }) {
|
CLAY(CLAY_ID("SatisfyCompiler"), { }) {
|
||||||
CLAY_TEXT(CLAY_STRING("Test"), CLAY_TEXT_CONFIG({ .fontId = 0, .fontSize = 24 }));
|
CLAY_TEXT(CLAY_STRING("Test"), CLAY_TEXT_CONFIG({ .fontId = 0, .fontSize = 24 }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ const int FONT_ID_BODY_16 = 0;
|
||||||
Clay_Color COLOR_WHITE = { 255, 255, 255, 255};
|
Clay_Color COLOR_WHITE = { 255, 255, 255, 255};
|
||||||
|
|
||||||
void RenderHeaderButton(Clay_String text) {
|
void RenderHeaderButton(Clay_String text) {
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = { .padding = { 16, 16, 8, 8 }},
|
.layout = { .padding = { 16, 16, 8, 8 }},
|
||||||
.backgroundColor = { 140, 140, 140, 255 },
|
.backgroundColor = { 140, 140, 140, 255 },
|
||||||
.cornerRadius = CLAY_CORNER_RADIUS(5)
|
.cornerRadius = CLAY_CORNER_RADIUS(5)
|
||||||
|
@ -19,7 +19,7 @@ void RenderHeaderButton(Clay_String text) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderDropdownMenuItem(Clay_String text) {
|
void RenderDropdownMenuItem(Clay_String text) {
|
||||||
CLAY({.layout = { .padding = CLAY_PADDING_ALL(16)}}) {
|
CLAY_AUTO_ID({.layout = { .padding = CLAY_PADDING_ALL(16)}}) {
|
||||||
CLAY_TEXT(text, CLAY_TEXT_CONFIG({
|
CLAY_TEXT(text, CLAY_TEXT_CONFIG({
|
||||||
.fontId = FONT_ID_BODY_16,
|
.fontId = FONT_ID_BODY_16,
|
||||||
.fontSize = 16,
|
.fontSize = 16,
|
||||||
|
@ -102,7 +102,7 @@ Clay_RenderCommandArray ClayVideoDemo_CreateLayout(ClayVideoDemo_Data *data) {
|
||||||
Clay_Color contentBackgroundColor = { 90, 90, 90, 255 };
|
Clay_Color contentBackgroundColor = { 90, 90, 90, 255 };
|
||||||
|
|
||||||
// Build UI here
|
// Build UI here
|
||||||
CLAY({ .id = CLAY_ID("OuterContainer"),
|
CLAY(CLAY_ID("OuterContainer"), {
|
||||||
.backgroundColor = {43, 41, 51, 255 },
|
.backgroundColor = {43, 41, 51, 255 },
|
||||||
.layout = {
|
.layout = {
|
||||||
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
||||||
|
@ -112,7 +112,7 @@ Clay_RenderCommandArray ClayVideoDemo_CreateLayout(ClayVideoDemo_Data *data) {
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
// Child elements go inside braces
|
// Child elements go inside braces
|
||||||
CLAY({ .id = CLAY_ID("HeaderBar"),
|
CLAY(CLAY_ID("HeaderBar"), {
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = {
|
.sizing = {
|
||||||
.height = CLAY_SIZING_FIXED(60),
|
.height = CLAY_SIZING_FIXED(60),
|
||||||
|
@ -128,7 +128,7 @@ Clay_RenderCommandArray ClayVideoDemo_CreateLayout(ClayVideoDemo_Data *data) {
|
||||||
.cornerRadius = CLAY_CORNER_RADIUS(8)
|
.cornerRadius = CLAY_CORNER_RADIUS(8)
|
||||||
}) {
|
}) {
|
||||||
// Header buttons go here
|
// Header buttons go here
|
||||||
CLAY({ .id = CLAY_ID("FileButton"),
|
CLAY(CLAY_ID("FileButton"), {
|
||||||
.layout = { .padding = { 16, 16, 8, 8 }},
|
.layout = { .padding = { 16, 16, 8, 8 }},
|
||||||
.backgroundColor = {140, 140, 140, 255 },
|
.backgroundColor = {140, 140, 140, 255 },
|
||||||
.cornerRadius = CLAY_CORNER_RADIUS(5)
|
.cornerRadius = CLAY_CORNER_RADIUS(5)
|
||||||
|
@ -145,7 +145,7 @@ Clay_RenderCommandArray ClayVideoDemo_CreateLayout(ClayVideoDemo_Data *data) {
|
||||||
Clay_PointerOver(Clay_GetElementId(CLAY_STRING("FileMenu")));
|
Clay_PointerOver(Clay_GetElementId(CLAY_STRING("FileMenu")));
|
||||||
|
|
||||||
if (fileMenuVisible) { // Below has been changed slightly to fix the small bug where the menu would dismiss when mousing over the top gap
|
if (fileMenuVisible) { // Below has been changed slightly to fix the small bug where the menu would dismiss when mousing over the top gap
|
||||||
CLAY({ .id = CLAY_ID("FileMenu"),
|
CLAY(CLAY_ID("FileMenu"), {
|
||||||
.floating = {
|
.floating = {
|
||||||
.attachTo = CLAY_ATTACH_TO_PARENT,
|
.attachTo = CLAY_ATTACH_TO_PARENT,
|
||||||
.attachPoints = {
|
.attachPoints = {
|
||||||
|
@ -156,7 +156,7 @@ Clay_RenderCommandArray ClayVideoDemo_CreateLayout(ClayVideoDemo_Data *data) {
|
||||||
.padding = {0, 0, 8, 8 }
|
.padding = {0, 0, 8, 8 }
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
||||||
.sizing = {
|
.sizing = {
|
||||||
|
@ -175,18 +175,16 @@ Clay_RenderCommandArray ClayVideoDemo_CreateLayout(ClayVideoDemo_Data *data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RenderHeaderButton(CLAY_STRING("Edit"));
|
RenderHeaderButton(CLAY_STRING("Edit"));
|
||||||
CLAY({ .layout = { .sizing = { CLAY_SIZING_GROW(0) }}}) {}
|
CLAY_AUTO_ID({ .layout = { .sizing = { CLAY_SIZING_GROW(0) }}}) {}
|
||||||
RenderHeaderButton(CLAY_STRING("Upload"));
|
RenderHeaderButton(CLAY_STRING("Upload"));
|
||||||
RenderHeaderButton(CLAY_STRING("Media"));
|
RenderHeaderButton(CLAY_STRING("Media"));
|
||||||
RenderHeaderButton(CLAY_STRING("Support"));
|
RenderHeaderButton(CLAY_STRING("Support"));
|
||||||
}
|
}
|
||||||
|
|
||||||
CLAY({
|
CLAY(CLAY_ID("LowerContent"), {
|
||||||
.id = CLAY_ID("LowerContent"),
|
|
||||||
.layout = { .sizing = layoutExpand, .childGap = 16 }
|
.layout = { .sizing = layoutExpand, .childGap = 16 }
|
||||||
}) {
|
}) {
|
||||||
CLAY({
|
CLAY(CLAY_ID("Sidebar"), {
|
||||||
.id = CLAY_ID("Sidebar"),
|
|
||||||
.backgroundColor = contentBackgroundColor,
|
.backgroundColor = contentBackgroundColor,
|
||||||
.layout = {
|
.layout = {
|
||||||
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
||||||
|
@ -206,7 +204,7 @@ Clay_RenderCommandArray ClayVideoDemo_CreateLayout(ClayVideoDemo_Data *data) {
|
||||||
};
|
};
|
||||||
|
|
||||||
if (i == data->selectedDocumentIndex) {
|
if (i == data->selectedDocumentIndex) {
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = sidebarButtonLayout,
|
.layout = sidebarButtonLayout,
|
||||||
.backgroundColor = {120, 120, 120, 255 },
|
.backgroundColor = {120, 120, 120, 255 },
|
||||||
.cornerRadius = CLAY_CORNER_RADIUS(8)
|
.cornerRadius = CLAY_CORNER_RADIUS(8)
|
||||||
|
@ -221,7 +219,7 @@ Clay_RenderCommandArray ClayVideoDemo_CreateLayout(ClayVideoDemo_Data *data) {
|
||||||
SidebarClickData *clickData = (SidebarClickData *)(data->frameArena.memory + data->frameArena.offset);
|
SidebarClickData *clickData = (SidebarClickData *)(data->frameArena.memory + data->frameArena.offset);
|
||||||
*clickData = (SidebarClickData) { .requestedDocumentIndex = i, .selectedDocumentIndex = &data->selectedDocumentIndex };
|
*clickData = (SidebarClickData) { .requestedDocumentIndex = i, .selectedDocumentIndex = &data->selectedDocumentIndex };
|
||||||
data->frameArena.offset += sizeof(SidebarClickData);
|
data->frameArena.offset += sizeof(SidebarClickData);
|
||||||
CLAY({ .layout = sidebarButtonLayout, .backgroundColor = (Clay_Color) { 120, 120, 120, Clay_Hovered() ? 120 : 0 }, .cornerRadius = CLAY_CORNER_RADIUS(8) }) {
|
CLAY_AUTO_ID({ .layout = sidebarButtonLayout, .backgroundColor = (Clay_Color) { 120, 120, 120, Clay_Hovered() ? 120 : 0 }, .cornerRadius = CLAY_CORNER_RADIUS(8) }) {
|
||||||
Clay_OnHover(HandleSidebarInteraction, (intptr_t)clickData);
|
Clay_OnHover(HandleSidebarInteraction, (intptr_t)clickData);
|
||||||
CLAY_TEXT(document.title, CLAY_TEXT_CONFIG({
|
CLAY_TEXT(document.title, CLAY_TEXT_CONFIG({
|
||||||
.fontId = FONT_ID_BODY_16,
|
.fontId = FONT_ID_BODY_16,
|
||||||
|
@ -233,7 +231,7 @@ Clay_RenderCommandArray ClayVideoDemo_CreateLayout(ClayVideoDemo_Data *data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CLAY({ .id = CLAY_ID("MainContent"),
|
CLAY(CLAY_ID("MainContent"), {
|
||||||
.backgroundColor = contentBackgroundColor,
|
.backgroundColor = contentBackgroundColor,
|
||||||
.clip = { .vertical = true, .childOffset = Clay_GetScrollOffset() },
|
.clip = { .vertical = true, .childOffset = Clay_GetScrollOffset() },
|
||||||
.layout = {
|
.layout = {
|
||||||
|
|
|
@ -33,7 +33,7 @@ Clay_RenderCommandArray CornerRadiusTest(){
|
||||||
.width = CLAY_SIZING_GROW(0),
|
.width = CLAY_SIZING_GROW(0),
|
||||||
.height = CLAY_SIZING_GROW(0)
|
.height = CLAY_SIZING_GROW(0)
|
||||||
};
|
};
|
||||||
CLAY({ .id = CLAY_ID("OuterContainer"),
|
CLAY(CLAY_ID("OuterContainer"), {
|
||||||
.backgroundColor = {43, 41, 51, 255},
|
.backgroundColor = {43, 41, 51, 255},
|
||||||
.layout = {
|
.layout = {
|
||||||
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
||||||
|
@ -43,7 +43,7 @@ Clay_RenderCommandArray CornerRadiusTest(){
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
for(int i = 0; i < 6; ++i){
|
for(int i = 0; i < 6; ++i){
|
||||||
CLAY({ .id = CLAY_IDI("Row", i),
|
CLAY(CLAY_IDI("Row", i), {
|
||||||
.layout = {
|
.layout = {
|
||||||
.layoutDirection = CLAY_LEFT_TO_RIGHT,
|
.layoutDirection = CLAY_LEFT_TO_RIGHT,
|
||||||
.sizing = layoutExpand,
|
.sizing = layoutExpand,
|
||||||
|
@ -52,7 +52,7 @@ Clay_RenderCommandArray CornerRadiusTest(){
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
for(int j = 0; j < 6; ++j){
|
for(int j = 0; j < 6; ++j){
|
||||||
CLAY({ .id = CLAY_IDI("Tile", i*6+j),
|
CLAY(CLAY_IDI("Tile", i*6+j), {
|
||||||
.backgroundColor = {120, 140, 255, 128},
|
.backgroundColor = {120, 140, 255, 128},
|
||||||
.cornerRadius = {(i%3)*15, (j%3)*15, (i/2)*15, (j/2)*15},
|
.cornerRadius = {(i%3)*15, (j%3)*15, (i/2)*15, (j/2)*15},
|
||||||
.border = {
|
.border = {
|
||||||
|
|
|
@ -70,7 +70,7 @@ void component_text_pair(const char *key, const char *value)
|
||||||
};
|
};
|
||||||
Clay_TextElementConfig *textconfig =
|
Clay_TextElementConfig *textconfig =
|
||||||
CLAY_TEXT_CONFIG({ .textColor = { 0xff, 0xff, 0xff, 0xff } });
|
CLAY_TEXT_CONFIG({ .textColor = { 0xff, 0xff, 0xff, 0xff } });
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = {
|
.sizing = {
|
||||||
.width = {
|
.width = {
|
||||||
|
@ -82,7 +82,7 @@ void component_text_pair(const char *key, const char *value)
|
||||||
},
|
},
|
||||||
}) {
|
}) {
|
||||||
CLAY_TEXT(keytext, textconfig);
|
CLAY_TEXT(keytext, textconfig);
|
||||||
CLAY({ .layout = { .sizing = CLAY_SIZING_GROW(1) } }) { }
|
CLAY_AUTO_ID({ .layout = { .sizing = CLAY_SIZING_GROW(1) } }) { }
|
||||||
CLAY_TEXT(valtext, textconfig);
|
CLAY_TEXT(valtext, textconfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ void component_text_pair(const char *key, const char *value)
|
||||||
|
|
||||||
void component_termbox_settings(void)
|
void component_termbox_settings(void)
|
||||||
{
|
{
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.floating = {
|
.floating = {
|
||||||
.attachTo = CLAY_ATTACH_TO_PARENT,
|
.attachTo = CLAY_ATTACH_TO_PARENT,
|
||||||
.zIndex = 1,
|
.zIndex = 1,
|
||||||
|
@ -98,7 +98,7 @@ void component_termbox_settings(void)
|
||||||
.offset = { 0, 0 }
|
.offset = { 0, 0 }
|
||||||
},
|
},
|
||||||
}) {
|
}) {
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = CLAY_SIZING_FIT(),
|
.sizing = CLAY_SIZING_FIT(),
|
||||||
.padding = {
|
.padding = {
|
||||||
|
@ -229,7 +229,7 @@ void component_termbox_settings(void)
|
||||||
transparency = "false";
|
transparency = "false";
|
||||||
}
|
}
|
||||||
|
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM },
|
.layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM },
|
||||||
}) {
|
}) {
|
||||||
component_text_pair("Color mode", color_mode);
|
component_text_pair("Color mode", color_mode);
|
||||||
|
@ -244,7 +244,7 @@ void component_termbox_settings(void)
|
||||||
|
|
||||||
void component_color_palette(void)
|
void component_color_palette(void)
|
||||||
{
|
{
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.childGap = 16,
|
.childGap = 16,
|
||||||
.padding = {
|
.padding = {
|
||||||
|
@ -261,7 +261,7 @@ void component_color_palette(void)
|
||||||
.backgroundColor = { 0x7f, 0x7f, 0x7f, 0xff }
|
.backgroundColor = { 0x7f, 0x7f, 0x7f, 0xff }
|
||||||
}) {
|
}) {
|
||||||
for (int type = 0; type < 2; ++type) {
|
for (int type = 0; type < 2; ++type) {
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout ={
|
.layout ={
|
||||||
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
||||||
.sizing = CLAY_SIZING_FIT(),
|
.sizing = CLAY_SIZING_FIT(),
|
||||||
|
@ -269,21 +269,21 @@ void component_color_palette(void)
|
||||||
},
|
},
|
||||||
}) {
|
}) {
|
||||||
for (float ri = 0; ri < 4; ri += 1) {
|
for (float ri = 0; ri < 4; ri += 1) {
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout ={
|
.layout ={
|
||||||
.sizing = CLAY_SIZING_FIT(),
|
.sizing = CLAY_SIZING_FIT(),
|
||||||
.childGap = Clay_Termbox_Cell_Width()
|
.childGap = Clay_Termbox_Cell_Width()
|
||||||
},
|
},
|
||||||
}) {
|
}) {
|
||||||
for (float r = ri * 0x44; r < (ri + 1) * 0x44; r += 0x22) {
|
for (float r = ri * 0x44; r < (ri + 1) * 0x44; r += 0x22) {
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout ={
|
.layout ={
|
||||||
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
||||||
.sizing = CLAY_SIZING_FIT(),
|
.sizing = CLAY_SIZING_FIT(),
|
||||||
},
|
},
|
||||||
}) {
|
}) {
|
||||||
for (float g = 0; g < 0xff; g += 0x22) {
|
for (float g = 0; g < 0xff; g += 0x22) {
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout ={
|
.layout ={
|
||||||
.sizing = CLAY_SIZING_FIT(),
|
.sizing = CLAY_SIZING_FIT(),
|
||||||
},
|
},
|
||||||
|
@ -298,12 +298,12 @@ void component_color_palette(void)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (0 == type) {
|
if (0 == type) {
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = layout,
|
.layout = layout,
|
||||||
.backgroundColor = color
|
.backgroundColor = color
|
||||||
}) {}
|
}) {}
|
||||||
} else if (1 == type) {
|
} else if (1 == type) {
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = layout,
|
.layout = layout,
|
||||||
}) {
|
}) {
|
||||||
CLAY_TEXT(CLAY_STRING("#"), CLAY_TEXT_CONFIG({ .textColor = color }));
|
CLAY_TEXT(CLAY_STRING("#"), CLAY_TEXT_CONFIG({ .textColor = color }));
|
||||||
|
@ -323,7 +323,7 @@ void component_color_palette(void)
|
||||||
|
|
||||||
void component_unicode_text(void)
|
void component_unicode_text(void)
|
||||||
{
|
{
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = CLAY_SIZING_FIT(),
|
.sizing = CLAY_SIZING_FIT(),
|
||||||
.padding = {
|
.padding = {
|
||||||
|
@ -377,7 +377,7 @@ void component_unicode_text(void)
|
||||||
|
|
||||||
void component_keybinds(void)
|
void component_keybinds(void)
|
||||||
{
|
{
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = CLAY_SIZING_FIT(),
|
.sizing = CLAY_SIZING_FIT(),
|
||||||
.padding = {
|
.padding = {
|
||||||
|
@ -409,7 +409,7 @@ void component_keybinds(void)
|
||||||
|
|
||||||
void component_image(clay_tb_image *image, int width)
|
void component_image(clay_tb_image *image, int width)
|
||||||
{
|
{
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = {
|
.sizing = {
|
||||||
.width = (0 == width) ? CLAY_SIZING_GROW() : CLAY_SIZING_FIXED(width),
|
.width = (0 == width) ? CLAY_SIZING_GROW() : CLAY_SIZING_FIXED(width),
|
||||||
|
@ -424,7 +424,7 @@ void component_image(clay_tb_image *image, int width)
|
||||||
|
|
||||||
void component_mouse_data(void)
|
void component_mouse_data(void)
|
||||||
{
|
{
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = {
|
.sizing = {
|
||||||
.width = CLAY_SIZING_GROW(),
|
.width = CLAY_SIZING_GROW(),
|
||||||
|
@ -446,7 +446,7 @@ void component_mouse_data(void)
|
||||||
v = (255 < v) ? 255 : v;
|
v = (255 < v) ? 255 : v;
|
||||||
Clay_Color color = (Clay_Color) { v, v, v, 0xff };
|
Clay_Color color = (Clay_Color) { v, v, v, 0xff };
|
||||||
|
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = layout,
|
.layout = layout,
|
||||||
.backgroundColor = color
|
.backgroundColor = color
|
||||||
}) {}
|
}) {}
|
||||||
|
@ -457,7 +457,7 @@ void component_mouse_data(void)
|
||||||
color = (Clay_Color) { v, v, v, 0xff };
|
color = (Clay_Color) { v, v, v, 0xff };
|
||||||
|
|
||||||
|
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = layout,
|
.layout = layout,
|
||||||
.backgroundColor = color
|
.backgroundColor = color
|
||||||
}) {}
|
}) {}
|
||||||
|
@ -467,7 +467,7 @@ void component_mouse_data(void)
|
||||||
|
|
||||||
void component_bordered_text(void)
|
void component_bordered_text(void)
|
||||||
{
|
{
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
||||||
.sizing = {
|
.sizing = {
|
||||||
|
@ -478,25 +478,25 @@ void component_bordered_text(void)
|
||||||
},
|
},
|
||||||
.backgroundColor = { 0x24, 0x55, 0x34, 0xff },
|
.backgroundColor = { 0x24, 0x55, 0x34, 0xff },
|
||||||
}) {
|
}) {
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.border = { .width = { 1, 1, 1, 1, 1 }, .color = { 0xaa, 0x00, 0x00, 0xff } },
|
.border = { .width = { 1, 1, 1, 1, 1 }, .color = { 0xaa, 0x00, 0x00, 0xff } },
|
||||||
}) {
|
}) {
|
||||||
CLAY_TEXT(
|
CLAY_TEXT(
|
||||||
CLAY_STRING("Test"), CLAY_TEXT_CONFIG({ .textColor = { 0xff, 0xff, 0xff, 0xff } }));
|
CLAY_STRING("Test"), CLAY_TEXT_CONFIG({ .textColor = { 0xff, 0xff, 0xff, 0xff } }));
|
||||||
}
|
}
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.border = { .width = { 1, 1, 1, 1, 1 }, .color = { 0x00, 0xaa, 0x00, 0xff } },
|
.border = { .width = { 1, 1, 1, 1, 1 }, .color = { 0x00, 0xaa, 0x00, 0xff } },
|
||||||
}) {
|
}) {
|
||||||
CLAY_TEXT(CLAY_STRING("of the border width"),
|
CLAY_TEXT(CLAY_STRING("of the border width"),
|
||||||
CLAY_TEXT_CONFIG({ .textColor = { 0xff, 0xff, 0xff, 0xff } }));
|
CLAY_TEXT_CONFIG({ .textColor = { 0xff, 0xff, 0xff, 0xff } }));
|
||||||
}
|
}
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.border = { .width = { 1, 1, 1, 1, 1 }, .color = { 0x00, 0x00, 0xaa, 0xff } },
|
.border = { .width = { 1, 1, 1, 1, 1 }, .color = { 0x00, 0x00, 0xaa, 0xff } },
|
||||||
}) {
|
}) {
|
||||||
CLAY_TEXT(CLAY_STRING("and overlap for multiple lines\nof text"),
|
CLAY_TEXT(CLAY_STRING("and overlap for multiple lines\nof text"),
|
||||||
CLAY_TEXT_CONFIG({ .textColor = { 0xff, 0xff, 0xff, 0xff } }));
|
CLAY_TEXT_CONFIG({ .textColor = { 0xff, 0xff, 0xff, 0xff } }));
|
||||||
}
|
}
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.border = { .width = { 1, 1, 1, 1, 1 }, .color = { 0x00, 0x00, 0xaa, 0xff } },
|
.border = { .width = { 1, 1, 1, 1, 1 }, .color = { 0x00, 0x00, 0xaa, 0xff } },
|
||||||
}) {
|
}) {
|
||||||
CLAY_TEXT(CLAY_STRING("this text\nis long enough\nto display all\n borders\naround it"),
|
CLAY_TEXT(CLAY_STRING("this text\nis long enough\nto display all\n borders\naround it"),
|
||||||
|
@ -508,7 +508,7 @@ void component_bordered_text(void)
|
||||||
Clay_RenderCommandArray CreateLayout(clay_tb_image *image1, clay_tb_image *image2)
|
Clay_RenderCommandArray CreateLayout(clay_tb_image *image1, clay_tb_image *image2)
|
||||||
{
|
{
|
||||||
Clay_BeginLayout();
|
Clay_BeginLayout();
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = {
|
.sizing = {
|
||||||
.width = CLAY_SIZING_GROW(),
|
.width = CLAY_SIZING_GROW(),
|
||||||
|
@ -522,7 +522,7 @@ Clay_RenderCommandArray CreateLayout(clay_tb_image *image1, clay_tb_image *image
|
||||||
},
|
},
|
||||||
.backgroundColor = { 0x24, 0x24, 0x24, 0xff }
|
.backgroundColor = { 0x24, 0x24, 0x24, 0xff }
|
||||||
}) {
|
}) {
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.childAlignment = {
|
.childAlignment = {
|
||||||
.x = CLAY_ALIGN_X_RIGHT,
|
.x = CLAY_ALIGN_X_RIGHT,
|
||||||
|
@ -534,7 +534,7 @@ Clay_RenderCommandArray CreateLayout(clay_tb_image *image1, clay_tb_image *image
|
||||||
component_keybinds();
|
component_keybinds();
|
||||||
component_unicode_text();
|
component_unicode_text();
|
||||||
}
|
}
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
||||||
.childGap = 32,
|
.childGap = 32,
|
||||||
|
|
|
@ -113,7 +113,7 @@ void component_text_pair(const char *key, const char *value)
|
||||||
};
|
};
|
||||||
Clay_TextElementConfig *textconfig =
|
Clay_TextElementConfig *textconfig =
|
||||||
CLAY_TEXT_CONFIG({ .textColor = { 0xff, 0xff, 0xff, 0xff } });
|
CLAY_TEXT_CONFIG({ .textColor = { 0xff, 0xff, 0xff, 0xff } });
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = {
|
.sizing = {
|
||||||
.width = {
|
.width = {
|
||||||
|
@ -125,7 +125,7 @@ void component_text_pair(const char *key, const char *value)
|
||||||
},
|
},
|
||||||
}) {
|
}) {
|
||||||
CLAY_TEXT(keytext, textconfig);
|
CLAY_TEXT(keytext, textconfig);
|
||||||
CLAY({ .layout = { .sizing = CLAY_SIZING_GROW(1) } }) { }
|
CLAY_AUTO_ID({ .layout = { .sizing = CLAY_SIZING_GROW(1) } }) { }
|
||||||
CLAY_TEXT(valtext, textconfig);
|
CLAY_TEXT(valtext, textconfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ void component_text_pair(const char *key, const char *value)
|
||||||
|
|
||||||
void component_termbox_settings(void)
|
void component_termbox_settings(void)
|
||||||
{
|
{
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = CLAY_SIZING_FIT(),
|
.sizing = CLAY_SIZING_FIT(),
|
||||||
.padding = {
|
.padding = {
|
||||||
|
@ -264,7 +264,7 @@ void component_termbox_settings(void)
|
||||||
transparency = "false";
|
transparency = "false";
|
||||||
}
|
}
|
||||||
|
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM },
|
.layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM },
|
||||||
}) {
|
}) {
|
||||||
component_text_pair("Color mode", color_mode);
|
component_text_pair("Color mode", color_mode);
|
||||||
|
@ -278,7 +278,7 @@ void component_termbox_settings(void)
|
||||||
|
|
||||||
void component_keybinds(void)
|
void component_keybinds(void)
|
||||||
{
|
{
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = CLAY_SIZING_FIT(),
|
.sizing = CLAY_SIZING_FIT(),
|
||||||
.padding = {
|
.padding = {
|
||||||
|
@ -311,7 +311,7 @@ void component_keybinds(void)
|
||||||
|
|
||||||
void component_image(img_group *img_pair)
|
void component_image(img_group *img_pair)
|
||||||
{
|
{
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = {
|
.sizing = {
|
||||||
.width = CLAY_SIZING_GROW(),
|
.width = CLAY_SIZING_GROW(),
|
||||||
|
@ -326,7 +326,7 @@ void component_image(img_group *img_pair)
|
||||||
},
|
},
|
||||||
.backgroundColor = { 0x24, 0x24, 0x24, 0xff }
|
.backgroundColor = { 0x24, 0x24, 0x24, 0xff }
|
||||||
}) {
|
}) {
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = {
|
.sizing = {
|
||||||
.width = CLAY_SIZING_GROW(),
|
.width = CLAY_SIZING_GROW(),
|
||||||
|
@ -343,7 +343,7 @@ void component_image(img_group *img_pair)
|
||||||
|
|
||||||
void component_image_small(img_group **img_pairs, int count, int selected_index)
|
void component_image_small(img_group **img_pairs, int count, int selected_index)
|
||||||
{
|
{
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = {
|
.sizing = {
|
||||||
.width = CLAY_SIZING_PERCENT(0.25),
|
.width = CLAY_SIZING_PERCENT(0.25),
|
||||||
|
@ -356,7 +356,7 @@ void component_image_small(img_group **img_pairs, int count, int selected_index)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}) {
|
}) {
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = {
|
.sizing = {
|
||||||
.width = CLAY_SIZING_PERCENT(0.7),
|
.width = CLAY_SIZING_PERCENT(0.7),
|
||||||
|
@ -367,7 +367,7 @@ void component_image_small(img_group **img_pairs, int count, int selected_index)
|
||||||
},
|
},
|
||||||
.aspectRatio = { (float)img_pairs[selected_index]->width / img_pairs[selected_index]->height }
|
.aspectRatio = { (float)img_pairs[selected_index]->width / img_pairs[selected_index]->height }
|
||||||
}) { }
|
}) { }
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = {
|
.sizing = {
|
||||||
.width = CLAY_SIZING_GROW(),
|
.width = CLAY_SIZING_GROW(),
|
||||||
|
@ -384,7 +384,7 @@ void component_image_small(img_group **img_pairs, int count, int selected_index)
|
||||||
|
|
||||||
void component_thumbnails(img_group **img_pairs, int count, int selected_index)
|
void component_thumbnails(img_group **img_pairs, int count, int selected_index)
|
||||||
{
|
{
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = {
|
.sizing = {
|
||||||
.width = CLAY_SIZING_PERCENT(0.1),
|
.width = CLAY_SIZING_PERCENT(0.1),
|
||||||
|
@ -407,7 +407,7 @@ void component_thumbnails(img_group **img_pairs, int count, int selected_index)
|
||||||
.width = CLAY_BORDER_OUTSIDE(0),
|
.width = CLAY_BORDER_OUTSIDE(0),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = {
|
.sizing = {
|
||||||
.width = CLAY_SIZING_GROW(),
|
.width = CLAY_SIZING_GROW(),
|
||||||
|
@ -428,7 +428,7 @@ const int thumbnail_count = 5;
|
||||||
Clay_RenderCommandArray CreateLayout(struct img_group **imgs)
|
Clay_RenderCommandArray CreateLayout(struct img_group **imgs)
|
||||||
{
|
{
|
||||||
Clay_BeginLayout();
|
Clay_BeginLayout();
|
||||||
CLAY({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = {
|
.sizing = {
|
||||||
.width = CLAY_SIZING_GROW(),
|
.width = CLAY_SIZING_GROW(),
|
||||||
|
|
Loading…
Reference in a new issue