add Widget module

This commit is contained in:
josh committed 2014-07-27 09:28:35 -04:00
1 parent b455fb9e15
commit f2d3942f8a
6 files changed
+67

No files matched your search

+33
View File
@@ -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
+2
View File
@@ -1,6 +1,8 @@
require "set"
class Window
include Widget
@windows = Set.new
class << self
+1
View File
@@ -5,6 +5,7 @@ end
def load_lib_files
require "gl_program"
require "runtime"
require "widget"
require "window"
end