Added icon and draw offsets to menus... (:

This commit is contained in:
Ognjen Milan Robovic 2024-02-18 09:39:24 -05:00
parent 1a39d111a7
commit 6eaf570310

View File

@ -39,11 +39,12 @@ package body menu is
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------
procedure draw (index : in codex; x, y : in integer) is procedure draw (index : in codex; x, y : in integer) is
icon_offset : constant integer := 16; draw_offset : constant integer := 16;
icon_offset : constant integer := 4;
icon_size : constant integer := 32; icon_size : constant integer := 32;
offset : constant integer := icon_size + icon_offset; offset : constant integer := icon_size + 2 * icon_offset;
width : constant integer := 300; width : constant integer := 300;
height : constant integer := trait (index).length * offset + 2 * icon_offset; height : constant integer := trait (index).length * offset + 2 * draw_offset;
begin begin
if index = none then if index = none then
return; return;
@ -54,10 +55,10 @@ package body menu is
-- --
for element_index in 0 .. trait (index).length - 1 for element_index in 0 .. trait (index).length - 1
loop loop
ui.draw_frame (x + icon_offset, y + icon_offset + element_index * offset, offset, offset); ui.draw_frame (x + draw_offset, y + draw_offset + element_index * offset, offset, offset);
-- --
core.draw (trait (index).elements (element_index).icon, x + 3 * icon_offset / 2, y + 3 * icon_offset / 2 + element_index * offset); core.draw (trait (index).elements (element_index).icon, x + draw_offset + icon_offset, y + draw_offset + icon_offset + 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); core.write (trait (index).elements (element_index).text, x + draw_offset + icon_offset + offset, y + draw_offset + icon_offset + element_index * offset);
end loop; end loop;
end draw; end draw;