diff --git a/source/core.adb b/source/core.adb index 2b29e58..471d245 100644 --- a/source/core.adb +++ b/source/core.adb @@ -246,8 +246,8 @@ package body core is ------------------------------------------------------------------------------------------ - function center_x (object : in integer) return integer is begin return (window_width - object) / 2; end center_x; - function center_y (object : in integer) return integer is begin return (window_height - object) / 2; end center_y; + function center_x (width : in integer) return integer is begin return (window_width - width) / 2; end center_x; + function center_y (height : in integer) return integer is begin return (window_height - height) / 2; end center_y; ------------------------------------------------------------------------------------------ diff --git a/source/core.ads b/source/core.ads index 6e07df1..671a3b8 100644 --- a/source/core.ads +++ b/source/core.ads @@ -155,8 +155,8 @@ package core is function window_width return integer; function window_height return integer; - function center_x (object : in integer) return integer; - function center_y (object : in integer) return integer; + function center_x (width : in integer) return integer; + function center_y (height : in integer) return integer; function cursor_inside (x, y, width, height : in integer) return boolean; diff --git a/source/main.adb b/source/main.adb index 8df9186..633349e 100644 --- a/source/main.adb +++ b/source/main.adb @@ -332,6 +332,11 @@ begin for index in faction.enumeration loop unit.base (index) := core.import_sprite (core.folder & "/game/unit/" & core.lowercase (faction.enumeration'image (index)) & "/base.png", 4, 6); end loop; + -- + for index in unit.enumeration loop + unit.icon (index) := core.import_sprite (core.folder & "/icon/unit/" & core.lowercase (unit.enumeration'image (index)) & ".png", 1, 1); + unit.view (index) := core.import_sprite (core.folder & "/view/unit/" & core.lowercase (unit.enumeration'image (index)) & ".png", 1, 1); + end loop; core.echo (core.comment, "Configuring" & deity.count'image & " deity components..."); -- @@ -339,7 +344,7 @@ begin deity.sprite (index) := core.import_sprite (core.folder & "/game/deity/" & deity.enumeration'image (index) & ".png", 4, 1); end loop; - core.echo (core.comment, "Configuring" & construction.count'image & "construction components..."); + core.echo (core.comment, "Configuring" & construction.count'image & " construction components..."); -- for index in construction.enumeration loop declare folder : constant string := core.lowercase (faction.enumeration'image (construction.description (index).kind)); @@ -350,7 +355,7 @@ begin end; end loop; - core.echo (core.comment, "Configuring" & chad.count'image & "chad components..."); + core.echo (core.comment, "Configuring" & chad.count'image & " chad components..."); -- for index in chad.enumeration loop chad.sprite (index) := core.import_sprite (core.folder & "/game/chad/" & core.lowercase (chad.enumeration'image (index)) & ".png", 4, 6); diff --git a/source/unit.ads b/source/unit.ads index 9c913ce..17e6844 100644 --- a/source/unit.ads +++ b/source/unit.ads @@ -119,9 +119,12 @@ package unit is equipment.mithril_greaves, equipment.none, equipment.mithril_mace, equipment.mithril_shield)) ); + view_width : constant integer := 64; + view_height : constant integer := 96; + base : array (faction.enumeration) of core.sprite; - --~icon : array (faction.fairy .. faction.imp) of core.sprite; - --~view : array (faction.fairy .. faction.imp) of core.sprite; + icon : array (enumeration) of core.sprite; + view : array (enumeration) of core.sprite; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ diff --git a/source/world.adb b/source/world.adb index 4229ef3..0d45ac4 100644 --- a/source/world.adb +++ b/source/world.adb @@ -1043,8 +1043,15 @@ package body world is ------------------------------------------------------------------------------------------ procedure show_unit is + offset : constant integer := 8; + width : constant integer := 600; + height : constant integer := 600; + at_x : integer := core.center_x (width) + offset; + at_y : integer := core.center_y (height) + offset; begin - ui.draw_text ("Heyo world", 600, 600, 0, 0); + ui.draw_frame (core.center_x (width), core.center_y (height), width, height); + -- + ui.draw_sprite (unit.view (show_unit_data), unit.description (show_unit_data).name.all, at_x, at_y, 0); end show_unit; ------------------------------------------------------------------------------------------