rework assert, wasm_alert, wasm_clear, expect

This commit is contained in:
krzosa
2024-12-30 19:48:40 +01:00
parent 578fa33605
commit 46084a3412
16 changed files with 150 additions and 95 deletions

View File

@@ -5,25 +5,24 @@
// #include "debug.c"
// #include "ui2.c"
ma_arena_t *frame_arena;
f64 delta_time;
void app_update(ma_arena_t *perm_arena, app_event_t *events, i32 event_count) {
if (frame_arena == NULL) {
frame_arena = ma_push_arena(perm_arena, kib(32));
}
if (event_count) delta_time = events[0].delta_time;
draw_textf(v2f64(0,0), "delta time: %f", delta_time);
f64 pos = 0.0;
f64 offset = get_font_height() + 8;
for (i32 i = 0; i < event_count; i += 1) {
s8_t string = ti_serial_data(frame_arena, events + i, app_event_t);
sb8_t split = s8_split(frame_arena, string, s8_lit("\n"), s8_split_none);
ma_scratch_scope(temp) {
f64 offset = get_font_height() + 8;
f64 pos = offset;
for (i32 i = 0; i < event_count; i += 1) {
s8_t string = ti_serial_data(temp.arena, events + i, app_event_t);
sb8_t split = s8_split(temp.arena, string, s8_lit("\n"), s8_split_none);
for (sb8_node_t *it = split.first; it; it = it->next) {
draw_text((v2f64_t){0, pos}, white_color_global, it->string);
for (sb8_node_t *it = split.first; it; it = it->next) {
draw_text((v2f64_t){0, pos}, black_color_global, it->string);
pos += offset;
pos += offset;
}
}
}
ma_set0(frame_arena);
}