conflicts incoming...
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 7 Oct 2021 18:49:53 +0000 (13:49 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 7 Oct 2021 18:49:53 +0000 (13:49 -0500)
src/app/editor.onyx
src/app/settings.onyx
src/features/hex_editor/feature.onyx
src/features/hex_editor/hex_viewer.onyx
src/features/text_editor/feature.onyx
src/features/wasm/feature.onyx
src/ui/window.onyx

index 5f6985da4d57e4910270ff720fd9a175c16afedf..5e40115b0aa42b8f94954d71013bec55f2343cf2 100644 (file)
@@ -177,3 +177,8 @@ modify_window_draw :: (obj: any, win: ^app.Application_Window, site := #callsite
     }
 }
 
+#private_file gfx :: package immediate_mode
+#tag gfx.Color4.r, Slider_Float.{ 0, 1 }
+#tag gfx.Color4.g, Slider_Float.{ 0, 1 }
+#tag gfx.Color4.b, Slider_Float.{ 0, 1 }
+#tag gfx.Color4.a, Slider_Float.{ 0, 1 }
index 15bdd3d4ca9e0a8a4fde2de4bec4d97ac52014d9..4a482c0d60051bb5aaba38ab4eab9d5db81def4f 100644 (file)
@@ -14,8 +14,8 @@ package app
 }
 
 Application_Settings :: struct {
-    #tag(editor.Ignore_Option.{ "Undefined" })
-    #tag(editor.Rename.{ "Color scheme" })
+    [editor.Ignore_Option.{ "Undefined" }]
+    [editor.Rename.{ "Color scheme" }]
     colorscheme := Colorscheme.Undefined;
 }
 
index ea974e6abf6679296059bdacfcc5026205ad05e0..9aa158f79226a124224397f7986d97353a6a275c 100644 (file)
@@ -4,7 +4,7 @@ package feature.hex_viewer
 
 use package feature { Feature }
 
-_ :: struct #tag(Feature.{ "Hex Viewer" }) {
+_ :: struct [Feature.{ "Hex Viewer" }] {
     setup := setup;
 }
 
index fe2f4c6c5a2d8617c76337eaececee9eee71d933..2931707a354a05f33c26fa0b6106010969016d2d 100644 (file)
@@ -16,10 +16,10 @@ window_name :: "Hex Viewer"
 Hex_Viewer_State :: struct {
     scrollable_region := ui.Scrollable_Region_State.{};
 
-    #tag(editor.Slider_Int.{ -1, 40 })
+    [editor.Slider_Int.{ -1, 40 }]
     highlighted_line   := -1;
 
-    #tag(editor.Slider_Int.{ -1, 16 })
+    [editor.Slider_Int.{ -1, 16 }]
     highlighted_column := -1;
 }
 
index a5ea2008826d6633cb0881b9c4fc77135fb50c38..ec9e15858096ac02a32f492eba6dcef2853ef2f1 100644 (file)
@@ -4,6 +4,6 @@ package feature.text_editor
 
 use package feature { Feature }
 
-_ :: struct #tag(Feature.{ "Text Editor" }) {
+_ :: struct [Feature.{ "Text Editor" }] {
     setup := setup;
 }
index 3c3cf36893ac803eaaa75d723aa978f3f5a56f51..af6986c14e0226254150b41213004e7a4885d190 100644 (file)
@@ -4,7 +4,7 @@ package feature.wasm
 
 use package feature { Feature }
 
-_ :: struct #tag(Feature.{ "WASM" }) {
+_ :: struct [Feature.{ "WASM" }] {
     setup := setup;
     file_loaded := file_loaded;
 }
index b114bafffbc21437e81c6954c5975aaad1aad49d..39d028badbb735fae78e777c759de3dea2625a2c 100644 (file)
@@ -14,12 +14,12 @@ Window_State :: struct {
 
     title := "(undefined)";
 
-    #tag(editor.Slider_Float.{ 0, 64 })
+    [editor.Slider_Float.{ 0, 64 }]
     border_width := 10.0f;
     border_color := gfx.Color4.{ 1, 0, 0 };
     background_color := gfx.Color4.{ 0.2, 0.2, 0.2 };
 
-    #tag(editor.Slider_Float.{ 0, 64 })
+    [editor.Slider_Float.{ 0, 64 }]
     bar_height := 28.0f;
 
     draggable := true;
@@ -29,6 +29,9 @@ Window_State :: struct {
     dragging     := false;
     resizing     := false;
 
+    [editor.Slider_Float.{ 0, 24 }]
+    shadow       := 10.0f;
+
     get_rectangle :: (use w: ^Window_State) -> Rectangle {
         bw := border_width;
         if dragging do bw *= 5;
@@ -148,6 +151,28 @@ window_start :: (use state: ^Window_State, site := #callsite, increment := 0) ->
         state.should_close = true;
     }
 
+    if shadow > 0 {
+        // Draw a drop shadow
+
+        gfx.vertex(.{ x - border_width, y + h + border_width },      .{ 0, 0, 0, 0.7 });
+        gfx.vertex(.{ x + w + border_width, y + h + border_width }, .{ 0, 0, 0, 0.35 });
+        gfx.vertex(.{ x + w + border_width + shadow, y + h + border_width + shadow }, .{ 0, 0, 0, 0 });
+
+        gfx.vertex(.{ x - border_width, y + h + border_width },      .{ 0, 0, 0, 0.7 });
+        gfx.vertex(.{ x + w + border_width + shadow, y + h + border_width + shadow }, .{ 0, 0, 0, 0 });
+        gfx.vertex(.{ x - border_width + shadow, y + h + border_width + shadow }, .{ 0, 0, 0, 0 });
+
+        gfx.vertex(.{ x + w + border_width, y - bar_height - border_width },      .{ 0, 0, 0, 0.7 });
+        gfx.vertex(.{ x + w + border_width + shadow, y + h + border_width + shadow }, .{ 0, 0, 0, 0 });
+        gfx.vertex(.{ x + w + border_width, y + h + border_width },      .{ 0, 0, 0, 0.35 });
+
+        gfx.vertex(.{ x + w + border_width, y - bar_height - border_width },          .{ 0, 0, 0, 0.7 });
+        gfx.vertex(.{ x + w + border_width + shadow, y - bar_height + shadow }, .{ 0, 0, 0, 0 });
+        gfx.vertex(.{ x + w + border_width + shadow, y + h + border_width + shadow }, .{ 0, 0, 0, 0 });
+
+        gfx.flush();
+    }
+
     gfx.push_matrix();
     gfx.push_scissor(x, y, w, h);
     gfx.apply_transform(.{ translation = .{ x, y }, scale = .{ 1, 1 } });