Added Editor_Disabled flag
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Wed, 16 Feb 2022 03:37:13 +0000 (21:37 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Wed, 16 Feb 2022 03:37:13 +0000 (21:37 -0600)
run_tree/scenes/quick_save.scene
src/entity/editor.onyx
src/entity/player.onyx
src/main.onyx

index 80b93240761d06ec083ea08a1e76ef11a371d490..9a525a6d6c08d7257c977586b67a85daa932e82c 100644 (file)
@@ -12,7 +12,7 @@ controls.left = 65
 controls.right = 68
 controls.interact = 70
 controls.pick_up = 71
-color.r = 0.0000
+color.r = 1.0000
 color.g = 0.0000
 color.b = 1.0000
 color.a = 1.0000
@@ -102,4 +102,3 @@ entity.pos.x = 686.0000
 entity.pos.y = 302.0000
 entity.size.x = 50.0000
 entity.size.y = 363.0000
-
index 7e2ae90f6bd67b0d06b5b60c82f18ec15d63cf92..089a33fb39853fdeabf069991855c2c7fd46fb17 100644 (file)
@@ -228,9 +228,15 @@ editor_draw :: () {
         member_any := any.{cast(^u8) v.data + it.offset, it.type};
 
         if is_button_just_down(GLFW_MOUSE_BUTTON_LEFT) {
-            @TODO // This should query if this field has Editor_Disabled in its tags.
+            is_disabled := false;
+            for^ it.tags {
+                if it.type != type_expr do continue;
+                if *cast(^type_expr) it.data != Editor_Disabled do continue;
+                is_disabled = true;
+                break;
+            }
 
-            if Rect.contains(.{x, y + 2, w, Field_Height + 2}, mouse_get_position_vector()) {
+            if !is_disabled && Rect.contains(.{x, y + 2, w, Field_Height + 2}, mouse_get_position_vector()) {
                 if active_index < 0 do sidebar_width += w;
                 active_index = i - 1;
             }
index d6279f181614efe1adb67b415b9661b04437ce43..5a3f091212b47342a11dcfcc3dbaa4edd5dad02e 100644 (file)
@@ -48,6 +48,7 @@ facing_to_direction_vector :: macro (f: Facing) -> Vector2 {
 Player :: struct {
     use entity: Entity;
 
+    [Editor_Disabled]
     holding: Entity_ID;
     controls: Player_Controls;
     color := Color.{1,1,1};
index c4044b16ca7996d5a9f292fd6a7f330471a0dd12..0b5088f2fccda13bb0b1a27961d764d8f7b45dd7 100644 (file)
@@ -62,7 +62,7 @@ draw :: () {
     defer {
         immediate_flush();
 
-        #if DEBUG && false {
+        #if DEBUG {
             font_set_color(.{1,0,0});
             font_print(debug_font, 0, 16, "FPS: {}", game_fps);
             font_print(debug_font, 0, 32, "HEAP: {b16}", alloc.heap.get_watermark());