Class: Blight::Window

Inherits:
Object
  • Object
show all
Defined in:
lib/blight.rb

Instance Method Summary collapse

Constructor Details

#initializeWindow

Returns a new instance of Window.



41
42
43
# File 'lib/blight.rb', line 41

def initialize
  @window = Ncurses.stdscr
end

Instance Method Details

#closeObject



70
71
72
# File 'lib/blight.rb', line 70

def close
  @closed = true
end

#heightObject



57
58
59
# File 'lib/blight.rb', line 57

def height
  Ncurses.getmaxy(@window)
end

#open?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/blight.rb', line 66

def open?
  !@closed
end


61
62
63
64
# File 'lib/blight.rb', line 61

def print(string, x = x, y = y)
  Ncurses.mvwprintw(@window, y, x, string)
  refresh
end

#refreshObject



74
75
76
# File 'lib/blight.rb', line 74

def refresh
  Ncurses.refresh
end

#widthObject



53
54
55
# File 'lib/blight.rb', line 53

def width
  Ncurses.getmaxx(@window)
end

#xObject



45
46
47
# File 'lib/blight.rb', line 45

def x
  Ncurses.getcurx(@window)
end

#yObject



49
50
51
# File 'lib/blight.rb', line 49

def y
  Ncurses.getcury(@window)
end