From 7c353ee9ea2d8c35c48e90db51c2ecb53ca4b222 Mon Sep 17 00:00:00 2001 From: xolatile Date: Mon, 3 Jun 2024 17:41:01 -0400 Subject: [PATCH] Finished Chad package, watched anime for quite some time... --- source/chad.adb | 82 --------------------------------------------------------- source/chad.ads | 4 --- source/main.adb | 73 ++++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 71 insertions(+), 88 deletions(-) delete mode 100644 source/chad.adb diff --git a/source/chad.adb b/source/chad.adb deleted file mode 100644 index 7967c7a..0000000 --- a/source/chad.adb +++ /dev/null @@ -1,82 +0,0 @@ --- Copyright (c) 2024 - Ognjen 'xolatile' Milan Robovic --- --- GNU General Public Licence (version 3 or later) - -with core, ui, attribute, skill, resource, material, faction, equipment; - -package body chad is - ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - - procedure draw_data (player : in information; x, y : in integer) is - offset : constant integer := 8; - begin - ui.draw_frame ("--", x, y, 360 + 2 * offset, 96 + 2 * offset); - -- - ui.draw_sprite (view (player.index), description (player.index).name, x + offset, y + offset, 0); - -- - ui.draw_tiny_fill_bar (x + view_width + 2 * offset, y + 1 * core.icon + offset, 360 - view_width - offset, float (player.health.value) / float (player.health.limit), (127, 0, 0, 255)); - ui.draw_tiny_fill_bar (x + view_width + 2 * offset, y + 2 * core.icon + offset, 360 - view_width - offset, float (player.mana.value) / float (player.mana.limit), (0, 0, 127, 255)); - ui.draw_tiny_fill_bar (x + view_width + 2 * offset, y + 3 * core.icon + offset, 360 - view_width - offset, float (player.movement.value) / float (player.movement.limit), (0, 127, 0, 255)); - -- - ui.write (text => "Health " & player.health.value'image & " /" & player.health.limit'image, - x => x + view_width + core.icon + 3 * offset, - y => y + 2 * offset, - tint => (255, 127, 127, 255), - size => 15, - code => true); - ui.write (text => "Mana " & player.mana.value'image & " /" & player.mana.limit'image, - x => x + view_width + core.icon + 3 * offset, - y => y + core.icon + 2 * offset, - tint => (127, 127, 255, 255), - size => 15, - code => true); - ui.write (text => "Stamina" & player.movement.value'image & " /" & player.movement.limit'image, - x => x + view_width + core.icon + 3 * offset, - y => y + 2 * core.icon + 2 * offset, - tint => (127, 255, 127, 255), - size => 15, - code => true); - -- - declare move_x : integer := x; - begin - for index in attribute.enumeration loop - ui.draw_icon (attribute.icon (index), -(attribute.description (index).text), move_x, y + 96 + 3 * offset); - ui.draw_text_box (move_x, y + 96 + 3 * offset + core.icon, core.icon, core.icon); - ui.write (player.attributes (index).value'image, move_x + 4, y + 96 + 3 * offset + core.icon + 8, (255, 255, 255, 255), 15, true); - -- - move_x := move_x + core.icon; - end loop; - end; - -- - for index_y in 0 .. 3 loop - for index_x in 0 .. 5 loop - ui.draw_icon (data => equipment.icon (player.items (6 * index_y + index_x)), - text => -(equipment.description (player.items (6 * index_y + index_x)).name), - x => x + index_x * core.icon, - y => y + 96 + 4 * offset + 2 * core.icon + index_y * core.icon); - end loop; - end loop; - -- - declare move_x : integer := x; - move_y : integer := y + 96 + 5 * offset + 6 * core.icon; - begin - for index in skill.enumeration loop - if (skill.enumeration'pos (index) + 1) mod (skill.count / 2 + 1) = 0 then - move_x := x + 2 * core.icon + 120; - move_y := y + 96 + 5 * offset + 6 * core.icon; - end if; - -- - ui.draw_icon (skill.icon (index), -(skill.description (index).text), move_x, move_y); - ui.draw_text_box (move_x + core.icon, move_y, core.icon, core.icon); - ui.write (player.skills (index).value'image, move_x + core.icon, move_y + 8, (255, 255, 255, 255), 15, true); - ui.write (-(skill.description (index).name), move_x + 2 * core.icon + 4, move_y + 8, (255, 255, 255, 255), 15, true); - -- - move_y := move_y + core.icon; - end loop; - end; - end draw_data; - ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - -end chad; diff --git a/source/chad.ads b/source/chad.ads index 6f824e6..cebd679 100644 --- a/source/chad.ads +++ b/source/chad.ads @@ -66,10 +66,6 @@ package chad is sprite : array (enumeration) of core.sprite; view : array (enumeration) of core.sprite; - ------------------------------------------------------------------------------------------ - - procedure draw_data (player : in information; x, y : in integer); - ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ end chad; diff --git a/source/main.adb b/source/main.adb index f158a88..6cdca4d 100644 --- a/source/main.adb +++ b/source/main.adb @@ -360,8 +360,77 @@ begin end if; -- if view_list (status_preview_panel) then - ui.draw_tiny_menu (preview_width, 0, side_panel, preview_height); - chad.draw_data (world.map.chads (1), preview_width + 32, 32); + ui.draw_tiny_menu (preview_width, 0, side_panel, preview_height); + -- + declare player : chad.information := world.map.chads (1); + x : integer := preview_width + core.icon; + y : integer := core.icon; + begin + ui.draw_frame ("--", x, y, 360 + 2 * 8, 96 + 2 * 8); + -- + ui.draw_sprite (chad.view (player.index), chad.description (player.index).name, x + 8, y + 8, 0); + -- + ui.draw_tiny_fill_bar (x + chad.view_width + 2 * 8, y + 1 * core.icon + 8, 360 - chad.view_width - 8, float (player.health.value) / float (player.health.limit), (127, 0, 0, 255)); + ui.draw_tiny_fill_bar (x + chad.view_width + 2 * 8, y + 2 * core.icon + 8, 360 - chad.view_width - 8, float (player.mana.value) / float (player.mana.limit), (0, 0, 127, 255)); + ui.draw_tiny_fill_bar (x + chad.view_width + 2 * 8, y + 3 * core.icon + 8, 360 - chad.view_width - 8, float (player.movement.value) / float (player.movement.limit), (0, 127, 0, 255)); + -- + ui.write (text => "Health " & player.health.value'image & " /" & player.health.limit'image, + x => x + chad.view_width + core.icon + 3 * 8, + y => y + 2 * 8, + tint => (255, 127, 127, 255), + size => 15, + code => true); + ui.write (text => "Mana " & player.mana.value'image & " /" & player.mana.limit'image, + x => x + chad.view_width + core.icon + 3 * 8, + y => y + core.icon + 2 * 8, + tint => (127, 127, 255, 255), + size => 15, + code => true); + ui.write (text => "Stamina" & player.movement.value'image & " /" & player.movement.limit'image, + x => x + chad.view_width + core.icon + 3 * 8, + y => y + 2 * core.icon + 2 * 8, + tint => (127, 255, 127, 255), + size => 15, + code => true); + -- + declare move_x : integer := x; + begin + for index in attribute.enumeration loop + ui.draw_icon (attribute.icon (index), -(attribute.description (index).text), move_x, y + 96 + 3 * 8); + ui.draw_text_box (move_x, y + 96 + 3 * 8 + core.icon, core.icon, core.icon); + ui.write (player.attributes (index).value'image, move_x + 4, y + 96 + 3 * 8 + core.icon + 8, (others => 255), 15, true); + -- + move_x := move_x + core.icon; + end loop; + end; + -- + for index_y in 0 .. 3 loop + for index_x in 0 .. 5 loop + ui.draw_icon (data => equipment.icon (player.items (6 * index_y + index_x)), + text => -(equipment.description (player.items (6 * index_y + index_x)).name), + x => x + index_x * core.icon, + y => y + 96 + 4 * 8 + 2 * core.icon + index_y * core.icon); + end loop; + end loop; + -- + declare move_x : integer := x; + move_y : integer := y + 96 + 5 * 8 + 6 * core.icon; + begin + for index in skill.enumeration loop + if (skill.enumeration'pos (index) + 1) mod (skill.count / 2 + 1) = 0 then + move_x := x + 2 * core.icon + 120; + move_y := y + 96 + 5 * 8 + 6 * core.icon; + end if; + -- + ui.draw_icon (skill.icon (index), -(skill.description (index).text), move_x, move_y); + ui.draw_text_box (move_x + core.icon, move_y, core.icon, core.icon); + ui.write (player.skills (index).value'image, move_x + core.icon, move_y + 8, (others => 255), 15, true); + ui.write (-(skill.description (index).name), move_x + 2 * core.icon + 4, move_y + 8, (others => 255), 15, true); + -- + move_y := move_y + core.icon; + end loop; + end; + end; -- ui.draw_end_turn_button (x => core.window_width - side_panel + side_panel / 2 - core.icon, y => core.window_height - core.icon - text_box_height - 106 - 2 * core.icon);