Skip to content

Commit

Permalink
Switch all configs to value based rather than pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
nicbarker committed Oct 20, 2024
1 parent 54132c1 commit 03c619d
Show file tree
Hide file tree
Showing 8 changed files with 393 additions and 351 deletions.
132 changes: 76 additions & 56 deletions README.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -454,29 +454,23 @@ createLayout :: proc(lerpValue: f32) -> clay.ClayArray(clay.RenderCommand) {
if clay.UI(clay.ID("TopBorder5"), clay.Layout({sizing = {clay.SizingGrow({}), clay.SizingFixed(4)}}), clay.Rectangle({color = COLOR_TOP_BORDER_1})) {}
if clay.UI(
clay.ID("ScrollContainerBackgroundRectangle"),
clay.Layout({sizing = {clay.SizingGrow({}), clay.SizingGrow({})}}),
clay.Scroll({vertical = true}),
clay.Layout({sizing = {clay.SizingGrow({}), clay.SizingGrow({})}, layoutDirection = clay.LayoutDirection.TOP_TO_BOTTOM}),
clay.Rectangle({color = COLOR_LIGHT}),
clay.Border({betweenChildren = {2, COLOR_RED}})
) {
if clay.UI(clay.ID("OuterScrollContainer"), clay.Layout({sizing = {clay.SizingGrow({}), clay.SizingGrow({})}}), clay.Scroll({vertical = true})) {
if clay.UI(
clay.ID("ScrollContainerInner"),
clay.Layout({layoutDirection = .TOP_TO_BOTTOM, sizing = {width = clay.SizingGrow({})}}),
clay.Border({betweenChildren = {2, COLOR_RED}}),
) {
if (!mobileScreen) {
LandingPageDesktop()
FeatureBlocksDesktop()
DeclarativeSyntaxPageDesktop()
HighPerformancePageDesktop(lerpValue)
RendererPageDesktop()
} else {
LandingPageMobile()
FeatureBlocksMobile()
DeclarativeSyntaxPageMobile()
HighPerformancePageMobile(lerpValue)
RendererPageMobile()
}
}
if (!mobileScreen) {
LandingPageDesktop()
FeatureBlocksDesktop()
DeclarativeSyntaxPageDesktop()
HighPerformancePageDesktop(lerpValue)
RendererPageDesktop()
} else {
LandingPageMobile()
FeatureBlocksMobile()
DeclarativeSyntaxPageMobile()
HighPerformancePageMobile(lerpValue)
RendererPageMobile()
}
}
}
Expand Down
198 changes: 110 additions & 88 deletions clay.h

Large diffs are not rendered by default.

279 changes: 140 additions & 139 deletions examples/clay-official-website/main.c

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/cpp-project-example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ add_executable(clay_examples_cpp_project_example main.cpp)

target_include_directories(clay_examples_cpp_project_example PUBLIC .)

set(CMAKE_CXX_FLAGS_DEBUG "-Wall")
set(CMAKE_CXX_FLAGS_DEBUG "-Werror -Wall")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
5 changes: 5 additions & 0 deletions examples/cpp-project-example/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
#define CLAY_IMPLEMENTATION
#include "../../clay.h"

Clay_LayoutConfig layoutElement = Clay_LayoutConfig { .padding = {5} };

int main(void) {
uint64_t totalMemorySize = Clay_MinMemorySize();
Clay_Arena clayMemory = Clay_Arena { .label = CLAY_STRING("Clay Memory Arena"), .capacity = totalMemorySize, .memory = (char *)malloc(totalMemorySize) };
Clay_Initialize(clayMemory, Clay_Dimensions {1024,768});
Clay_BeginLayout();
CLAY(CLAY_RECTANGLE({ .color = {255,255,255,0} }), CLAY_LAYOUT(layoutElement)) {}
Clay_EndLayout();
return 0;
}
90 changes: 45 additions & 45 deletions examples/raylib-sidebar-scrolling-container/main.c

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
// NOTE: This file only exists to make sure that clay works when included in multiple translation units.

void SatisfyCompiler() {
CLAY(CLAY_ID("SatisfyCompiler"), CLAY_LAYOUT()) {}
CLAY(CLAY_ID("SatisfyCompiler"), CLAY_LAYOUT({})) {}
}

0 comments on commit 03c619d

Please sign in to comment.