diff --git a/source/attribute.adb b/source/attribute.adb index d8eaa97..a3061ae 100644 --- a/source/attribute.adb +++ b/source/attribute.adb @@ -16,8 +16,19 @@ package body attribute is begin core.echo (core.comment, "Configuring attribute components..."); -- + ui.add_structure ((title => "Attribute Menu ", + toggle => core.signal_a, + show => false, + center => true, + resize => true, + gui_n => 0, + gui_list => (others => ui.empty), + others => 0)); + -- for index in enumeration loop sprite (index) := core.import_sprite ("./sprite/attribute/" & core.lowercase (enumeration'image (index)) & ".png", 1, 1); + -- + ui.add_structure_button (sprite (index), trait (index).name); end loop; end configure; diff --git a/source/resource.adb b/source/resource.adb index d9f0a5b..de610db 100644 --- a/source/resource.adb +++ b/source/resource.adb @@ -16,8 +16,19 @@ package body resource is begin core.echo (core.comment, "Configuring resource components..."); -- + ui.add_structure ((title => "Resource Menu ", + toggle => core.signal_r, + show => false, + center => true, + resize => true, + gui_n => 0, + gui_list => (others => ui.empty), + others => 0)); + -- for index in enumeration loop sprite (index) := core.import_sprite ("./sprite/resource/" & core.lowercase (enumeration'image (index)) & ".png", 1, 1); + -- + ui.add_structure_button (sprite (index), trait (index).name); end loop; end configure; diff --git a/source/skill.adb b/source/skill.adb index b04b15e..9fcad23 100644 --- a/source/skill.adb +++ b/source/skill.adb @@ -14,27 +14,26 @@ package body skill is procedure configure is --~menu_data : ui.structure := ( - --~"Skill Menu ", core.signal_s, false, true, false, 0, 0, 320, 160, + --~"Skill Menu ", core.signal_s, false, true, true, 0, 0, 320, 160, --~0, (others => (ui.gui_none, "- ", 0, (others => 0))) --~); begin core.echo (core.comment, "Configuring skill components..."); -- - --~ui.add_structure (menu_data); - ui.add_structure ( - "Skill Menu ", core.signal_s, false, true, true, 0, 0, 320, 160, - 0, (others => (ui.gui_none, "- ", 0, (others => 0))) - ); + ui.add_structure ((title => "Skill Menu ", + toggle => core.signal_s, + show => false, + center => true, + resize => true, + gui_n => 0, + gui_list => (others => ui.empty), + others => 0)); -- for index in enumeration loop sprite (index) := core.import_sprite ("./sprite/skill/" & core.lowercase (enumeration'image (index)) & ".png", 1, 1); - ui.add_structure_button (0, sprite (index), trait (index).name); + -- + ui.add_structure_button (sprite (index), trait (index).name); end loop; - -- - --~core.echo (core.export, ">" & menu_data.gui_n'image); - --~for x in 0 .. menu_data.gui_n - 1 loop - --~core.echo (core.export, ">" & x'image & " " & menu_data.gui_list (x).text); - --~end loop; end configure; ------------------------------------------------------------------------------------------ diff --git a/source/ui.adb b/source/ui.adb index d92739e..c493f98 100644 --- a/source/ui.adb +++ b/source/ui.adb @@ -165,16 +165,11 @@ package body ui is for x in 0 .. data.gui_n - 1 loop case data.gui_list (x).kind is when gui_button => - --~draw_frame ("", at_x, at_y, new_width - 2 * offset, core.icon + offset); draw_icon (data.gui_list (x).image, "", at_x, at_y); + draw_frame ("", at_x + core.icon, at_y, new_width - 2 * offset - core.icon, core.icon); write (data.gui_list (x).text, at_x + core.icon, at_y); at_y := at_y + core.icon; when others => null; - --~when others => core.echo (core.import, "Not rendering!"); - --~when others => - --~draw_frame ("", at_x + offset, at_y, new_width - 2 * offset, core.icon + offset); - --~draw_icon (data.gui_list (x).image, "", at_x + 3 * offset / 2, at_y + offset / 2); - --~write (data.gui_list (x).text, at_x + 3 * offset / 2 + core.icon, at_y + offset / 2); end case; end loop; end draw_structure; @@ -458,58 +453,23 @@ package body ui is ------------------------------------------------------------------------------------------ - --~procedure add_structure (data : in structure) is -- TODO: This is dumb, tho less error-prone... - procedure add_structure ( - title : core.short_string := "- "; - toggle : core.signal_code := core.signal_space; - show : boolean := false; - center : boolean := false; - resize : boolean := false; - x : integer := 0; - y : integer := 0; - width : integer := 0; - height : integer := 0; - gui_n : natural := 0; - gui_list : gui_array := (others => (gui_none, "- ", 0, (others => 0)))) is -- TODO: This is dumb, tho less error-prone... + procedure add_structure (data : in structure) is -- TODO: This is dumb, tho less error-prone... begin - structure_array (structure_count).title := title ; - structure_array (structure_count).toggle := toggle ; - structure_array (structure_count).show := show ; - structure_array (structure_count).center := center ; - structure_array (structure_count).resize := resize ; - structure_array (structure_count).x := x ; - structure_array (structure_count).y := y ; - structure_array (structure_count).width := width ; - structure_array (structure_count).height := height ; - -- - core.echo (core.export, "> " & structure_array (structure_count).gui_n'image); - core.echo (core.export, "> " & structure_array (structure_count).title); - core.echo (core.export, "> " & structure_array (structure_count).gui_list (0).text); - --~core.echo (core.export, "> " & ); - --~core.echo (core.export, "> " & ); - --~core.echo (core.export, "> " & ); - --~core.echo (core.export, "> " & ); - --~core.echo (core.export, "> " & ); - --~core.echo (core.export, "> " & ); - --~core.echo (core.export, "> " & ); - --~core.echo (core.export, "> " & ); - --~core.echo (core.export, "> " & ); - --~core.echo (core.export, "> " & ); - --~core.echo (core.export, "> " & ); + structure_array (structure_count) := data; -- structure_count := structure_count + 1; end add_structure; ------------------------------------------------------------------------------------------ - procedure add_structure_button (data : in integer; icon : in core.sprite; text : in core.short_string) is + procedure add_structure_button (icon : in core.sprite; text : in core.short_string) is begin - structure_array (data).gui_list (structure_array (data).gui_n).kind := gui_button; - structure_array (data).gui_list (structure_array (data).gui_n).text := text; - structure_array (data).gui_list (structure_array (data).gui_n).number := 0; - structure_array (data).gui_list (structure_array (data).gui_n).image := icon; + structure_array (structure_count - 1).gui_list (structure_array (structure_count - 1).gui_n).kind := gui_button; + structure_array (structure_count - 1).gui_list (structure_array (structure_count - 1).gui_n).text := text; + structure_array (structure_count - 1).gui_list (structure_array (structure_count - 1).gui_n).number := 0; + structure_array (structure_count - 1).gui_list (structure_array (structure_count - 1).gui_n).image := icon; -- - structure_array (data).gui_n := structure_array (data).gui_n + 1; + structure_array (structure_count - 1).gui_n := structure_array (structure_count - 1).gui_n + 1; end add_structure_button; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ diff --git a/source/ui.ads b/source/ui.ads index 145c6ce..7113357 100644 --- a/source/ui.ads +++ b/source/ui.ads @@ -22,12 +22,14 @@ package ui is gui_size : constant := 24; type gui_data is record - kind : enumeration; - text : core.short_string; - number : integer; - image : core.sprite; + kind : enumeration := gui_none; + text : core.short_string := "- "; + number : integer := 0; + image : core.sprite := (others => 0); end record; + empty : gui_data; + type gui_array is array (0 .. gui_size) of gui_data; type structure is record @@ -41,7 +43,7 @@ package ui is width : integer := 0; height : integer := 0; gui_n : natural := 0; - gui_list : gui_array := (others => (gui_none, "- ", 0, (others => 0))); + gui_list : gui_array := (others => empty); end record; ------------------------------------------------------------------------------------------ @@ -76,22 +78,9 @@ package ui is procedure draw_state_box (x, y : in integer); - --~procedure add_structure (data : in structure); - procedure add_structure ( - title : core.short_string := "- "; - toggle : core.signal_code := core.signal_space; - show : boolean := false; - center : boolean := false; - resize : boolean := false; - x : integer := 0; - y : integer := 0; - width : integer := 0; - height : integer := 0; - gui_n : natural := 0; - gui_list : gui_array := (others => (gui_none, "- ", 0, (others => 0))) - ); + procedure add_structure (data : in structure); - procedure add_structure_button (data : in integer; icon : in core.sprite; text : in core.short_string); + procedure add_structure_button (icon : in core.sprite; text : in core.short_string); ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------