--20cf3071d052984c6704ade12635 Content-Type: text/plain; charset=ISO-8859-1 On Mon, Sep 26, 2011 at 3:05 AM, Sean O'Halpin <sean.ohalpin / gmail.com>wrote: > Hi Josh, > > To get non-blocking input in ncurses you have to change the input mode > using either nodelay or timeout. For example: > > require 'ffi-ncurses' > > def KEY(ch) > ch[0].ord > end > > include FFI::NCurses > initscr > begin > cbreak > noecho > curs_set 0 > timeout(100) # delay in milliseconds > counter > move 0, 0 > scrollok(stdscr, true) > while (ch etch) ! EY("q") > flushinp > addstr sprintf("You pressed %d\n", ch) > refresh > end > ensure > endwin > end > > See "man timeout" for more details. Thanks for the feedback. I'll add > this (and a threaded example) to the examples directory. > > Regards, > Sean > > Thanks a lot, Sean :) --20cf3071d052984c6704ade12635--