Skip to content

Commit

Permalink
Switch to macro
Browse files Browse the repository at this point in the history
  • Loading branch information
nicbarker committed Jan 13, 2025
1 parent 1e411dd commit 225118a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
11 changes: 5 additions & 6 deletions examples/introducing-clay-video-demo/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

const int FONT_ID_BODY_16 = 0;
Clay_Color COLOR_WHITE = { 255, 255, 255, 255};
Clay_Padding outerPadding16 = { 16, 16, 16, 16 };

void RenderHeaderButton(Clay_String text) {
CLAY(
Expand All @@ -23,7 +22,7 @@ void RenderHeaderButton(Clay_String text) {
}

void RenderDropdownMenuItem(Clay_String text) {
CLAY(CLAY_LAYOUT({ .padding = outerPadding16})) {
CLAY(CLAY_LAYOUT({ .padding = CLAY_PADDING_ALL(16)})) {
CLAY_TEXT(text, CLAY_TEXT_CONFIG({
.fontId = FONT_ID_BODY_16,
.fontSize = 16,
Expand Down Expand Up @@ -129,7 +128,7 @@ int main(void) {
CLAY_LAYOUT({
.layoutDirection = CLAY_TOP_TO_BOTTOM,
.sizing = layoutExpand,
.padding = outerPadding16,
.padding = CLAY_PADDING_ALL(16),
.childGap = 16
})
) {
Expand Down Expand Up @@ -217,7 +216,7 @@ int main(void) {
CLAY_RECTANGLE(contentBackgroundConfig),
CLAY_LAYOUT({
.layoutDirection = CLAY_TOP_TO_BOTTOM,
.padding = outerPadding16,
.padding = CLAY_PADDING_ALL(16),
.childGap = 8,
.sizing = {
.width = CLAY_SIZING_FIXED(250),
Expand All @@ -229,7 +228,7 @@ int main(void) {
Document document = documents.documents[i];
Clay_LayoutConfig sidebarButtonLayout = {
.sizing = { .width = CLAY_SIZING_GROW(0) },
.padding = outerPadding16
.padding = CLAY_PADDING_ALL(16)
};

if (i == selectedDocumentIndex) {
Expand Down Expand Up @@ -274,7 +273,7 @@ int main(void) {
CLAY_LAYOUT({
.layoutDirection = CLAY_TOP_TO_BOTTOM,
.childGap = 16,
.padding = outerPadding16,
.padding = CLAY_PADDING_ALL(16),
.sizing = layoutExpand
})
) {
Expand Down
11 changes: 5 additions & 6 deletions examples/raylib-multi-context/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

const int FONT_ID_BODY_16 = 0;
Clay_Color COLOR_WHITE = { 255, 255, 255, 255};
Clay_Padding outerPadding16 = { 16, 16, 16, 16 };

void RenderHeaderButton(Clay_String text) {
CLAY(
Expand All @@ -23,7 +22,7 @@ void RenderHeaderButton(Clay_String text) {
}

void RenderDropdownMenuItem(Clay_String text) {
CLAY(CLAY_LAYOUT({ .padding = outerPadding16})) {
CLAY(CLAY_LAYOUT({ .padding = CLAY_PADDING_ALL(16)})) {
CLAY_TEXT(text, CLAY_TEXT_CONFIG({
.fontId = FONT_ID_BODY_16,
.fontSize = 16,
Expand Down Expand Up @@ -122,7 +121,7 @@ Clay_RenderCommandArray CreateLayout(Clay_Context* context, float yOffset, int32
CLAY_LAYOUT({
.layoutDirection = CLAY_TOP_TO_BOTTOM,
.sizing = layoutExpand,
.padding = outerPadding16,
.padding = CLAY_PADDING_ALL(16),
.childGap = 16
})
) {
Expand All @@ -135,7 +134,7 @@ Clay_RenderCommandArray CreateLayout(Clay_Context* context, float yOffset, int32
CLAY_RECTANGLE(contentBackgroundConfig),
CLAY_LAYOUT({
.layoutDirection = CLAY_TOP_TO_BOTTOM,
.padding = outerPadding16,
.padding = CLAY_PADDING_ALL(16),
.childGap = 8,
.sizing = {
.width = CLAY_SIZING_FIXED(250),
Expand All @@ -147,7 +146,7 @@ Clay_RenderCommandArray CreateLayout(Clay_Context* context, float yOffset, int32
Document document = documents.documents[i];
Clay_LayoutConfig sidebarButtonLayout = {
.sizing = { .width = CLAY_SIZING_GROW() },
.padding = outerPadding16
.padding = CLAY_PADDING_ALL(16)
};

if (i == *documentIndex) {
Expand Down Expand Up @@ -195,7 +194,7 @@ Clay_RenderCommandArray CreateLayout(Clay_Context* context, float yOffset, int32
CLAY_LAYOUT({
.layoutDirection = CLAY_TOP_TO_BOTTOM,
.childGap = 16,
.padding = outerPadding16,
.padding = CLAY_PADDING_ALL(16),
.sizing = layoutExpand
})
) {
Expand Down

0 comments on commit 225118a

Please sign in to comment.