17 lines
No EOL
642 B
Haskell
17 lines
No EOL
642 B
Haskell
module RPGEngine.Render.Player
|
|
( renderPlayer
|
|
, focusPlayer
|
|
) where
|
|
|
|
import RPGEngine.Data (Player(..), Game(..))
|
|
import Graphics.Gloss (Picture, text)
|
|
import RPGEngine.Render.Core (getRender, setRenderPos, zoom, resolution)
|
|
import Graphics.Gloss.Data.Picture (translate)
|
|
|
|
renderPlayer :: Player -> Picture
|
|
renderPlayer Player{ position = (x, y) } = setRenderPos x y $ getRender "player"
|
|
|
|
focusPlayer :: Game -> Picture -> Picture
|
|
focusPlayer Game{ player = Player{ position = (x, y)}} = translate centerX centerY
|
|
where centerX = resolution * zoom * fromIntegral (negate x)
|
|
centerY = resolution * zoom * fromIntegral (negate y) |