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, effect, resource, faction;
|
2024-02-15 21:03:09 -05:00
|
|
|
|
|
|
|
package body construction is
|
|
|
|
|
|
|
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
procedure configure is
|
|
|
|
begin
|
2024-03-11 08:42:25 -04:00
|
|
|
core.echo (core.comment, "Configuring construction components...");
|
|
|
|
--
|
2024-04-27 10:01:54 -04:00
|
|
|
for index in enumeration loop
|
2024-06-01 11:27:59 -04:00
|
|
|
declare folder : constant string := core.lowercase (faction.enumeration'image (description (index).kind));
|
2024-04-27 10:01:54 -04:00
|
|
|
file : constant string := core.lowercase (enumeration'image (index));
|
2024-02-15 21:03:09 -05:00
|
|
|
begin
|
2024-06-01 11:27:59 -04:00
|
|
|
sprite (index) := core.import_sprite (core.folder & "/game/construction/" & folder & "/" & file & ".png", description (index).frames, 1);
|
2024-02-15 21:03:09 -05:00
|
|
|
end;
|
|
|
|
end loop;
|
|
|
|
end configure;
|
|
|
|
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
|
2024-04-26 16:05:48 -04:00
|
|
|
procedure draw (index : in enumeration; x, y : in integer) is
|
2024-02-15 21:03:09 -05:00
|
|
|
begin
|
2024-05-05 10:22:48 -04:00
|
|
|
core.draw (sprite (index), x, y);
|
2024-02-15 21:03:09 -05:00
|
|
|
end draw;
|
|
|
|
|
2024-05-11 06:01:07 -04:00
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
procedure draw_plus (index : in enumeration; x, y : in integer) is
|
2024-05-19 15:06:20 -04:00
|
|
|
use type core.cursor_code;
|
2024-05-11 06:01:07 -04:00
|
|
|
begin
|
|
|
|
draw (index, x, y);
|
|
|
|
--
|
2024-05-22 21:05:19 -04:00
|
|
|
if core.cursor_inside (x, y, sprite (index).width, sprite (index).height) and core.cursor_mode = core.cursor_middle and not ui.prioritize then
|
2024-06-01 17:27:18 -04:00
|
|
|
core.write_text_box (core.bound (description (index).name));
|
2024-05-11 06:01:07 -04:00
|
|
|
end if;
|
|
|
|
end draw_plus;
|
|
|
|
|
2024-02-15 21:03:09 -05:00
|
|
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
end construction;
|