lib/whirled_peas/graphics/screen.rb in whirled_peas-0.5.0 vs lib/whirled_peas/graphics/screen.rb in whirled_peas-0.6.0
- old
+ new
@@ -10,15 +10,20 @@
def self.current_dimensions
width, height = HighLine.new.terminal.terminal_size
[width || 0, height || 0]
end
- def initialize(output=STDOUT)
+ def initialize(width: nil, height: nil, output: STDOUT)
@output = output
@terminal = HighLine.new.terminal
@strokes = []
- refresh_size!
- Signal.trap('SIGWINCH', proc { self.refresh_size! })
+ if width && height
+ @width = width
+ @height = height
+ else
+ refresh_size!
+ Signal.trap('SIGWINCH', proc { self.refresh_size! })
+ end
end
def paint(template)
@template = template
draw