mtlstats/src/Mtlstats/UI.hs

43 lines
1.1 KiB
Haskell
Raw Normal View History

{- |
mtlstats
Copyright (C) 2019 Rhéal Lamothe
<rheal.lamothe@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
-}
module Mtlstats.UI (draw) where
2019-08-20 01:40:59 -04:00
import Lens.Micro ((^.))
import qualified UI.NCurses as C
2019-08-21 01:08:12 -04:00
import Mtlstats.Menu
import Mtlstats.Types
-- | Drawing function
draw :: ProgState -> C.Curses ()
2019-08-20 01:40:59 -04:00
draw s = do
w <- C.defaultWindow
C.updateWindow w $ do
C.clear
case s ^. progMode of
2019-08-21 01:08:12 -04:00
MainMenu -> drawMenu mainMenu
2019-08-21 01:15:26 -04:00
NewSeason -> drawMenu newSeasonMenu
2019-08-22 16:48:30 -04:00
NewGame gs -> if null $ gs ^. gameType
then drawMenu gameTypeMenu
else undefined
2019-08-20 01:40:59 -04:00
C.render