2019-08-20 00:18:23 -04:00
|
|
|
{- |
|
|
|
|
|
|
|
|
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 ((^.))
|
2019-08-20 00:18:23 -04:00
|
|
|
import qualified UI.NCurses as C
|
|
|
|
|
|
|
|
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
|
|
|
|
MainMenu -> mainMenu
|
|
|
|
NewSeason -> newSeason
|
2019-08-20 11:17:24 -04:00
|
|
|
NewGame -> newGame
|
2019-08-20 01:40:59 -04:00
|
|
|
C.render
|
|
|
|
|
|
|
|
mainMenu :: C.Update ()
|
|
|
|
mainMenu = C.drawString $ unlines
|
|
|
|
[ "*** MAIN MENU ***"
|
|
|
|
, "1) New Season"
|
2019-08-20 11:17:24 -04:00
|
|
|
, "2) New Game"
|
|
|
|
, "3) Exit"
|
2019-08-20 01:40:59 -04:00
|
|
|
]
|
|
|
|
|
|
|
|
newSeason :: C.Update ()
|
2019-08-20 10:40:17 -04:00
|
|
|
newSeason = C.drawString $ unlines
|
|
|
|
[ "*** SEASON TYPE ***"
|
|
|
|
, "1) Regular Season"
|
|
|
|
, "2) Playoffs"
|
|
|
|
]
|
2019-08-20 11:17:24 -04:00
|
|
|
|
|
|
|
newGame :: C.Update ()
|
|
|
|
newGame = return ()
|