Ticket #18 (closed defect: fixed)
Odd behaviour with renderFill
| Reported by: | anonymous | Owned by: | coconnor |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | Uncategorized | Version: | |
| Keywords: | renderFill | Cc: |
Description
I'm trying to draw a box on the screen. It should look like this:
+--------+ |XXXXXXXX| |XXXXXXXX| |XXXXXXXX| |XXXXXXXX| |XXXXXXXX| |XXXXXXXX| |XXXXXXXX| |XXXXXXXX| +--------+
Here is what I see instead:
+--------+ |XXXXXXXX| |||||||XXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXX +--------+
Here is the code to produce this:
module Main
where
import Graphics.Vty
main :: IO ()
main = do
vty <- mkVty
(sx, sy) <- getSize vty
play vty sx sy
play :: Vty -> Int -> Int -> IO ()
play vty sx sy =
let
testScreen = pic {
pCursor = NoCursor
, pImage = box 10 10 }
in do
update vty testScreen
k <- getEvent vty
case k of
EvKey KEsc [] -> shutdown vty >> return ()
EvResize nx ny -> play vty nx ny
_ -> play vty sx sy
dumpA = setFG white $ setBG black $ attr
box :: Int -> Int -> Image
box w h =
let
corner = renderChar dumpA '+'
vertLine = renderFill dumpA '|' 1 (h - 2)
horizLine = corner <|> renderHFill dumpA '-' (w - 2) <|> corner
centerArea = vertLine <|> renderFill dumpA 'X' (w - 2) (h - 2) <|> vertLine
in
horizLine <-> centerArea <-> horizLine
I'm using GHC 6.10.2 and Vty 3.1.8.4
Attachments
Change History
Note: See
TracTickets for help on using
tickets.
