one more dumb fix for type_table
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 19 Jul 2021 23:04:50 +0000 (18:04 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 19 Jul 2021 23:04:50 +0000 (18:04 -0500)
modules/ui/components/workspace.onyx
src/onyxtypes.c
src/onyxwasm_type_table.c

index 9fe95642bfdaa0a6796e6e6fa0f4270cdcf9e6d4..64558d2f865749fc98971e7425e93a9b6b374208 100644 (file)
@@ -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;
index 544b3f94dc7a857d46e3ea83324e7e80d7483b0d..e0a21e14e3bc00364f6d177bd44ce738d7b016dd 100644 (file)
@@ -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);
index 3d660c682b1aa424b0dda11c48e7b08c24f9559b..1343f02cc7f321f045ad8b2e94a04846c2d925d3 100644 (file)
@@ -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;