Add visualization of whether a FET is opened or not
authorLukáš Jiřiště <gymnazium.jiriste@gmail.com>
Mon, 19 Feb 2024 21:39:38 +0000 (22:39 +0100)
committerLukáš Jiřiště <gymnazium.jiriste@gmail.com>
Mon, 19 Feb 2024 21:39:38 +0000 (22:39 +0100)
src/colors.c

index 21f75cd8d734c4326e0156621417c014a32cf524..343ac73bdc50bb09fe69c6e3af1a4e7817a3d99e 100644 (file)
@@ -36,7 +36,12 @@ void draw_single(t_vec *mosfets, size_t i)
                ft_printf("      %s|%s\n", g_red_ac, g_default_ac);
        }
        if (mosfet->gate)
-               ft_printf("%4u%s--%s%c\n", mosfet->gate->id, state_color_escape(mosfet->gate->state), g_default_ac, mosfet->type);
+       {
+               if (!mosfet->is_opened)
+                       ft_printf("%4u%s-%s%c-\n", mosfet->gate->id, state_color_escape(mosfet->gate->state), g_default_ac, mosfet->type);
+               else
+                       ft_printf("%4u%s-%s%c%s|%s\n", mosfet->gate->id, state_color_escape(mosfet->gate->state), g_default_ac, mosfet->type, state_color_escape(mosfet->source->state), g_default_ac);
+       }
        else
                ft_printf("%sNULL--%s%c\n", g_red_ac, g_default_ac, mosfet->type);
        if (mosfet->drain)