mirror of
https://github.com/nicbarker/clay.git
synced 2025-04-15 10:48:04 +00:00
2.6 KiB
2.6 KiB
Clay-C3-Bindings
C3 Bindings for Clay, a UI layout library written in C. This directory contains the clay.c3 bindings file as well as a recreation of the clay-raylib-renderer and the video-example raylib/clay project.
Special thanks to:
- Christoffer L C3's core developer (as I understand it)
- Book-reader in the C3-lang Discord
TODO:
- Find out how to build a static-lib with additional C sources
- C3 macros
Traditional Clay C Macro System
/* FILTER BUTTON */
CLAY(
CLAY_ID("FilterButton"),
Clay_Hovered() ? CLAY_RECTANGLE({
.color = Clay_Hovered() ? FIRE_ORANGE : (Clay_Color){80, 25, 200, 255},
.cornerRadius = 8,
}) : 0,
CLAY_LAYOUT({
.sizing = {
.width = CLAY_SIZING_FIT(),
.height = CLAY_SIZING_GROW()
},
.padding = 10
})
) {
// define children...
}
Clay C3 Macro System
/* FILTER BUTTON */
@clay(
clay::id("FilterButton"),
clay::@bodyIf(clay::hovered(), clay::rectangle({
.color = clay::hovered() ? FIRE_ORANGE : {80, 25, 200, 255},
.cornerRadius = clay::cornerRadiusUni(8)
})
),
clay::layout({
.sizing = {
.width = clay::sizingFit(),
.height = clay::sizingGrow()
},
.padding = clay::paddingUni(8)
})
){
// define children...
};
To Get Started:
- Download c3c here
- If you wish to compile the website-example, I've already provided a target to build in the project.json
-
- set your
cd
to c3
- set your
-
- use the
c3c vendor-fetch raylib55
command to download a c3 compressed archive of raylib
- use the
-
-
- once you have raylib55.c3l in the lib folder you've got it right
-
-
- then use the command
c3c run video-example
to compile and run the video example
- then use the command
-
-
- (note: to use the
c3c build <target>
command with video-example, you'll need to copy the resource folder into the build directory to run it
- (note: to use the
-