문제

How can I make my Ruby application do nothing and continue if Curses.getch takes too long (over x amount of milliseconds) to respond?

Example:

case Curses.getch
  when ?a (do stuff)
  when ?s (do stuff)
  etc.
  when takesTooLong (do nothing)
end

I want the application to continue if the user does not press a key in the specified amount of time.

How can I do this? I thought about doing a sleep after the Curses.getch, but the sleep would execute after the user presses a key.

도움이 되었습니까?

해결책

Use Curses::timeout=, Doorknob.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top