Parcourir la source

Circled map revealing thing and had dinner...

master
Ognjen Milan Robovic il y a 1 semaine
Parent
révision
c16f5dd4e3
1 fichiers modifiés avec 19 ajouts et 11 suppressions
  1. +19
    -11
      source/world.adb

+ 19
- 11
source/world.adb Voir le fichier

@@ -8,6 +8,8 @@ package body world is

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

view_reach : constant integer := 48;

dark : core.sprite;

------------------------------------------------------------------------------------------
@@ -108,9 +110,6 @@ package body world is
--
offset : core.vector := ((core.window_width - core.base) / 2,
(core.window_height - core.base) / 2);
--
render : core.vector := (map.width - 1,
map.height - 1);
begin
view;
--
@@ -175,10 +174,7 @@ package body world is
for horizontal in 0 .. map.width - 1 loop
exit when offset.x + (horizontal - core.camera.x) * core.base * core.zoom > core.window_width;
--
if not (horizontal > core.camera.x - 6
and horizontal < core.camera.x + 6
and vertical > core.camera.y - 6
and vertical < core.camera.y + 6) then
if (horizontal - core.camera.x) ** 2 + (vertical - core.camera.y) ** 2 > view_reach then
core.draw (data => dark,
x => offset.x + (horizontal - core.camera.x) * core.base * core.zoom,
y => offset.y + (vertical - core.camera.y) * core.base * core.zoom);
@@ -190,11 +186,23 @@ package body world is
------------------------------------------------------------------------------------------

procedure view is
view_reach : constant integer := 12;
offset : core.vector := ((core.window_width - core.base) / 2,
(core.window_height - core.base) / 2);
begin
for x in 0 .. view_reach loop
for y in 0 .. view_reach loop
map.views ((x + core.camera.x - view_reach / 2) mod map.width, (y + core.camera.y - view_reach / 2) mod map.height) := true;
--~for x in 0 .. view_reach loop
--~for y in 0 .. view_reach loop
--~map.views ((x + core.camera.x - view_reach / 2) mod map.width, (y + core.camera.y - view_reach / 2) mod map.height) := true;
--~end loop;
--~end loop;
for vertical in 0 .. map.height - 1 loop
exit when offset.y + (vertical - core.camera.y) * core.base * core.zoom > core.window_height;
--
for horizontal in 0 .. map.width - 1 loop
exit when offset.x + (horizontal - core.camera.x) * core.base * core.zoom > core.window_width;
--
if not ((horizontal - core.camera.x) ** 2 + (vertical - core.camera.y) ** 2 > view_reach * 2) then
map.views (horizontal, vertical) := true;
end if;
end loop;
end loop;
end view;


Chargement…
Annuler
Enregistrer