on master help sign in
update Test.hs
e08a59eCorey O'Connor
test/Test.hs+7−7
@@ -17,7 +17,7 @@ main = do
17pieceA = def_attr `with_fore_color` red
17pieceA = def_attr `with_fore_color` red
18dumpA = def_attr `with_style` reverse_video
18dumpA = def_attr `with_style` reverse_video
19
19
20−play :: Vty -> Word -> Word -> Word -> Word -> String -> IO ()
20+play :: Vty -> Int -> Int -> Int -> Int -> String -> IO ()
21play vt x y sx sy btl = do update vt (current_pic x y sx sy btl)
21play vt x y sx sy btl = do update vt (current_pic x y sx sy btl)
22 k <- next_event vt
22 k <- next_event vt
23 case k of EvKey (KASCII 'r') [MCtrl] -> refresh vt >> play vt x y sx sy btl
23 case k of EvKey (KASCII 'r') [MCtrl] -> refresh vt >> play vt x y sx sy btl
@@ -26,15 +26,15 @@ play vt x y sx sy btl = do update vt (current_pic x y sx sy btl)
26 EvKey KUp [] | y /= 1 -> play vt x (y-1) sx sy btl
26 EvKey KUp [] | y /= 1 -> play vt x (y-1) sx sy btl
27 EvKey KDown [] | y /= (sy-2) -> play vt x (y+1) sx sy btl
27 EvKey KDown [] | y /= (sy-2) -> play vt x (y+1) sx sy btl
28 EvKey KEsc [] -> shutdown vt >> return ()
28 EvKey KEsc [] -> shutdown vt >> return ()
29− EvResize nx ny -> play vt (min x (toEnum nx - 1))
29+ EvResize nx ny -> play vt (min x (nx - 1))
30− (min y (toEnum ny - 2))
30+ (min y (ny - 2))
31− (toEnum nx)
31+ nx
32− (toEnum ny)
32+ ny
33 btl
33 btl
34− _ -> play vt x y sx sy (take (fromEnum sx) (show k ++ btl))
34+ _ -> play vt x y sx sy (take sx (show k ++ btl))
35
35
36
36
37−current_pic :: Word -> Word -> Word -> Word -> String -> Picture
37+current_pic :: Int -> Int -> Int -> Int -> String -> Picture
38current_pic x y sx sy btl = pic_for_image i
38current_pic x y sx sy btl = pic_for_image i
39 where i = string def_attr "Move the @ character around with the arrow keys. Escape exits."
39 where i = string def_attr "Move the @ character around with the arrow keys. Escape exits."
40 <-> char_fill pieceA ' ' sx (y - 1)
40 <-> char_fill pieceA ' ' sx (y - 1)