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-11 06:01:07 -04:00
|
|
|
with core, ui;
|
2024-02-15 21:03:09 -05:00
|
|
|
|
2024-05-11 03:38:33 -04:00
|
|
|
package body equipment is
|
2024-02-15 21:03:09 -05:00
|
|
|
|
|
|
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
procedure configure is
|
|
|
|
begin
|
2024-05-11 03:38:33 -04:00
|
|
|
core.echo (core.comment, "Configuring equipment components...");
|
2024-03-11 08:42:25 -04:00
|
|
|
--
|
2024-04-27 10:01:54 -04:00
|
|
|
for index in enumeration loop
|
|
|
|
declare folder : constant string := core.lowercase (slot'image (trait (index).kind));
|
|
|
|
file : constant string := core.lowercase (enumeration'image (index));
|
2024-02-16 05:52:11 -05:00
|
|
|
begin
|
2024-05-17 19:37:52 -04:00
|
|
|
sprite (index) := core.import_sprite ("./sprite/equipment/" & folder & "/" & file & ".png", 4, 6);
|
|
|
|
icon_sprite (index) := core.import_sprite ("./sprite/equipment/icon/" & file & ".png", 1, 1);
|
2024-02-16 05:52:11 -05:00
|
|
|
end;
|
2024-02-15 21:03:09 -05:00
|
|
|
end loop;
|
|
|
|
end configure;
|
|
|
|
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
|
2024-05-09 05:07:20 -04:00
|
|
|
procedure draw (index : in enumeration; state : in core.animation; x, y : in integer) is
|
2024-02-15 21:03:09 -05:00
|
|
|
begin
|
2024-05-17 19:37:52 -04:00
|
|
|
--~if index = none then
|
|
|
|
--~return;
|
|
|
|
--~end if;
|
2024-05-17 18:35:31 -04:00
|
|
|
--
|
2024-05-16 14:52:41 -04:00
|
|
|
core.draw (sprite (index), x, y, state => state);
|
2024-02-15 21:03:09 -05:00
|
|
|
end draw;
|
|
|
|
|
2024-05-11 06:01:07 -04:00
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
procedure draw_plus (index : in enumeration; state : in core.animation; x, y : in integer) is
|
|
|
|
begin
|
|
|
|
draw (index, state, x, y);
|
|
|
|
--
|
|
|
|
if core.cursor_inside (x, y, sprite (index).width, sprite (index).height) and core.cursor_mode = 2 and not ui.prioritize then
|
|
|
|
core.write_text_box (trait (index).name);
|
|
|
|
end if;
|
|
|
|
end draw_plus;
|
|
|
|
|
2024-05-17 19:37:52 -04:00
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
--~procedure draw_icon (index : in enumeration; x, y : in integer) is
|
|
|
|
--~begin
|
|
|
|
--~core.draw (icon_sprite (index), x, y, factor => 1);
|
|
|
|
--~end draw_icon;
|
|
|
|
|
2024-02-15 21:03:09 -05:00
|
|
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
2024-05-11 03:38:33 -04:00
|
|
|
end equipment;
|