use static, fixed arrays for circle geometry data instead of allocating for each one
This commit is contained in:
@ -20,9 +20,9 @@ static void title_tick(State *state) {
|
||||
((float)ctx.resolution.x / 2) - ((float)320 / 2), 64, 320, 128 }));
|
||||
|
||||
/* draw the tick count as an example of dynamic text */
|
||||
size_t text_str_len = snprintf(NULL, 0, "%lu", state->ctx->frame_number) + 1;
|
||||
size_t text_str_len = snprintf(NULL, 0, "%llu", state->ctx->frame_number) + 1;
|
||||
char *text_str = cmalloc(text_str_len);
|
||||
snprintf(text_str, text_str_len, "%lu", state->ctx->frame_number);
|
||||
snprintf(text_str, text_str_len, "%llu", state->ctx->frame_number);
|
||||
|
||||
const char *font = "/fonts/kenney-pixel.ttf";
|
||||
int text_h = 32;
|
||||
@ -39,7 +39,6 @@ static void title_tick(State *state) {
|
||||
);
|
||||
|
||||
draw_text(text_str, (Vec2){ 0, 0 }, text_h, (Color) { 255, 255, 255, 255 }, font);
|
||||
|
||||
free(text_str);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user