mirror of
https://github.com/nicbarker/clay.git
synced 2025-04-19 04:38:01 +00:00
Update to new API
This commit is contained in:
parent
e51673942b
commit
713fd67fe8
@ -105,6 +105,10 @@ static void SDL_RenderClayCommands(SDL_Renderer *renderer, Clay_RenderCommandArr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HandleClayErrors(Clay_ErrorData errorData) {
|
||||||
|
printf("%s", errorData.errorText.chars);
|
||||||
|
}
|
||||||
|
|
||||||
SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
|
SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
|
||||||
{
|
{
|
||||||
(void) argc;
|
(void) argc;
|
||||||
@ -137,7 +141,6 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
|
|||||||
/* Initialize Clay */
|
/* Initialize Clay */
|
||||||
uint64_t totalMemorySize = Clay_MinMemorySize();
|
uint64_t totalMemorySize = Clay_MinMemorySize();
|
||||||
Clay_Arena clayMemory = (Clay_Arena) {
|
Clay_Arena clayMemory = (Clay_Arena) {
|
||||||
.label = CLAY_STRING("Clay Memory Arena"),
|
|
||||||
.memory = SDL_malloc(totalMemorySize),
|
.memory = SDL_malloc(totalMemorySize),
|
||||||
.capacity = totalMemorySize
|
.capacity = totalMemorySize
|
||||||
};
|
};
|
||||||
@ -145,7 +148,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
|
|||||||
int width, height;
|
int width, height;
|
||||||
SDL_GetWindowSize(state->window, &width, &height);
|
SDL_GetWindowSize(state->window, &width, &height);
|
||||||
Clay_SetMeasureTextFunction(SDL_MeasureText);
|
Clay_SetMeasureTextFunction(SDL_MeasureText);
|
||||||
Clay_Initialize(clayMemory, (Clay_Dimensions) { (float) width, (float) height });
|
Clay_Initialize(clayMemory, (Clay_Dimensions) { (float) width, (float) height }, (Clay_ErrorHandler) { HandleClayErrors });
|
||||||
|
|
||||||
*appstate = state;
|
*appstate = state;
|
||||||
return SDL_APP_CONTINUE;
|
return SDL_APP_CONTINUE;
|
||||||
|
Loading…
Reference in New Issue
Block a user