added title screen logic branch

This commit is contained in:
Jonathan Lamothe
2020-01-21 22:20:01 -05:00
parent be9d7d80bb
commit 45aea607b2
3 changed files with 33 additions and 2 deletions

View File

@@ -29,6 +29,7 @@ import Lens.Micro.Extras (view)
import qualified UI.NCurses as C import qualified UI.NCurses as C
import Mtlstats.Actions import Mtlstats.Actions
import Mtlstats.Control.TitleScreen
import Mtlstats.Control.EditGoalie import Mtlstats.Control.EditGoalie
import Mtlstats.Control.EditPlayer import Mtlstats.Control.EditPlayer
import Mtlstats.Control.EditStandings import Mtlstats.Control.EditStandings
@@ -42,6 +43,7 @@ import Mtlstats.Types
-- run -- run
dispatch :: ProgState -> Controller dispatch :: ProgState -> Controller
dispatch s = case s^.progMode of dispatch s = case s^.progMode of
TitleScreen -> titleScreenC
MainMenu -> mainMenuC MainMenu -> mainMenuC
NewSeason flag -> newSeasonC flag NewSeason flag -> newSeasonC flag
NewGame gs -> newGameC gs NewGame gs -> newGameC gs

View File

@@ -0,0 +1,27 @@
{- |
mtlstats
Copyright (C) 1984, 1985, 2019, 2020 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.Control.TitleScreen (titleScreenC) where
import Mtlstats.Types
titleScreenC :: Controller
titleScreenC = undefined

View File

@@ -236,7 +236,8 @@ data ProgState = ProgState
-- | The program mode -- | The program mode
data ProgMode data ProgMode
= MainMenu = TitleScreen
| MainMenu
| NewSeason Bool | NewSeason Bool
| NewGame GameState | NewGame GameState
| EditMenu | EditMenu
@@ -247,6 +248,7 @@ data ProgMode
| EditStandings EditStandingsMode | EditStandings EditStandingsMode
instance Show ProgMode where instance Show ProgMode where
show TitleScreen = "TitleScreen"
show MainMenu = "MainMenu" show MainMenu = "MainMenu"
show (NewSeason _) = "NewSeason" show (NewSeason _) = "NewSeason"
show (NewGame _) = "NewGame" show (NewGame _) = "NewGame"
@@ -760,7 +762,7 @@ esmSubModeL = lens
newProgState :: ProgState newProgState :: ProgState
newProgState = ProgState newProgState = ProgState
{ _database = newDatabase { _database = newDatabase
, _progMode = MainMenu , _progMode = TitleScreen
, _inputBuffer = "" , _inputBuffer = ""
, _scrollOffset = 0 , _scrollOffset = 0
} }