diff --git a/source/main.adb b/source/main.adb index dac4812..fa8d472 100644 --- a/source/main.adb +++ b/source/main.adb @@ -149,7 +149,7 @@ procedure main is x : constant integer := preview_width + core.icon; y : constant integer := core.icon; width : constant integer := side_panel - 2 * core.icon; - height : constant integer := chad.view_height + 8 * core.icon + 3 * core.base + 2 * offset; + height : constant integer := chad.view_height + 11 * core.icon + 3 * core.base + 2 * offset; more : constant natural := 10; less : constant natural := 5; side : constant integer := chad.view_width + attribute.count * core.icon; @@ -161,19 +161,15 @@ procedure main is ui.draw_text_box (at_x + chad.view_width, at_y, width - chad.view_width - 2 * offset, core.icon); ui.write (chad.description (player_1.index).name.all, at_x + chad.view_width + less, at_y + less); -- - ui.draw_text_box (at_x + side, at_y + 1 * core.icon, width - side - 2 * offset, core.icon); - ui.draw_text_box (at_x + side, at_y + 2 * core.icon, width - side - 2 * offset, core.icon); - -- - ui.write (chad.description (player_1.index).title.all, at_x + side + more, at_y + 1 * core.icon + more, code => true); - ui.write ("Level" & player_1.level'image, at_x + side + more, at_y + 2 * core.icon + more, code => true); + ui.draw_text (chad.description (player_1.index).title.all, at_x + side, at_y + 1 * core.icon, width - side - 2 * offset, core.icon, more); + ui.draw_text ("Level" & player_1.level'image, at_x + side, at_y + 2 * core.icon, width - side - 2 * offset, core.icon, more); -- at_x := x + chad.view_width + offset; at_y := y + core.icon + offset; -- for index in attribute.enumeration loop - ui.draw_icon (attribute.icon (index), attribute.description (index).text.all, at_x, at_y); - ui.draw_text_box (at_x, at_y + core.icon, core.icon, core.icon); - ui.write (player_1.attributes (index).value'image, at_x + less, at_y + core.icon + more, code => true); + ui.draw_icon (attribute.icon (index), attribute.description (index).text.all, at_x, at_y); + ui.draw_text (player_1.attributes (index).value'image, at_x, at_y + core.icon, core.icon, core.icon, more); -- at_x := at_x + core.icon; end loop; @@ -189,13 +185,9 @@ procedure main is ui.draw_tiny_fill_bar (at_x, at_y + 1 * core.icon, side, float (player_1.mana.value) / float (player_1.mana.limit), (0, 0, 127, 255)); ui.draw_tiny_fill_bar (at_x, at_y + 2 * core.icon, side, float (player_1.movement.value) / float (player_1.movement.limit), (0, 127, 0, 255)); -- - ui.draw_text_box (at_x + side, at_y - core.icon, width - side - 2 * offset, core.icon); - ui.draw_text_box (at_x + side, at_y, width - side - 2 * offset, core.icon); - ui.draw_text_box (at_x + side, at_y + core.icon, width - side - 2 * offset, core.icon); - -- - ui.write ("Health", at_x + side + more, at_y - core.icon + more, code => true); - ui.write ("Mana", at_x + side + more, at_y + more, code => true); - ui.write ("Movement", at_x + side + more, at_y + core.icon + more, code => true); + ui.draw_text ("Health", at_x + side, at_y - core.icon, width - side - 2 * offset, core.icon, more); + ui.draw_text ("Mana", at_x + side, at_y, width - side - 2 * offset, core.icon, more); + ui.draw_text ("Movement", at_x + side, at_y + core.icon, width - side - 2 * offset, core.icon, more); -- ui.write (player_1.health.value'image & " /" & player_1.health.limit'image, at_x + core.icon, at_y - core.icon + more, code => true); ui.write (player_1.mana.value'image & " /" & player_1.mana.limit'image, at_x + core.icon, at_y + more, code => true); @@ -221,20 +213,11 @@ procedure main is end if; end loop; -- - ui.draw_text_box (x => at_x + (equipment.kind'pos (equipment.kind'last) + 1) * core.icon, - y => at_y, - width => width - (equipment.kind'pos (equipment.kind'last) + 1) * core.icon - 2 * offset, - height => core.icon); - -- - ui.write (text => "Equipment", - x => at_x + (equipment.kind'pos (equipment.kind'last) + 1) * core.icon + more, - y => at_y + more, - code => true); + ui.draw_text ("Equipment", at_x + 8 * core.icon, at_y, width - 8 * core.icon - 2 * offset, core.icon, more); -- at_y := at_y + core.icon; -- - ui.draw_text_box (at_x + side, at_y, width - side - 2 * offset, core.icon); - ui.write ("Skills", at_x + side + more, at_y + more, code => true); + ui.draw_text ("Skills", at_x + side, at_y, width - side - 2 * offset, core.icon, more); -- for index in 0 .. chad.skill_limit - 1 loop ui.draw_icon (skill.icon (player_1.skills (index)), skill.description (player_1.skills (index)).text.all, at_x + index * core.icon, at_y); @@ -260,7 +243,11 @@ procedure main is end loop; end loop; -- - ui.draw_text ("Heyo world!" & character'val (10) & "Goodcyaa world!", 600, 600, 0, 0); + at_y := at_y + 3 * core.icon; + -- + ui.draw_text (world.day_name (7).all, at_x, at_y + 0 * core.icon, width - 2 * offset, core.icon, more, 0); + ui.draw_text (world.week_name (52).all, at_x, at_y + 1 * core.icon, width - 2 * offset, core.icon, more, 0); + ui.draw_text (world.month_name (2).all, at_x, at_y + 2 * core.icon, width - 2 * offset, core.icon, more, 0); end player_information; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ diff --git a/source/ui.adb b/source/ui.adb index 59b4be5..45065ff 100644 --- a/source/ui.adb +++ b/source/ui.adb @@ -327,14 +327,12 @@ package body ui is ------------------------------------------------------------------------------------------ - procedure draw_text (text : in string; x, y, width, height : in integer; tint : in core.colour := (others => 255)) is - offset : constant integer := 8; - -- + procedure draw_text (text : in string; x, y, width, height : in integer; offset, border : in natural := 0; tint : in core.colour := (others => 255)) is new_width : constant natural := (if width < core.base then monowidth * core.string_width (text) else width); new_height : constant natural := (if height < core.base then monoheight * core.string_height (text) else height); begin - draw_text_box (x, y, new_width + 2 * offset, new_height + 2 * offset); - write (text, x + offset, y + offset, tint, code => true); + draw_text_box (x, y, new_width + 2 * border, new_height + 2 * border); + write (text, x + border + offset, y + border + offset, tint, code => true); end draw_text; ------------------------------------------------------------------------------------------ diff --git a/source/ui.ads b/source/ui.ads index 7c89ed5..d2993cb 100644 --- a/source/ui.ads +++ b/source/ui.ads @@ -44,7 +44,7 @@ package ui is procedure draw_frame (description : in string; x, y, width, height : in integer; action : core.pointer := core.idle_skip'access); procedure draw_button (text, description : in string; icon : in core.sprite; x, y, width, height : in integer; action : core.pointer := core.idle_skip'access); - procedure draw_text (text : in string; x, y, width, height : in integer; tint : in core.colour := (others => 255)); + procedure draw_text (text : in string; x, y, width, height : in integer; offset, border : in natural := 0; tint : in core.colour := (others => 255)); procedure draw_check_box (x, y : in integer; on : in out boolean; text : in string);