Menus are now more extandable...

This commit is contained in:
Ognjen Milan Robovic 2024-02-16 11:12:54 -05:00
parent dd01601a81
commit 7d4587a86e

View File

@ -39,23 +39,24 @@ package body menu is
------------------------------------------------------------------------------------------
procedure draw (index : in codex; x, y : in integer) is
icon_offset : constant integer := 8;
icon_offset : constant integer := 16;
icon_size : constant integer := 32;
offset : constant integer := icon_size + icon_offset;
width : constant integer := 300;
height : constant integer := trait (index).length * (icon_size + 2 * icon_offset) + 4 * icon_offset;
height : constant integer := trait (index).length * offset + 2 * icon_offset;
begin
if index = none then
return;
end if;
--
ui.draw_tiny_menu (x - 2 * icon_offset, y - 2 * icon_offset, width, height, true);
ui.draw_tiny_menu (x, y, width, height, true);
--
for offset in 0 .. trait (index).length - 1
for element_index in 0 .. trait (index).length - 1
loop
ui.draw_frame (x, y + offset * (icon_size + 2 * icon_offset), icon_size + 2 * icon_offset, icon_size + 2 * icon_offset);
ui.draw_frame (x + icon_offset, y + icon_offset + element_index * offset, offset, offset);
--
core.draw (trait (index).elements (offset).icon, x + icon_offset, y + icon_offset + offset * (icon_size + 2 * icon_offset));
core.write (trait (index).elements (offset).text, x + icon_offset + (icon_size + 2 * icon_offset), y + icon_offset + offset * (icon_size + 2 * icon_offset));
core.draw (trait (index).elements (element_index).icon, x + 3 * icon_offset / 2, y + 3 * icon_offset / 2 + element_index * offset);
core.write (trait (index).elements (element_index).text, x + 3 * icon_offset / 2 + offset, y + 3 * icon_offset / 2 + element_index * offset);
end loop;
end draw;