roguelike/src/Main.hs

24 lines
498 B
Haskell
Raw Normal View History

2021-02-11 22:40:00 +00:00
module Main where
import Graphics.Vty
import Game
import Rendering
import Action
main :: IO ()
main = do
cfg <- standardIOConfig
vty <- mkVty cfg
2021-02-15 19:57:45 +00:00
game <- newGame
loop vty game
2021-02-11 22:40:00 +00:00
shutdown vty
where loop vty game = do
update vty $ renderGame game
e <- nextEvent vty
let action = eventToAction e
nGame = runAction action game
case nGame of
Nothing -> return ()
Just ng -> loop vty ng