roguelike/src/Main.hs

25 lines
529 B
Haskell
Raw Normal View History

2021-02-11 22:40:00 +00:00
module Main where
import Graphics.Vty
import System.Random
2021-02-11 22:40:00 +00:00
import Game
import Rendering
import Action
main :: IO ()
main = do
cfg <- standardIOConfig
vty <- mkVty cfg
gen <- getStdGen
loop vty $ newGame gen
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