Sy Ali
7/25/2006 10:44:00 AM
On 7/25/06, Ondrej Bilka <eirik@atlas.cz> wrote:
> I tried too write my mud client but I gave up because
> I cannot find way how recogtnize keystrokes at console
> with curses/ncurses I cannot use numpad for quickwalk(could but then
> would walk istead write numbers or without numlock recognize PgUp from
> 9) and got control chars istead colors.
> With SDL I could do it but I cant run it at 80*25 and I too got control
> chars istead colors
> Then I looked how it was done in tinyfugue -magic code which used
> termio
> So I used def mvprint(i,j,str) print "\33[#{i};#{j]"+str end for output
> and curses for input.(bad idea but colors worked).
> Another problem was infamous Thread#sleep -each inputed line runs in
> separate thread(solved by set_trace_func)
> And worst thing debugging with curses is almost impossible.
In muby, the keypad seems to be working correctly, because there are
some specific local input triggers which catch the keypad home/end for
use. They ought to work just fine. Any keycode can be reacted to,
although programming hotkeys is currently done in the source code and
not a user-file.
I also have an issue with the main users having different keyboards
and so there needs to be some sort of proper keyboard setting so that
the right codes are used in the right cases. Heck, my keyboard works
differently in an xterm vs a terminal. =/
I am not perfectly familiar with the muby code yet, but there is a
main keyboard loop which reacts to keyboard input. However it's
implemented (and I can't quite figure it out) it's working perfectly.
So far the ncurses stuff is black magic to me. I don't know why it's
being relied on for colour -- I wouldn't use it for colour -- but it
seems to work. It's doing all the magical screen area definitions,
height/width detection, scrollback buffer and probably other things.
Maybe it's doing the keyboard input too.. that would explain why I
haven't found that code. =)