win32_app

This commit is contained in:
krzosa
2025-01-03 07:53:13 +01:00
parent 05d49eefe8
commit 6933566a86
17 changed files with 832 additions and 200 deletions

View File

@@ -5,32 +5,33 @@
#include "gfx2d/gfx2d.c"
// #include "ui.c"
gfx2d_t *gfx2d = NULL;
gfx_t *gfx = NULL;
void app_init(void) {
tcx.temp = ma_push_arena(&tcx.perm, mib(1));
gfx2d = ma_push_type(&tcx.perm, gfx2d_t);
ma_arena_t *perm = &tcx._perm;
tcx.temp = ma_push_arena(perm, mib(1));
gfx = ma_push_type(perm, gfx_t);
}
void app_update(app_event_t *events, i32 events_len) {
void app_update(void) {
ma_set0(tcx.temp);
for (app_event_t *ev = events; ev < (events + events_len); ev += 1) {
// update(ev)
for (app_event_t *ev = app_iterate_events(); app_is_event_valid(ev); app_next_event(&ev)) {
// update
}
// These steps should be totally optional!!
{
app_event_t *ev = events + events_len - 1;
app_event_t *ev = app_get_last_event();
f64 delta = app_get_anim_delta_time();
f64 time = app_get_anim_time();
// animate
// render
gfx2d_begin(gfx2d, ev);
gfx2d_clear(gfx2d, white_color_global);
gfx2d_textf(gfx2d, (v2f64_t){0,0}, black_color_global, "delta: %f, time: %f", delta, time);
gfx2d_end(gfx2d);
gfx_begin(gfx, ev);
gfx_clear(gfx, white_color_global);
gfx_textf(gfx, (v2f64_t){0,0}, black_color_global, "delta: %f, time: %f", delta, time);
gfx_end(gfx);
}
}