|
|
@@ -50,7 +50,7 @@ package body ui is |
|
|
|
procedure draw (index : in element; x, y : in integer) is |
|
|
|
begin |
|
|
|
core.zoom := 1; |
|
|
|
core.draw (sprite (active, index), x, y, 0, 0, sprite (active, index).width, sprite (active, index).height); |
|
|
|
core.draw (sprite (active, index), x, y); |
|
|
|
core.zoom := 2; |
|
|
|
end draw; |
|
|
|
|
|
|
@@ -72,7 +72,9 @@ package body ui is |
|
|
|
draw (index, x + move * step, y); |
|
|
|
end loop; |
|
|
|
-- |
|
|
|
crop (index, x + (width / step) * step, y, width mod step, sprite (active, index).height); |
|
|
|
if width mod step > 0 then |
|
|
|
crop (index, x + (width / step) * step, y, width mod step, sprite (active, index).height); |
|
|
|
end if; |
|
|
|
end draw_horizontally; |
|
|
|
|
|
|
|
------------------------------------------------------------------------------------------ |
|
|
@@ -84,7 +86,9 @@ package body ui is |
|
|
|
draw (index, x, y + move * step); |
|
|
|
end loop; |
|
|
|
-- |
|
|
|
crop (index, x, y + (height / step) * step, sprite (active, index).width, height mod step); |
|
|
|
if height mod step > 0 then |
|
|
|
crop (index, x, y + (height / step) * step, sprite (active, index).width, height mod step); |
|
|
|
end if; |
|
|
|
end draw_vertically; |
|
|
|
|
|
|
|
------------------------------------------------------------------------------------------ |
|
|
@@ -100,14 +104,20 @@ package body ui is |
|
|
|
draw (index, x + move_x * base_width, y + move_y * base_height); |
|
|
|
end loop; |
|
|
|
-- |
|
|
|
crop (index, x + width - crop_width, y + move_y * base_height, crop_width, base_height); |
|
|
|
if width mod base_width > 0 then |
|
|
|
crop (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 |
|
|
|
crop (index, x + move_x * base_width, y + height - crop_height, base_width, crop_height); |
|
|
|
if height mod base_height > 0 then |
|
|
|
crop (index, x + move_x * base_width, y + height - crop_height, base_width, crop_height); |
|
|
|
end if; |
|
|
|
end loop; |
|
|
|
-- |
|
|
|
crop (index, x + width - crop_width, y + height - crop_height, crop_width, crop_height); |
|
|
|
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); |
|
|
|
end if; |
|
|
|
end draw_background; |
|
|
|
|
|
|
|
------------------------------------------------------------------------------------------ |
|
|
@@ -115,7 +125,7 @@ package body ui is |
|
|
|
procedure configure is |
|
|
|
procedure load_ui (index : in style; folder_path : in string) is |
|
|
|
begin |
|
|
|
glyphs (index) := core.import_font ("./sprite/ui/" & folder_path & "/font.png", 16, 0); |
|
|
|
glyphs (index) := core.import_font ("./sprite/ui/" & folder_path & "/font.png", (if index = default then 16 else 24), 0); |
|
|
|
-- |
|
|
|
for this in element loop |
|
|
|
sprite (index, this) := core.import_sprite ("./sprite/ui/" & folder_path & core.lowercase (element'image (this)) & ".png", 1, 1); |
|
|
@@ -232,13 +242,6 @@ package body ui is |
|
|
|
procedure draw_menu (x, y, width, height : in integer) is |
|
|
|
offset : constant integer := sprite (active, none).width; |
|
|
|
begin |
|
|
|
if width < sprite (active, corner_upper_left).width + sprite (active, corner_upper_right).width |
|
|
|
or width < sprite (active, corner_lower_left).width + sprite (active, corner_lower_right).width |
|
|
|
or height < sprite (active, corner_upper_left).height + sprite (active, corner_lower_left).height |
|
|
|
or height < sprite (active, corner_upper_right).height + sprite (active, corner_lower_right).height |
|
|
|
then return; |
|
|
|
end if; |
|
|
|
-- |
|
|
|
declare upper : constant integer := width - sprite (active, corner_upper_left).width - sprite (active, corner_upper_right).width; |
|
|
|
lower : constant integer := width - sprite (active, corner_lower_left).width - sprite (active, corner_lower_right).width; |
|
|
|
left : constant integer := height - sprite (active, corner_upper_left).height - sprite (active, corner_lower_left).height; |
|
|
@@ -263,13 +266,6 @@ package body ui is |
|
|
|
procedure draw_tiny_menu (x, y, width, height : in integer) is |
|
|
|
offset : constant integer := sprite (active, none).width; |
|
|
|
begin |
|
|
|
if width < sprite (active, tiny_corner_upper_left).width + sprite (active, tiny_corner_upper_right).width |
|
|
|
or width < sprite (active, tiny_corner_lower_left).width + sprite (active, tiny_corner_lower_right).width |
|
|
|
or height < sprite (active, tiny_corner_upper_left).height + sprite (active, tiny_corner_lower_left).height |
|
|
|
or height < sprite (active, tiny_corner_upper_right).height + sprite (active, tiny_corner_lower_right).height |
|
|
|
then return; |
|
|
|
end if; |
|
|
|
-- |
|
|
|
draw_background (main_background, x + offset, y + offset, width - 2 * offset, height - 2 * offset); |
|
|
|
-- |
|
|
|
declare upper : constant integer := width - sprite (active, tiny_corner_upper_left).width - sprite (active, tiny_corner_upper_right).width; |
|
|
|