Added Container#clear to remove child elements and optionally eval block, improvements to EditLine to show current selection.

This commit is contained in:
2019-11-21 14:07:42 -06:00
parent 89a54e90a1
commit 7f97ec85dd
5 changed files with 112 additions and 37 deletions

View File

@@ -2,6 +2,7 @@ module CyberarmEngine
class Element
class Container < Element
include Common
include CyberarmEngine::DSL
attr_accessor :stroke_color, :fill_color
attr_reader :children, :gui_state
@@ -31,6 +32,12 @@ module CyberarmEngine
recalculate
end
def clear(&block)
@children.clear
block.call(self) if block
end
def render
Gosu.clip_to(@x, @y, width, height) do
@children.each(&:draw)