add Widget module
This commit is contained in:
1 parent
b455fb9e15
commit
f2d3942f8a
6 files changed
+67
No files matched your search
@@ -0,0 +1,33 @@
|
||||
module Widget
|
||||
def initialize
|
||||
@x = 0
|
||||
@y = 0
|
||||
@width = 0
|
||||
@height = 0
|
||||
end
|
||||
|
||||
def children
|
||||
[]
|
||||
end
|
||||
|
||||
def resize(x, y, width, height)
|
||||
@x = x
|
||||
@y = y
|
||||
@width = width
|
||||
@height = height
|
||||
end
|
||||
|
||||
def draw
|
||||
if @x > 0 and @y > 0
|
||||
render_begin
|
||||
render
|
||||
children.each do |child|
|
||||
child.draw
|
||||
end
|
||||
render_end
|
||||
end
|
||||
end
|
||||
|
||||
def render_end
|
||||
end
|
||||
end
|
||||
@@ -1,6 +1,8 @@
|
||||
require "set"
|
||||
|
||||
class Window
|
||||
include Widget
|
||||
|
||||
@windows = Set.new
|
||||
|
||||
class << self
|
||||
|
||||
Reference in new issue
Block a user