-
-
Save robins35/f10eae7bc248c3bef855 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require_relative 'environment' | |
begin | |
window = Ncurses.initscr | |
Ncurses.raw | |
Ncurses.keypad(Ncurses.stdscr, true) | |
#Ncurses.mvaddstr(4, 19, "Hello, world!"); | |
Ncurses.printw("Enter your name > ") | |
while (Ncurses.getstr(str = "")) != 'q' | |
Ncurses.printw("#{str.reverse}\n") | |
Ncurses.printw("Rows and columns are: ") | |
rows, cols = Ncurses.getmaxyx | |
Ncurses.printw("%d, %d\n\n", rows, cols) | |
Ncurses.refresh | |
end | |
ensure | |
Ncurses.endwin | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ncurses' | |
module RealRubyNcurses | |
def getmaxyx(screen = stdscr) | |
row = col = [] | |
super(screen, row, col) | |
row + col | |
end | |
end | |
class << Ncurses | |
prepend RealRubyNcurses | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment