wasm, ui, dpi and text baseline

This commit is contained in:
Krzosa Karol
2025-01-22 13:11:04 +01:00
parent e54265fcac
commit 223038c9cd
7 changed files with 46 additions and 38 deletions

View File

@@ -35,6 +35,7 @@ fn void wasm_add_event(app_event_t event) {
}
fn void wasm_set_cached_mouse(v2f32_t p) {
p = v2f32_muls(p, wasm_dpr);
wasm_cached.mouse_delta = v2f32_sub(p, wasm_cached.mouse_pos);
wasm_cached.mouse_pos = p;
}
@@ -94,7 +95,6 @@ fn_wasm_export void wasm_key_down(char *key, b32 ctrl, b32 shift, b32 alt, b32 m
});
}
if (map.filter_out) {
return;
}
@@ -127,7 +127,7 @@ fn_wasm_export b32 wasm_update(f64 time, f32 width, f32 height, f32 dpr) {
wasm_dpr = dpr;
if (wasm_frame.first_event == NULL) wasm_add_event((app_event_t){.kind = app_event_kind_update});
wasm_frame.window_size = (v2f32_t){width / dpr, height / dpr};
wasm_frame.window_size = (v2f32_t){width, height};
wasm_frame.dpr = wasm_dpr;
wasm_frame.mouse_pos = wasm_frame.last_event->mouse_pos;
wasm_frame.delta = wasm_delta_time;