From: Brendan Hansen Date: Thu, 7 Oct 2021 04:14:40 +0000 (-0500) Subject: changed to new tags syntax X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=1164d37df3c913b6dc50a9dc9bfcd4726ba7ab11;p=onyx-wasm-analyzer.git changed to new tags syntax --- diff --git a/src/app/editor.onyx b/src/app/editor.onyx index 5f6985d..34dbebd 100644 --- a/src/app/editor.onyx +++ b/src/app/editor.onyx @@ -13,11 +13,11 @@ Slider_Float :: struct { min, max: f32; } Ignore_Option :: struct { option: str; } modify_window_draw :: (obj: any, win: ^app.Application_Window, site := #callsite) { - __counter = 0; - rect := win.window_state->get_internal_rectangle(); hash := ui.get_site_hash(site); + __counter = hash; + handle := ui.scrollable_region_start(rect, increment=hash, .{ minimum_x = 0, maximum_x = 0, minimum_y = 0, maximum_y = 100000.0f, @@ -26,7 +26,6 @@ modify_window_draw :: (obj: any, win: ^app.Application_Window, site := #callsite win_rect := handle->get_visible_rectangle(); - // rect = ui.Flow.padding(rect, left=8, right=8); rect.y1 = 1000000.0f; { @@ -81,13 +80,16 @@ modify_window_draw :: (obj: any, win: ^app.Application_Window, site := #callsite } { + line_buffer: [256] u8; + // Draw the name of the variable, handling a "Rename" tag. name := member.name; if rename := array.first(member.tags, (x) => x.type == Rename); rename != null { name = (cast(^Rename) rename.data).name; } - if row_visible do ui.draw_text(name_rect, name, theme=^heading_theme); + line := conv.str_format(line_buffer, "{} [{}]", name, member.type); + if row_visible do ui.draw_text(name_rect, line, theme=^heading_theme); } switch member_type.kind { @@ -177,3 +179,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 } diff --git a/src/app/settings.onyx b/src/app/settings.onyx index 15bdd3d..765ade4 100644 --- a/src/app/settings.onyx +++ b/src/app/settings.onyx @@ -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; } @@ -90,3 +90,4 @@ settings_window_draw :: (_, win) => { close_window(window_id); } } + diff --git a/src/features/hex_editor/feature.onyx b/src/features/hex_editor/feature.onyx index ea974e6..71d265a 100644 --- a/src/features/hex_editor/feature.onyx +++ b/src/features/hex_editor/feature.onyx @@ -4,10 +4,7 @@ package feature.hex_viewer use package feature { Feature } -_ :: struct #tag(Feature.{ "Hex Viewer" }) { +#tag WF, Feature.{ "Hex Viewer" } +WF :: struct { setup := setup; } - - - - diff --git a/src/features/hex_editor/hex_viewer.onyx b/src/features/hex_editor/hex_viewer.onyx index fe2f4c6..2931707 100644 --- a/src/features/hex_editor/hex_viewer.onyx +++ b/src/features/hex_editor/hex_viewer.onyx @@ -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; } diff --git a/src/ui/window.onyx b/src/ui/window.onyx index b114baf..789f9da 100644 --- a/src/ui/window.onyx +++ b/src/ui/window.onyx @@ -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;