Added #find_element_by_tag to Common module

This commit is contained in:
2023-01-31 14:33:17 -06:00
parent 14e9d4946f
commit eb5d170733

View File

@@ -31,6 +31,18 @@ module CyberarmEngine
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