blob: a630fb999b8fe4ce352105cd53b33153fd335f94 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
require "curses"
def show_message(message)
width = message.length + 6
win = Curses::Window.new(5, width,
(Curses.lines - 5) / 2, (Curses.cols - width) / 2)
win.box('|', '-')
win.setpos(2, 3)
win.addstr(message)
win.refresh
win.getch
win.close
end
Curses.init_screen
begin
Curses.crmode
# show_message("Hit any key")
Curses.setpos((Curses.lines - 5) / 2, (Curses.cols - 10) / 2)
Curses.addstr("Hit any key")
Curses.refresh
char = Curses.getch
show_message("You typed: #{char}")
Curses.refresh
ensure
Curses.close_screen
end
|