rework to context: now there's engine and user code copies, renaming of fields, most things that shouldn't be there are hidden

This commit is contained in:
2024-10-12 20:24:47 +03:00
parent 7886650339
commit e70366f82f
14 changed files with 106 additions and 97 deletions

View File

@ -19,15 +19,13 @@ static void title_tick(State *state) {
return;
}
m_sprite("/assets/title.png", ((Rect) {
((float)ctx.base_draw_w / 2) - ((float)320 / 2), 64, 320, 128 }));
((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->tick_count) + 1;
size_t text_str_len = snprintf(NULL, 0, "%lu", state->ctx->frame_number) + 1;
char *text_str = cmalloc(text_str_len);
snprintf(text_str, text_str_len, "%lu", state->ctx->tick_count);
snprintf(text_str, text_str_len, "%lu", state->ctx->frame_number);
const char *font = "fonts/kenney-pixel.ttf";
int text_h = 32;