Sha256: 4e6d6e98c3c25082474124331a22e85a9a62c5f3085b8511a8bccf6de2bac33e

Contents?: true

Size: 574 Bytes

Versions: 52

Compression:

Stored size: 574 Bytes

Contents

#!/usr/bin/env ruby

require "curses"

def show_message(message)
  height = 5
  width  = message.length + 6
  top    = (Curses.lines - height) / 2
  left   = (Curses.cols - width) / 2
  win = Curses::Window.new(height, width, top, left)
  win.box("|", "-")
  win.setpos(2, 3)
  win.addstr(message)
  win.refresh
  win.getch
  win.close
end

Curses.init_screen
begin
  Curses.crmode
  Curses.setpos((Curses.lines - 1) / 2, (Curses.cols - 11) / 2)
  Curses.addstr("Hit any key")
  Curses.refresh
  Curses.getch
  show_message("Hello, World!")
ensure
  Curses.close_screen
end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
curses-1.2.7 sample/hello.rb
curses-1.2.6-x86-mingw32 sample/hello.rb
curses-1.2.6-x64-mingw32 sample/hello.rb
curses-1.2.6 sample/hello.rb
curses-1.2.5 sample/hello.rb
curses-1.2.4-x86-mingw32 sample/hello.rb
curses-1.2.4-x64-mingw32 sample/hello.rb
curses-1.2.4 sample/hello.rb
curses-1.2.3-x64-mingw32 sample/hello.rb
curses-1.2.3-x86-mingw32 sample/hello.rb
curses-1.2.3 sample/hello.rb
curses-1.2.2-x86-mingw32 sample/hello.rb
curses-1.2.2-x64-mingw32 sample/hello.rb
curses-1.2.2 sample/hello.rb
curses-1.2.1-x86-mingw32 sample/hello.rb
curses-1.2.1-x64-mingw32 sample/hello.rb
curses-1.2.1 sample/hello.rb
curses-1.2.0-x64-mingw32 sample/hello.rb
curses-1.2.0-x86-mingw32 sample/hello.rb
curses-1.2.0 sample/hello.rb