Final tweaks

This commit is contained in:
Nic Barker 2024-09-29 12:49:06 +13:00
parent 24c4bcd565
commit d68af1cbe0
6 changed files with 9 additions and 13 deletions

View File

@ -1,5 +1,3 @@
# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
name: CMake on multiple platforms
on:

View File

@ -3,6 +3,7 @@ project(clay)
add_subdirectory("examples/cpp-project-example")
# Don't try to compile C99 projects using MSVC
if(NOT MSVC)
add_subdirectory("examples/raylib-sidebar-scrolling-container")
add_subdirectory("examples/clay-official-website")

View File

@ -394,13 +394,15 @@ The supported directives are:
- `CLAY_EXTEND_CONFIG_IMAGE` - Provide additional struct members to `CLAY_IMAGE_CONFIG` that will be passed through with output render commands.
- `CLAY_EXTEND_CONFIG_CUSTOM` - Provide additional struct members to `CLAY_IMAGE_CONFIG` that will be passed through with output render commands.
### Bindings
### Bindings for non C
Clay is usable out of the box as a `.h` include in both C99 and C++ with designated initializer support.
Clay is usable out of the box as a `.h` include in both C99 and C++20 with designated initializer support.
There are also supported bindings for other languages, including:
- [Odin Bindings](https://github.com/nicbarker/clay/tree/main/bindings/odin)
Unfortunately clay does **not** support Microsoft C11 or C17 via MSVC at this time.
### Debug Tools
Clay includes built-in UI debugging tools, similar to the "inspector" in browsers such as Chrome or Firefox. These tools are included in `clay.h`, and work by injecting additional render commands into the output [Clay_RenderCommandArray](#clay_rendercommandarray).

10
clay.h
View File

@ -28,12 +28,6 @@
#define CLAY_WASM_EXPORT(null)
#endif
#ifdef _MSC_VER
#define CLAY_PACKED_ENUM : uint8_t
#else
#define CLAY_PACKED_ENUM __attribute__((__packed__))
#endif
// Public Macro API ------------------------
#define CLAY_LAYOUT(...) Clay__StoreLayoutConfig(CLAY__INIT(Clay_LayoutConfig) {__VA_ARGS__ })
@ -113,11 +107,13 @@ static int CLAY__ELEMENT_DEFINITION_LATCH = 0;
Clay__CloseElementWithChildren()
#ifdef __cplusplus
#define CLAY__ALIGNMENT(type) alignof(type)
#define CLAY__INIT(type) type
#define CLAY__ALIGNMENT(type) alignof(type)
#define CLAY_PACKED_ENUM : uint8_t
#else
#define CLAY__INIT(type) (type)
#define CLAY__ALIGNMENT(type) (offsetof(struct { char c; type x; }, x))
#define CLAY_PACKED_ENUM __attribute__((__packed__))
#endif
#ifdef __cplusplus

View File

@ -5,9 +5,7 @@ set(CMAKE_C_STANDARD 99)
add_executable(clay_official_website main.c)
if(!MSVC)
target_compile_options(clay_official_website PUBLIC -Wall -Werror -Wno-unknown-pragmas)
endif()
target_include_directories(clay_official_website PUBLIC .)
set(CMAKE_CXX_FLAGS_RELEASE "-O3")

View File

@ -1,5 +1,6 @@
cmake_minimum_required(VERSION 3.28)
project(clay_examples_raylib_sidebar_scrolling_container C)
set(CMAKE_C_STANDARD 99)
# Adding Raylib
include(FetchContent)