on simplify-attr help sign in
vty/test/Issue18.hs
34 lines 756 B history raw
1module Main where
3import Graphics.Vty
4import Graphics.Vty.Debug
6import System.IO
8main :: IO ()
9main = do
10 vty <- mkVty
11 (sx, sy) <- getSize vty
12 play vty sx sy
14play :: Vty -> Int -> Int -> IO ()
15play vty sx sy =
16 let
17 testScreen = pic {
18 pCursor = NoCursor
19 , pImage = box 10 10 }
20 in do
21 update vty testScreen
22 getEvent vty
23 shutdown vty
24 return ()
26box :: Int -> Int -> Image
27box w h =
28 let
29 corner = renderChar attr '+'
30 vertLine = renderFill attr '|' 1 (h - 2)
31 horizLine = corner <|> renderHFill attr '-' (w - 2) <|> corner
32 centerArea = vertLine <|> renderFill attr 'X' (w - 2) (h - 2) <|> vertLine
33 in
34 horizLine <-> centerArea <-> horizLine