Archived
1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
cli-old/lib/widgets/base.rb

33 lines
494 B
Ruby
Raw Normal View History

2017-07-22 05:00:28 -04:00
# frozen_string_literal: true
module Widgets
class Base
attr_reader :x, :y, :width, :height
attr_accessor :focused
def initialize(x, y, width, height)
@x = x
@y = y
@width = width
@height = height
@focused = false
end
def trigger(event); end
def render
2017-07-22 09:03:10 -04:00
draw
end
def draw
raise NotImplementedError, "#{self.class}#draw"
2017-07-22 05:00:28 -04:00
end
2017-07-22 10:27:14 -04:00
def setpos(x, y)
2017-07-22 10:31:38 -04:00
Curses.setpos self.y + y, self.x + x
2017-07-22 10:27:14 -04:00
end
2017-07-22 05:00:28 -04:00
end
end