lib/rtanque/gui/window.rb in rtanque-0.1.1 vs lib/rtanque/gui/window.rb in rtanque-0.1.2
- old
+ new
@@ -24,10 +24,12 @@
end
# Fullscreen: https://github.com/jlnr/gosu/issues/159#issuecomment-12473172
super(@arena.width, @arena.height, false, UPDATE_INTERVAL)
self.caption = self.class.name.split('::').first
@background = Gosu::Image.new(self, Gui.resource_path("images/grass.png"))
+
+ @draw_procs = []
end
def update
@match.tick
end
@@ -44,9 +46,19 @@
def draw_drawables
self.gui_bots.draw
self.gui_shells.draw
self.gui_explosions.draw
+
+ @draw_procs.each do |proc|
+ proc.call self
+ end
+
+ @draw_procs.clear
end
+
+ def add_draw_proc &b
+ @draw_procs << b
+ end
end
end
-end
\ No newline at end of file
+end