about summary refs log tree commit diff
path: root/src/Xanthous/Game/Draw.hs
blob: 2d793ba27bd50ed9c5abdc8d59e5c0731db32be1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
module Xanthous.Game.Draw
  ( drawGame
  ) where

import Xanthous.Prelude
import Brick
import Brick.Widgets.Border
import Brick.Widgets.Border.Style

import Xanthous.Game (GameState(..))
import Xanthous.Resource (Name(..))

drawMessages :: GameState -> Widget Name
drawMessages _ = str "Welcome to Xanthous! It's dangerous out there, why not stay inside?"

drawMap :: GameState -> Widget Name
drawMap _game
  = viewport MapViewport Both
  $ vBox mapRows
  where
    -- TODO
    firstRow = [str "@"] <> replicate 79 (str " ")
    mapRows = firstRow <> (replicate 20 . hBox . replicate 80 $ str " ")

drawGame :: GameState -> [Widget Name]
drawGame game = pure . withBorderStyle unicode
  $   drawMessages game
  <=> border (drawMap game)