lib/cyberarm_engine/common.rb in cyberarm_engine-0.22.0 vs lib/cyberarm_engine/common.rb in cyberarm_engine-0.23.0

- old
+ new

@@ -29,9 +29,21 @@ def show_cursor=(boolean) window.show_cursor = boolean end + def find_element_by_tag(container, tag, list = []) + return unless container + + container.children.each do |child| + list << child if child.style.tag == tag + + find_element_by_tag(child, tag, list) if child.is_a?(CyberarmEngine::Element::Container) + end + + list.first + end + def draw_rect(x, y, width, height, color, z = 0, mode = :default) Gosu.draw_rect(x, y, width, height, color, z, mode) end def fill(color, z = 0)