aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-03-01 07:56:36 +0000
committerJuan J. Martinez <jjm@usebox.net>2023-03-01 07:56:36 +0000
commit20dda2b1cc32109d8ec6d6c127a96470873e81bc (patch)
tree48a88673872e762d4b7bd402f2868dcd7763b1db
parent973961a0ced31c30f0e7e5abc618aaca6c8452b8 (diff)
downloadspace-plat-hs-20dda2b1cc32109d8ec6d6c127a96470873e81bc.tar.gz
space-plat-hs-20dda2b1cc32109d8ec6d6c127a96470873e81bc.zip
Better comments
-rw-r--r--src/Game.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Game.hs b/src/Game.hs
index 8f921e9..d1552d0 100644
--- a/src/Game.hs
+++ b/src/Game.hs
@@ -184,14 +184,17 @@ gameLoop = do
updated <- E.updateAll =<< readIORef entities
entities $= updated
- -- update the map viewport
+ -- to update the map viewport
let (px, py) = E.playerPosition updated
-- render map and entities
void $ do
+ -- set the SDL viewport
viewport <- M.viewport renderer map' px py (fromIntegral gameWidth) (fromIntegral gameHeight - H.height)
M.render renderer map' viewport
E.renderVisible renderer updated viewport
+
+ -- reset viewport to draw the HUD
SDL.rendererViewport renderer $= Nothing
H.render renderer hud