From 973961a0ced31c30f0e7e5abc618aaca6c8452b8 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Wed, 1 Mar 2023 07:27:50 +0000 Subject: Scroll using SDL's viewport Horizontal needs testing. --- src/Game/Hud.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/Game/Hud.hs') diff --git a/src/Game/Hud.hs b/src/Game/Hud.hs index 1e51993..880de50 100644 --- a/src/Game/Hud.hs +++ b/src/Game/Hud.hs @@ -1,10 +1,13 @@ -module Game.Hud (Hud, mkHud, render) where +module Game.Hud (Hud, mkHud, render, height) where import Data.IORef import qualified Game.Sprites as S import qualified Game.State as GS import qualified SDL +height :: Int +height = 16 + data Hud = Hud { sprite :: S.Sprite, stateRef :: IORef GS.State @@ -21,4 +24,5 @@ render renderer hud = do let xs = [0 .. state.totalBatteries - 1] in mapM_ (\x -> S.render renderer hud.sprite (4 + x * 8) 4 0 (if state.batteries <= x then 0 else 1)) xs let xs = [0 .. state.totalLives - 1] - in mapM_ (\x -> S.render renderer hud.sprite (320 - 4 - state.totalLives * 8 + x * 8) 4 0 (if state.lives <= x then 2 else 3)) xs + in -- magic numbers + mapM_ (\x -> S.render renderer hud.sprite (320 - 4 - state.totalLives * 8 + x * 8) 4 0 (if state.lives <= x then 2 else 3)) xs -- cgit v1.2.3