added drop shadow to menubar
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Sun, 10 Oct 2021 18:50:33 +0000 (13:50 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Sun, 10 Oct 2021 18:50:33 +0000 (13:50 -0500)
src/ui/menubar.onyx

index c109d2d2c682caca15a1eab6fd567af35e9e0c45..8a259b564c3b20a39d7977b687247f95165e5a90 100644 (file)
@@ -39,4 +39,19 @@ menubar :: (r: Rectangle, @Temporary search_buffer: ^String_Buffer, options: []
 
     _, search_rect := Flow.split_vertical(menu_rect, right_width=300);
     textbox(search_rect, search_buffer, "Search", theme=^menu_textbox_theme);
+
+    {
+        x, y := Rectangle.top_left(r);
+        w, h := Rectangle.dimensions(r);
+        shadow :: 12.0f
+        shadow_amm :: 0.4f
+
+        gfx.vertex(.{ x, y + h },      .{ 0, 0, 0, shadow_amm });
+        gfx.vertex(.{ x + w, y + h }, .{ 0, 0, 0, shadow_amm });
+        gfx.vertex(.{ x + w + shadow, y + h + shadow }, .{ 0, 0, 0, 0 });
+
+        gfx.vertex(.{ x, y + h },      .{ 0, 0, 0, shadow_amm });
+        gfx.vertex(.{ x + w + shadow, y + h }, .{ 0, 0, 0, 0 });
+        gfx.vertex(.{ x, y + h + shadow }, .{ 0, 0, 0, 0 });
+    }
 }