Compare commits

..

4 Commits

Author SHA1 Message Date
bangbangsheshotmedown
62e8084549
Merge ea3e29be5c into 3f01ee4a4e 2025-01-09 13:10:43 +11:00
Nic Barker
3f01ee4a4e Disable cairo example because of github actions issues
Some checks failed
CMake on multiple platforms / build (Release, cl, cl, windows-latest) (push) Waiting to run
CMake on multiple platforms / build (Release, clang, clang++, ubuntu-latest) (push) Failing after 15s
CMake on multiple platforms / build (Release, gcc, g++, ubuntu-latest) (push) Failing after 12s
2025-01-09 10:08:51 +13:00
FintasticMan
a431254de4
[Core] Add check for supported C/C++ versions (#144) 2025-01-09 10:05:50 +13:00
David Styrbjörn
7cc719e61f
[Documentation] Updated example for Clay_SetPointerState (#169) 2025-01-09 09:56:24 +13:00
3 changed files with 12 additions and 4 deletions

View File

@ -8,7 +8,7 @@ add_subdirectory("examples/cpp-project-example")
# Don't try to compile C99 projects using MSVC # Don't try to compile C99 projects using MSVC
if(NOT MSVC) if(NOT MSVC)
add_subdirectory("examples/raylib-sidebar-scrolling-container") add_subdirectory("examples/raylib-sidebar-scrolling-container")
add_subdirectory("examples/cairo-pdf-rendering") # add_subdirectory("examples/cairo-pdf-rendering") Some issue with github actions populating cairo, disable for now
add_subdirectory("examples/clay-official-website") add_subdirectory("examples/clay-official-website")
add_subdirectory("examples/introducing-clay-video-demo") add_subdirectory("examples/introducing-clay-video-demo")
add_subdirectory("examples/SDL2-video-demo") add_subdirectory("examples/SDL2-video-demo")

View File

@ -100,7 +100,7 @@ Clay_RenderCommandArray CreateLayout() {
CLAY_RECTANGLE({ .color = COLOR_LIGHT }) CLAY_RECTANGLE({ .color = COLOR_LIGHT })
) { ) {
CLAY(CLAY_ID("ProfilePictureOuter"), CLAY_LAYOUT({ .sizing = { .width = CLAY_SIZING_GROW() }, .padding = {16, 16}, .childGap = 16, .childAlignment = { .y = CLAY_ALIGN_Y_CENTER }), CLAY_RECTANGLE({ .color = COLOR_RED })) { CLAY(CLAY_ID("ProfilePictureOuter"), CLAY_LAYOUT({ .sizing = { .width = CLAY_SIZING_GROW() }, .padding = {16, 16}, .childGap = 16, .childAlignment = { .y = CLAY_ALIGN_Y_CENTER }), CLAY_RECTANGLE({ .color = COLOR_RED })) {
CLAY(CLAY_ID("ProfilePicture"), CLAY_LAYOUT({ .sizing = { .width = CLAY_SIZING_FIXED(60), .height = CLAY_SIZING_FIXED(60) }}), CLAY_IMAGE({ .imageData = &profilePicture, .height = 60, .width = 60 })) {} CLAY(CLAY_ID("ProfilePicture"), CLAY_LAYOUT({ .sizing = { .width = CLAY_SIZING_FIXED(60), .height = CLAY_SIZING_FIXED(60) }}), CLAY_IMAGE({ .imageData = &profilePicture, .sourceDimensions = {60, 60} })) {}
CLAY_TEXT(CLAY_STRING("Clay - UI Library"), CLAY_TEXT_CONFIG({ .fontSize = 24, .textColor = {255, 255, 255, 255} })); CLAY_TEXT(CLAY_STRING("Clay - UI Library"), CLAY_TEXT_CONFIG({ .fontSize = 24, .textColor = {255, 255, 255, 255} }));
} }
@ -1059,11 +1059,11 @@ CLAY(CLAY_IMAGE({ .image = { .format = IMAGE_FORMAT_RGBA, .internalData = &image
// Load an image somewhere in your code // Load an image somewhere in your code
Image profilePicture = LoadImage("profilePicture.png"); Image profilePicture = LoadImage("profilePicture.png");
// Declare a reusable image config // Declare a reusable image config
Clay_ImageElementConfig imageConfig = (Clay_ImageElementConfig) { .imageData = &profilePicture, .height = 60, .width = 60 }; Clay_ImageElementConfig imageConfig = (Clay_ImageElementConfig) { .imageData = &profilePicture, .sourceDimensions = {60, 60} };
// Declare an image element using a reusable config // Declare an image element using a reusable config
CLAY(CLAY_IMAGE(imageConfig)) {} CLAY(CLAY_IMAGE(imageConfig)) {}
// Declare an image element using an inline config // Declare an image element using an inline config
CLAY(CLAY_IMAGE({ .imageData = &profilePicture, .height = 60, .width = 60 })) {} CLAY(CLAY_IMAGE({ .imageData = &profilePicture, .sourceDimensions = {60, 60} })) {}
// Rendering example // Rendering example
Image *imageToRender = renderCommand->elementConfig.imageElementConfig->imageData; Image *imageToRender = renderCommand->elementConfig.imageElementConfig->imageData;
``` ```

8
clay.h
View File

@ -21,6 +21,14 @@
#ifndef CLAY_HEADER #ifndef CLAY_HEADER
#define CLAY_HEADER #define CLAY_HEADER
#if !( \
(defined(__cplusplus) && __cplusplus >= 202002L) || \
(defined(__STDC__) && __STDC__ == 1 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
defined(_MSC_VER) \
)
#error "Clay requires C99, C++20, or MSVC"
#endif
#ifdef CLAY_WASM #ifdef CLAY_WASM
#define CLAY_WASM_EXPORT(name) __attribute__((export_name(name))) #define CLAY_WASM_EXPORT(name) __attribute__((export_name(name)))
#else #else