hi to all!
i’ve seen this question posted many times without a single definitive
answer. what i’m trying to get is a single character from the keyboard
in a multiplatform solution: i hit the key “h” and rubu knows “h” has
been pressed. i need it to detect the imput for a game i’m working on:
insertin the key-detection into a loop would actually make the player
interact with the game.
i’ve come across the library highline ( http://highline.rubyforge.org/
). the simplest program
#print "Enter one character: "
char = get_character
if char != nil
only works to a certain extend. it puts out the received character only
after the end of the program, not during its execution, for some strange
reason. moreover it blocks the execution of the program while integrated
into a gosu ( http://code.google.com/p/gosu/ ) framework.
on the other hand, any attempt on using curses results, don’t know why,
in the error:
LINES value must be >= 2 and <= -2616: got 1
initscr(): LINES=1 COLS=1: too small.
anyone can help?