Minor UI changes...

This commit is contained in:
Ognjen Milan Robovic 2024-04-28 17:18:14 -04:00
parent 037386c063
commit ed554ff8fe
3 changed files with 15 additions and 21 deletions

View File

@ -54,8 +54,8 @@ package core is
warning => true,
success => true,
comment => true,
import => true,
export => true
import => false,
export => false
);
engine_active : boolean := false;

View File

@ -165,8 +165,8 @@ begin
--~magic.menu (0, 0, true);
--~might.menu (0, 0, true);
--
--~ui.draw_menu (60, 60, 256, 256);
--~ui.draw_tiny_menu (360, 60, 256, 256);
ui.draw_menu (60, 60, 256, 256);
ui.draw_tiny_menu (360, 60, 256, 256);
--
menu_render;
--

View File

@ -58,23 +58,17 @@ package body ui is
------------------------------------------------------------------------------------------
procedure draw (index : in element; x, y : in integer) is
save_zoom : natural := core.zoom;
begin
core.zoom := 1;
core.draw (sprite (active, index), x, y);
core.zoom := save_zoom;
end draw;
------------------------------------------------------------------------------------------
procedure crop (index : in element; x, y, width, height : in integer) is
procedure draw (index : in element := none;
x : in integer := 0;
y : in integer := 0;
width : in integer := 0;
height : in integer := 0) is
save_zoom : natural := core.zoom;
begin
core.zoom := 1;
core.draw (sprite (active, index), x, y, 0, 0, width, height);
core.zoom := save_zoom;
end crop;
end draw;
------------------------------------------------------------------------------------------
@ -86,7 +80,7 @@ package body ui is
end loop;
--
if width mod step > 0 then
crop (index, x + (width / step) * step, y, width mod step, sprite (active, index).height);
draw (index, x + (width / step) * step, y, width mod step, sprite (active, index).height);
end if;
end draw_horizontally;
@ -100,7 +94,7 @@ package body ui is
end loop;
--
if height mod step > 0 then
crop (index, x, y + (height / step) * step, sprite (active, index).width, height mod step);
draw (index, x, y + (height / step) * step, sprite (active, index).width, height mod step);
end if;
end draw_vertically;
@ -118,18 +112,18 @@ package body ui is
end loop;
--
if width mod base_width > 0 then
crop (index, x + width - crop_width, y + move_y * base_height, crop_width, base_height);
draw (index, x + width - crop_width, y + move_y * base_height, crop_width, base_height);
end if;
end loop;
--
for move_x in 0 .. width / base_width - 1 loop
if height mod base_height > 0 then
crop (index, x + move_x * base_width, y + height - crop_height, base_width, crop_height);
draw (index, x + move_x * base_width, y + height - crop_height, base_width, crop_height);
end if;
end loop;
--
if width mod base_width > 0 and height mod base_height > 0 then
crop (index, x + width - crop_width, y + height - crop_height, crop_width, crop_height);
draw (index, x + width - crop_width, y + height - crop_height, crop_width, crop_height);
end if;
end draw_background;