From: Brendan Hansen Date: Wed, 16 Feb 2022 03:37:13 +0000 (-0600) Subject: Added Editor_Disabled flag X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=a051d2ac763314c0856f89261932de27d47f53c6;p=bar-game.git Added Editor_Disabled flag --- diff --git a/run_tree/scenes/quick_save.scene b/run_tree/scenes/quick_save.scene index 80b9324..9a525a6 100644 --- a/run_tree/scenes/quick_save.scene +++ b/run_tree/scenes/quick_save.scene @@ -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 - diff --git a/src/entity/editor.onyx b/src/entity/editor.onyx index 7e2ae90..089a33f 100644 --- a/src/entity/editor.onyx +++ b/src/entity/editor.onyx @@ -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; } diff --git a/src/entity/player.onyx b/src/entity/player.onyx index d6279f1..5a3f091 100644 --- a/src/entity/player.onyx +++ b/src/entity/player.onyx @@ -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}; diff --git a/src/main.onyx b/src/main.onyx index c4044b1..0b5088f 100644 --- a/src/main.onyx +++ b/src/main.onyx @@ -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());