xhads/source/might.adb

52 lines
2.1 KiB
Ada

-- Copyright (c) 2024 - Ognjen 'xolatile' Milan Robovic
--
-- GNU General Public Licence (version 3 or later)
with core, ui, effect;
package body might is
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
view_width : constant integer := 90;
view_height : constant integer := 90;
view_sprite : array (enumeration) of core.sprite;
icon_sprite : array (enumeration) of core.sprite;
------------------------------------------------------------------------------------------
procedure configure is
begin
core.echo (core.comment, "Configuring might components...");
--
for index in enumeration loop
declare folder : constant string := core.lowercase (school'image (trait (index).kind));
file : constant string := core.lowercase (enumeration'image (index));
begin
view_sprite (index) := core.import_sprite ("./sprite/might/" & folder & "/" & file & ".png", 1, 1);
icon_sprite (index) := core.import_sprite ("./sprite/might/icon/" & file & ".png", 1, 1);
end;
end loop;
end configure;
------------------------------------------------------------------------------------------
procedure icon (index : in enumeration; x, y : in integer) is
begin
ui.draw_overicon (icon_sprite (index), trait (index).text, x, y);
end icon;
------------------------------------------------------------------------------------------
procedure view (index : in enumeration; x, y : in integer) is
offset : constant integer := 4;
begin
core.draw (view_sprite (index), x + offset, y + offset);
ui.draw_icon_menu (trait (index).text, x, y, view_width + 2 * offset, view_height + 2 * offset);
end view;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
end might;