main :: IO()
main = runCurses $ do
setEcho False
w <- defaultWindow
canvas <- newWindow 19 19 0 0
panel <- newPanel canvas
updateWindow canvas $ do
drawString "Hello world!"
render
waitFor w (\ev -> ev == EventCharacter 'q' || ev == EventCharacter 'Q')
waitFor :: Window -> (Event -> Bool) -> Curses ()
waitFor w p = loop where
loop = do
ev <- getEvent w Nothing
case ev of
Nothing -> loop
Just ev' -> unless (p ev') loop
你好。它是 ncurses 包的一些修改示例。问题是不显示任何内容。我记得在 C API 中,我必须独立刷新每个窗口。但 Haskell 只提供render
. 我哪里错了?我想要一些可移动的小部件。