From e73d65ec9a23e71457097d3fab3b2c86c2600acc Mon Sep 17 00:00:00 2001 From: xolatile Date: Wed, 8 May 2024 17:14:49 -0400 Subject: [PATCH] Added map revealing thing... --- source/main.adb | 2 +- source/world.adb | 24 +++++++++++++++++++++++- sprite/dark.png | Bin 122 -> 107 bytes 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/source/main.adb b/source/main.adb index fc80b0c..0a78501 100644 --- a/source/main.adb +++ b/source/main.adb @@ -105,7 +105,7 @@ procedure main is procedure introduction is begin - ui.write ("Heyo world!", 0, 0); + ui.write ("[-- Please press Spacebar to continue]", 0, 0); end introduction; ------------------------------------------------------------------------------------------ diff --git a/source/world.adb b/source/world.adb index b61f2d0..63fa596 100644 --- a/source/world.adb +++ b/source/world.adb @@ -8,11 +8,16 @@ package body world is ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + dark : core.sprite; + + ------------------------------------------------------------------------------------------ + procedure configure is begin core.echo (core.comment, "Configuring world components..."); -- tiles := core.import_sprite ("./sprite/world/terrain/terrain.png", 1, 1); + dark := core.import_sprite ("./sprite/dark.png", 1, 1); -- for index in landmark_index loop declare file : constant string := core.lowercase (index'image); @@ -121,7 +126,7 @@ package body world is -- core.draw (data => tiles, x => offset.x + (horizontal - core.camera.x) * core.base * core.zoom, - y => offset.y + (vertical - core.camera.y) * core.base * core.zoom, + y => offset.y + (vertical - core.camera.y) * core.base * core.zoom, u => u, v => v, width => core.base, @@ -163,6 +168,23 @@ package body world is offset.y + (map.items (index).y - core.camera.y) * core.base * core.zoom); end if; 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 - 6 + and horizontal < core.camera.x + 6 + and vertical > core.camera.y - 6 + and vertical < core.camera.y + 6) 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); + end if; + end loop; + end loop; end draw; ------------------------------------------------------------------------------------------ diff --git a/sprite/dark.png b/sprite/dark.png index bf7008517cc790a6074be12783f5fc1d86c7b3e1..687c3c2c61fdbfe2224145ebc10e4a965f0e6827 100644 GIT binary patch delta 90 zcmb=*R_qM$bLZuf;$mQ6;Pv!y2?EjrAk4uAB;`N