Try CLAY__INIT replacement

This commit is contained in:
Nic Barker 2024-09-28 20:54:41 +12:00
parent ee1e1bb95f
commit 9211595821
3 changed files with 10 additions and 9 deletions

View File

@ -1,9 +1,9 @@
cmake_minimum_required(VERSION 3.28) cmake_minimum_required(VERSION 3.28)
project(clay) project(clay)
if(MSVC) if(!MSVC)
add_subdirectory("examples/cpp-project-example")
elseif()
add_subdirectory("examples/raylib-sidebar-scrolling-container") add_subdirectory("examples/raylib-sidebar-scrolling-container")
add_subdirectory("examples/clay-official-website") add_subdirectory("examples/clay-official-website")
else()
add_subdirectory("examples/cpp-project-example")
endif() endif()

8
clay.h
View File

@ -454,14 +454,16 @@ extern uint32_t Clay__debugViewWidth;
#ifdef __cplusplus #ifdef __cplusplus
#define CLAY__ALIGNMENT(type) alignof(type) #define CLAY__ALIGNMENT(type) alignof(type)
#define CLAY__INIT(type) type
#elif #elif
#define CLAY__INIT(type) (type)
#define CLAY__ALIGNMENT(type) (offsetof(struct { char c; type x; } a, a.x)) #define CLAY__ALIGNMENT(type) (offsetof(struct { char c; type x; } a, a.x))
#endif #endif
bool Clay__warningsEnabled = true; bool Clay__warningsEnabled = true;
Clay_String CLAY__SPACECHAR = (Clay_String) { .length = 1, .chars = " " }; Clay_String CLAY__SPACECHAR = CLAY__INIT(Clay_String) { .length = 1, .chars = " " };
Clay_String CLAY__STRING_DEFAULT = (Clay_String) { .length = 0, .chars = "" }; Clay_String CLAY__STRING_DEFAULT = CLAY__INIT(Clay_String) { .length = 0, .chars = "" };
typedef struct typedef struct
{ {
@ -652,7 +654,7 @@ Clay_LayoutConfig *Clay__LayoutConfigArray_Add(Clay__LayoutConfigArray *array, C
#pragma endregion #pragma endregion
// __GENERATED__ template // __GENERATED__ template
Clay_RectangleElementConfig CLAY__RECTANGLE_ELEMENT_CONFIG_DEFAULT = (Clay_RectangleElementConfig){0}; Clay_RectangleElementConfig CLAY__RECTANGLE_ELEMENT_CONFIG_DEFAULT = (Clay_RectangleElementConfig){{0}};
// __GENERATED__ template array_define,array_add TYPE=Clay_RectangleElementConfig NAME=Clay__RectangleElementConfigArray DEFAULT_VALUE=&CLAY__RECTANGLE_ELEMENT_CONFIG_DEFAULT // __GENERATED__ template array_define,array_add TYPE=Clay_RectangleElementConfig NAME=Clay__RectangleElementConfigArray DEFAULT_VALUE=&CLAY__RECTANGLE_ELEMENT_CONFIG_DEFAULT
#pragma region generated #pragma region generated

View File

@ -1,7 +1,5 @@
cmake_minimum_required(VERSION 3.28) cmake_minimum_required(VERSION 3.28)
project(clay_examples_raylib_sidebar_scrolling_container) project(clay_examples_raylib_sidebar_scrolling_container C)
target_compile_options(clay_examples_raylib_sidebar_scrolling_container PUBLIC -Wall -Werror -Wno-unknown-pragmas)
# Adding Raylib # Adding Raylib
include(FetchContent) include(FetchContent)
@ -21,6 +19,7 @@ FetchContent_MakeAvailable(raylib)
add_executable(clay_examples_raylib_sidebar_scrolling_container main.c multi-compilation-unit.c) add_executable(clay_examples_raylib_sidebar_scrolling_container main.c multi-compilation-unit.c)
target_compile_options(clay_examples_raylib_sidebar_scrolling_container PUBLIC -Wall -Werror -Wno-unknown-pragmas)
target_include_directories(clay_examples_raylib_sidebar_scrolling_container PUBLIC .) target_include_directories(clay_examples_raylib_sidebar_scrolling_container PUBLIC .)
target_link_libraries(clay_examples_raylib_sidebar_scrolling_container PUBLIC raylib) target_link_libraries(clay_examples_raylib_sidebar_scrolling_container PUBLIC raylib)