From: Brendan Hansen Date: Mon, 19 Jul 2021 23:04:50 +0000 (-0500) Subject: one more dumb fix for type_table X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=1a4acc18b83279c21894b035df6311d910fd8753;p=onyx.git one more dumb fix for type_table --- diff --git a/modules/ui/components/workspace.onyx b/modules/ui/components/workspace.onyx index 9fe95642..64558d2f 100644 --- a/modules/ui/components/workspace.onyx +++ b/modules/ui/components/workspace.onyx @@ -31,13 +31,14 @@ workspace_start :: (use r: Rectangle, site := #callsite) { speed :: 30.0f; @ThemeConfiguration scale_speed :: 0.02f; @ThemeConfiguration - if is_key_down(38) do state.transform.translation.y += speed; - if is_key_down(40) do state.transform.translation.y -= speed; - if is_key_down(39) do state.transform.translation.x -= speed; - if is_key_down(37) do state.transform.translation.x += speed; - - if is_key_down(187) do zoom(^state, r, 1.02); - if is_key_down(189) do zoom(^state, r, 0.98); + if is_key_down(38) do state.transform.translation.y += speed; + if is_key_down(40) do state.transform.translation.y -= speed; + if is_key_down(39) do state.transform.translation.x -= speed; + if is_key_down(37) do state.transform.translation.x += speed; + + // These keys are weird because keycode is not standard between all browsers... ugh + if is_key_down(187) || is_key_down(61) do zoom(^state, r, 1.02); + if is_key_down(189) || is_key_down(173) do zoom(^state, r, 0.98); if mouse_state.left_button_just_down && !state.dragging { state.dragging = true; diff --git a/src/onyxtypes.c b/src/onyxtypes.c index 544b3f94..e0a21e14 100644 --- a/src/onyxtypes.c +++ b/src/onyxtypes.c @@ -4,8 +4,6 @@ #include "onyxutils.h" #include "onyxerrors.h" -static u32 next_unique_id = 1; - // NOTE: These have to be in the same order as Basic Type basic_types[] = { { Type_Kind_Basic, 0, 0, (AstType *) &basic_type_void, { Basic_Kind_Void, 0, 0, 1, "void" } }, @@ -47,6 +45,7 @@ static bh_imap type_dynarr_map; static bh_imap type_vararg_map; static void type_register(Type* type) { + static u32 next_unique_id = 1; type->id = next_unique_id++; bh_imap_put(&type_map, type->id, (u64) type); diff --git a/src/onyxwasm_type_table.c b/src/onyxwasm_type_table.c index 3d660c68..1343f02c 100644 --- a/src/onyxwasm_type_table.c +++ b/src/onyxwasm_type_table.c @@ -10,7 +10,7 @@ u64 build_type_table(OnyxWasmModule* module) { #define PATCH (bh_arr_push(base_patch_locations, table_buffer.length)) // This is the data behind the "type_table" slice in type_info.onyx - u32 type_count = bh_arr_length(type_map.entries); + u32 type_count = bh_arr_length(type_map.entries) + 1; u64* table_info = bh_alloc_array(global_heap_allocator, u64, type_count + 4); // HACK bh_buffer table_buffer;