Reimplementing zoom factor related map border rednering...

This commit is contained in:
Ognjen Milan Robovic 2024-05-19 13:57:13 -04:00
parent b947518a56
commit 7b65d4e0db
3 changed files with 23 additions and 24 deletions

View File

@ -317,11 +317,11 @@ package body core is
procedure draw_horizontally (data : in sprite; x, y, width, factor : in integer; tint : in colour := (others => 255)) is
begin
for move in 0 .. width / data.width - 1 loop
draw (data, x + move * data.width, y, tint => tint, factor => 1);
draw (data, x + move * data.width, y, tint => tint, factor => factor);
end loop;
--
if width mod data.width > 0 then
draw (data, x + (width / data.width) * data.width, y, 0, 0, width mod data.width, data.height, tint => tint, factor => 1);
draw (data, x + (width / data.width) * data.width, y, 0, 0, width mod data.width, data.height, tint => tint, factor => factor);
end if;
end draw_horizontally;
@ -330,11 +330,11 @@ package body core is
procedure draw_vertically (data : in sprite; x, y, height, factor : in integer; tint : in colour := (others => 255)) is
begin
for move in 0 .. height / data.height - 1 loop
draw (data, x, y + move * data.height, tint => tint, factor => 1);
draw (data, x, y + move * data.height, tint => tint, factor => factor);
end loop;
--
if height mod data.height > 0 then
draw (data, x, y + (height / data.height) * data.height, 0, 0, data.width, height mod data.height, tint => tint, factor => 1);
draw (data, x, y + (height / data.height) * data.height, 0, 0, data.width, height mod data.height, tint => tint, factor => factor);
end if;
end draw_vertically;

View File

@ -219,7 +219,7 @@ begin
world.configure;
--~ai.configure;
world.make (world.swamp, 240, 180, 8);
world.make (world.swamp, 60, 40, 8);
world.add_chad (player);
dash;

View File

@ -10,11 +10,11 @@ package body world is
view_reach : constant integer := 96;
landmark_limit : constant integer := 360;
landmark_limit : constant integer := 60;
location_limit : constant integer := 60;
construction_limit : constant natural := 120;
equipment_limit : constant natural := 600;
unit_limit : constant natural := 600;
construction_limit : constant natural := 10;
equipment_limit : constant natural := 60;
unit_limit : constant natural := 60;
earth : core.sprite;
--~water : core.sprite;
@ -203,22 +203,21 @@ package body world is
end loop;
end loop;
--
--~declare factor : constant integer := core.base * core.zoom;
--~x : constant integer := factor * (-1- core.camera.x) + offset.x;
--~y : constant integer := factor * (-1- core.camera.y) + offset.y;
--~width : constant integer := core.base * (map.width + 2);
--~height : constant integer := core.base * (map.height + 2);
--~begin
--~core.draw_horizontally (border_upper, x + factor, y, width - 2 * factor, core.zoom);
--~core.draw_horizontally (border_lower, x + factor, y + height - factor, width - 2 * factor, core.zoom);
--~core.draw_vertically (border_left, x, y + factor, height - 2 * factor, core.zoom);
--~core.draw_vertically (border_right, x + width - factor, y + factor, height - 2 * factor, core.zoom);
--~--
declare x : constant integer := core.base * core.zoom * (-1 - core.camera.x) + offset.x;
y : constant integer := core.base * core.zoom * (-1 - core.camera.y) + offset.y;
width : constant integer := core.base * core.zoom * (map.width + 2);
height : constant integer := core.base * core.zoom * (map.height + 2);
begin
core.draw_horizontally (border_upper, x + core.base * core.zoom, y, width - 2 * core.base * core.zoom, core.zoom);
core.draw_horizontally (border_lower, x + core.base * core.zoom, y - core.base * core.zoom + height, width - 2 * core.base * core.zoom, core.zoom);
core.draw_vertically (border_left, x, y + core.base * core.zoom, height - 2 * core.base * core.zoom, core.zoom);
core.draw_vertically (border_right, x - core.base * core.zoom + width, y + core.base * core.zoom, height - 2 * core.base * core.zoom, core.zoom);
--
--~core.draw (corner_upper_left, x, y, core.zoom);
--~core.draw (corner_upper_right, x + width - core.base, y, core.zoom);
--~core.draw (corner_lower_left, x, y + height - core.base, core.zoom);
--~core.draw (corner_lower_right, x + width - core.base, y + height - core.base, core.zoom);
--~end;
--~core.draw (corner_upper_right, x + width - core.base * core.zoom, y, core.zoom);
--~core.draw (corner_lower_left, x, y + height - core.base * core.zoom, core.zoom);
--~core.draw (corner_lower_right, x + width - core.base * core.zoom, y + height - core.base * core.zoom, core.zoom);
end;
--
for vertical in 0 .. map.height - 1 loop
exit when offset.y + (vertical - core.camera.y) * core.base * core.zoom > core.window_height;