Archived
1
0
Fork 0

Use Curses::Window

This commit is contained in:
Braiden Vasco 2017-07-24 10:08:53 +00:00
parent 1256a97479
commit 2a7506bba6

View file

@ -2,10 +2,13 @@
module Widgets module Widgets
class Base class Base
attr_reader :window
attr_reader :x, :y, :width, :height attr_reader :x, :y, :width, :height
attr_accessor :focused attr_accessor :focused
def initialize(x, y, width, height) def initialize(x, y, width, height)
@window = Curses::Window.new height, width, y, x
@x = x @x = x
@y = y @y = y
@ -15,14 +18,11 @@ module Widgets
@focused = false @focused = false
end end
def window
Curses
end
def trigger(event); end def trigger(event); end
def render def render
draw draw
window.refresh
end end
def draw def draw
@ -30,7 +30,7 @@ module Widgets
end end
def setpos(x, y) def setpos(x, y)
window.setpos self.y + y, self.x + x window.setpos y, x
end end
def addstr(s) def addstr(s)