mirror of
https://github.com/nicbarker/clay.git
synced 2025-05-03 00:48:03 +00:00
Compare commits
4 Commits
be785c5174
...
aaf9363542
Author | SHA1 | Date | |
---|---|---|---|
|
aaf9363542 | ||
|
7cc719e61f | ||
|
63a74a92a8 | ||
|
8d3cadc52e |
@ -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;
|
||||||
```
|
```
|
||||||
|
24
fuzz/fuzzing_target.c
Normal file
24
fuzz/fuzzing_target.c
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#include "clay.h"
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||||
|
if (size < sizeof(Clay_String)) return 0;
|
||||||
|
|
||||||
|
Clay_String testString = { .length = size, .chars = (const char *)data };
|
||||||
|
|
||||||
|
Clay_Dimensions dimensions = MeasureText(&testString, NULL);
|
||||||
|
|
||||||
|
// Call other critical functions
|
||||||
|
Clay_Arena arena = Clay_CreateArenaWithCapacityAndMemory(1024, (void*)data);
|
||||||
|
Clay_Initialize(arena, (Clay_Dimensions){1024, 768});
|
||||||
|
Clay_SetPointerState((Clay_Vector2){0, 0}, false);
|
||||||
|
Clay_BeginLayout();
|
||||||
|
Clay_EndLayout();
|
||||||
|
|
||||||
|
// Handle pointer state changes
|
||||||
|
Clay_SetPointerState((Clay_Vector2){1, 1}, true);
|
||||||
|
Clay_SetPointerState((Clay_Vector2){2, 2}, false);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user