Refactoring UI...
This commit is contained in:
parent
6eaf570310
commit
6a17c4c197
@ -48,46 +48,50 @@ package body ui is
|
|||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure draw_horizontally (index : in codex; x, y, width : in integer) is
|
procedure draw_horizontally (index : in codex; x, y, width : in integer) is
|
||||||
|
base : constant integer := sprite (active, index).width;
|
||||||
begin
|
begin
|
||||||
for move in 0 .. width / sprite (active, index).width - 1
|
for move in 0 .. width / base - 1
|
||||||
loop
|
loop
|
||||||
draw (index, x + move * sprite (active, index).width, y);
|
draw (index, x + move * base, y);
|
||||||
end loop;
|
end loop;
|
||||||
--
|
--
|
||||||
crop (index, x + (width / sprite (active, index).width) * sprite (active, index).width, y, 0, 0, width mod sprite (active, index).width, sprite (active, index).height);
|
crop (index, x + (width / base) * base, y, 0, 0, width mod base, sprite (active, index).height);
|
||||||
end draw_horizontally;
|
end draw_horizontally;
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure draw_vertically (index : in codex; x, y, height : in integer) is
|
procedure draw_vertically (index : in codex; x, y, height : in integer) is
|
||||||
|
base : constant integer := sprite (active, index).height;
|
||||||
begin
|
begin
|
||||||
for move in 0 .. height / sprite (active, index).height - 1
|
for move in 0 .. height / base - 1
|
||||||
loop
|
loop
|
||||||
draw (index, x, y + move * sprite (active, index).height);
|
draw (index, x, y + move * base);
|
||||||
end loop;
|
end loop;
|
||||||
--
|
--
|
||||||
crop (index, x, y + (height / sprite (active, index).height) * sprite (active, index).height, 0, 0, sprite (active, index).width, height mod sprite (active, index).height);
|
crop (index, x, y + (height / base) * base, 0, 0, sprite (active, index).width, height mod base);
|
||||||
end draw_vertically;
|
end draw_vertically;
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure draw_background (index : in codex; x, y, width, height : in integer) is
|
procedure draw_background (index : in codex; x, y, width, height : in integer) is
|
||||||
crop_width : integer := width mod sprite (active, index).width;
|
base_width : integer := sprite (active, index).width;
|
||||||
crop_height : integer := height mod sprite (active, index).height;
|
base_height : integer := sprite (active, index).height;
|
||||||
|
crop_width : integer := width mod base_width;
|
||||||
|
crop_height : integer := height mod base_height;
|
||||||
begin
|
begin
|
||||||
for move_y in 0 .. height / sprite (active, index).height - 1
|
for move_y in 0 .. height / base_height - 1
|
||||||
loop
|
loop
|
||||||
for move_x in 0 .. width / sprite (active, index).width - 1
|
for move_x in 0 .. width / base_width - 1
|
||||||
loop
|
loop
|
||||||
draw (index, x + move_x * sprite (active, index).width, y + move_y * sprite (active, index).height);
|
draw (index, x + move_x * base_width, y + move_y * base_height);
|
||||||
end loop;
|
end loop;
|
||||||
--
|
--
|
||||||
crop (index, x + width - crop_width, y + move_y * sprite (active, index).height, 0, 0, crop_width, sprite (active, index).height);
|
crop (index, x + width - crop_width, y + move_y * base_height, 0, 0, crop_width, base_height);
|
||||||
end loop;
|
end loop;
|
||||||
--
|
--
|
||||||
for move_x in 0 .. width / sprite (active, index).width - 1
|
for move_x in 0 .. width / base_width - 1
|
||||||
loop
|
loop
|
||||||
crop (index, x + move_x * sprite (active, index).width, y + height - crop_height, 0, 0, sprite (active, index).width, crop_height);
|
crop (index, x + move_x * base_width, y + height - crop_height, 0, 0, base_width, crop_height);
|
||||||
end loop;
|
end loop;
|
||||||
--
|
--
|
||||||
crop (index, x + width - crop_width, y + height - crop_height, 0, 0, crop_width, crop_height);
|
crop (index, x + width - crop_width, y + height - crop_height, 0, 0, crop_width, crop_height);
|
||||||
@ -129,7 +133,7 @@ package body ui is
|
|||||||
--
|
--
|
||||||
draw_horizontally (title_bar_middle, x + sprite (active, title_bar_left).width, y - sprite (active, title_bar_middle).height, middle_width);
|
draw_horizontally (title_bar_middle, x + sprite (active, title_bar_left).width, y - sprite (active, title_bar_middle).height, middle_width);
|
||||||
--
|
--
|
||||||
core.write (title, x + sprite (active, title_bar_left).width - 12, y - sprite (active, title_bar_middle).height + 24, 16#222222#);
|
core.write (title, x + sprite (active, title_bar_left).width - 12, y - sprite (active, title_bar_middle).height + 24, 16#CCCCCC#);
|
||||||
end draw_title_bar;
|
end draw_title_bar;
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user