質問

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