mirror of
https://github.com/nicbarker/clay.git
synced 2026-02-06 12:48:49 +00:00
[Core] Implement Error Handler / Callback (#105)
This commit is contained in:
parent
6a9b723dcc
commit
04694b0da2
9 changed files with 368 additions and 231 deletions
|
|
@ -4,10 +4,14 @@
|
|||
|
||||
Clay_LayoutConfig layoutElement = Clay_LayoutConfig { .padding = {5} };
|
||||
|
||||
void HandleClayErrors(Clay_ErrorData errorData) {
|
||||
printf("%s", errorData.errorText.chars);
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
uint64_t totalMemorySize = Clay_MinMemorySize();
|
||||
Clay_Arena clayMemory = Clay_Arena { .label = CLAY_STRING("Clay Memory Arena"), .capacity = totalMemorySize, .memory = (char *)malloc(totalMemorySize) };
|
||||
Clay_Initialize(clayMemory, Clay_Dimensions {1024,768});
|
||||
Clay_Arena clayMemory = Clay_CreateArenaWithCapacityAndMemory(totalMemorySize, (char *)malloc(totalMemorySize));
|
||||
Clay_Initialize(clayMemory, Clay_Dimensions {1024,768}, Clay_ErrorHandler { HandleClayErrors });
|
||||
Clay_BeginLayout();
|
||||
CLAY(CLAY_RECTANGLE({ .color = {255,255,255,0} }), CLAY_LAYOUT(layoutElement)) {}
|
||||
Clay_EndLayout();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue