[Haskell-cafe] [Haskell Cafe] ASCII Graphics Library wanted

Peter Verswyvelen bugfact at gmail.com
Sun Aug 30 18:06:56 EDT 2009


As mentioned in a previous thread that you might have missed, in case you're
on Windows, and you want to use unbuffered raw keyboard input, this is
currently broken.
But a quick workaround is to wrap the DOS/Windows conio functions, like
this:

-- | Read the next character from the console's input queue.
--   This is a blocking operation if no key is queued.
getCh :: IO Char
getCh = fmap (toEnum.fromIntegral) c_getch
foreign import ccall unsafe "conio.h getch" c_getch :: IO CInt

-- | Check if at least one key is queued.
kbHit :: IO Bool
kbHit = fmap (/=0) c_kbhit
foreign import ccall unsafe "conio.h kbhit" c_kbhit :: IO CInt




On Sun, Aug 30, 2009 at 4:42 PM, Paul Sujkov <psujkov at gmail.com> wrote:

> Hi Peter,
>
> yes, this seems like what I actually want. Thank you :)
>
> 2009/8/30 Peter Verswyvelen <bugfact at gmail.com>
>
> Maybe this can help?
>> http://hackage.haskell.org/package/ansi-terminal
>>  <http://hackage.haskell.org/package/ansi-terminal>
>>
>>   On Sun, Aug 30, 2009 at 4:24 PM, Paul Sujkov <psujkov at gmail.com> wrote:
>>
>>>   Hi,
>>>
>>> is there any (by any means) portable ASCII-Graphics library for Haskell,
>>> such as NCurses or AALib? I see HaHa library on Hackage, but is it the only
>>> existing library for such a purpose (version 0.2 alerts me a bit)? Or maybe
>>> someone has any experience in developing some rogue-like gams in Haskell? :)
>>>
>>> --
>>> Regards, Paul Sujkov
>>>
>>> _______________________________________________
>>> Haskell-Cafe mailing list
>>> Haskell-Cafe at haskell.org
>>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>>
>>>
>>
>
>
> --
> Regards, Paul Sujkov
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090830/2b5c918d/attachment.html


More information about the Haskell-Cafe mailing list