2024-04-25 00:27:13 -04:00
|
|
|
-- Copyright (c) 2024 - Ognjen 'xolatile' Milan Robovic
|
|
|
|
--
|
|
|
|
-- GNU General Public Licence (version 3 or later)
|
|
|
|
|
2024-05-08 15:43:44 -04:00
|
|
|
with core, ui, effect;
|
2024-02-15 21:03:09 -05:00
|
|
|
|
|
|
|
package body magic is
|
|
|
|
|
|
|
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
2024-04-23 16:19:29 -04:00
|
|
|
view_width : constant natural := 90;
|
|
|
|
view_height : constant natural := 90;
|
2024-02-15 21:03:09 -05:00
|
|
|
|
2024-04-26 16:05:48 -04:00
|
|
|
view_sprite : array (enumeration) of core.sprite;
|
|
|
|
icon_sprite : array (enumeration) of core.sprite;
|
2024-02-15 21:03:09 -05:00
|
|
|
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
procedure configure is
|
|
|
|
begin
|
2024-03-11 08:42:25 -04:00
|
|
|
core.echo (core.comment, "Configuring magic components...");
|
|
|
|
--
|
2024-04-27 10:01:54 -04:00
|
|
|
for index in enumeration loop
|
|
|
|
declare folder : constant string := core.lowercase (school'image (trait (index).kind));
|
|
|
|
file : constant string := core.lowercase (enumeration'image (index));
|
2024-02-15 21:03:09 -05:00
|
|
|
begin
|
2024-03-17 16:45:46 -04:00
|
|
|
view_sprite (index) := core.import_sprite ("./sprite/magic/" & folder & "/" & file & ".png", 1, 1);
|
|
|
|
icon_sprite (index) := core.import_sprite ("./sprite/magic/icon/" & file & ".png", 1, 1);
|
2024-02-15 21:03:09 -05:00
|
|
|
end;
|
|
|
|
end loop;
|
|
|
|
end configure;
|
|
|
|
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
|
2024-04-26 16:05:48 -04:00
|
|
|
procedure icon (index : in enumeration; x, y : in integer) is
|
2024-03-11 16:47:28 -04:00
|
|
|
begin
|
2024-04-27 12:34:16 -04:00
|
|
|
ui.draw_overicon (icon_sprite (index), trait (index).text, x, y);
|
2024-03-11 16:47:28 -04:00
|
|
|
end icon;
|
|
|
|
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
|
2024-04-26 16:05:48 -04:00
|
|
|
procedure view (index : in enumeration; x, y : in integer) is
|
2024-03-11 16:47:28 -04:00
|
|
|
offset : constant integer := 4;
|
|
|
|
begin
|
|
|
|
core.draw (view_sprite (index), x + offset, y + offset);
|
2024-03-13 19:34:55 -04:00
|
|
|
ui.draw_icon_menu (trait (index).text, x, y, view_width + 2 * offset, view_height + 2 * offset);
|
2024-03-11 16:47:28 -04:00
|
|
|
end view;
|
|
|
|
|
2024-02-15 21:03:09 -05:00
|
|
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
end magic;
|