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
|
|
@ -109,6 +109,10 @@ void Layout() {
|
|||
}
|
||||
}
|
||||
|
||||
void HandleClayErrors(Clay_ErrorData errorData) {
|
||||
printf("%s", errorData.errorText.chars);
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
// First we set up our cairo surface.
|
||||
// In this example we will use the PDF backend,
|
||||
|
|
@ -131,11 +135,11 @@ int main(void) {
|
|||
Clay_Cairo_Initialize(cr);
|
||||
|
||||
uint64_t totalMemorySize = Clay_MinMemorySize();
|
||||
Clay_Arena clayMemory = (Clay_Arena) { .label = CLAY_STRING("Clay Memory Arena"), .memory = malloc(totalMemorySize), .capacity = totalMemorySize };
|
||||
Clay_Arena clayMemory = Clay_CreateArenaWithCapacityAndMemory(totalMemorySize, malloc(totalMemorySize));
|
||||
Clay_SetMeasureTextFunction(Clay_Cairo_MeasureText);
|
||||
|
||||
// We initialize Clay with the same size
|
||||
Clay_Initialize(clayMemory, (Clay_Dimensions) { width, height });
|
||||
Clay_Initialize(clayMemory, (Clay_Dimensions) { width, height }, (Clay_ErrorHandler) { HandleClayErrors });
|
||||
|
||||
Clay_BeginLayout();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue