diff --git a/lib/cyberarm_engine/ui/container.rb b/lib/cyberarm_engine/ui/container.rb index b336122..711c733 100644 --- a/lib/cyberarm_engine/ui/container.rb +++ b/lib/cyberarm_engine/ui/container.rb @@ -69,15 +69,11 @@ module CyberarmEngine def recalculate @current_position = Vector.new(@margin_left, @margin_top) - if @children.first - @current_position.x += @children.first.margin_left - @current_position.y += @children.first.margin_top - end layout - @width = @max_width ? @max_width : (@children.map {|c| c.x + c.width }.max || 0).round - @height = @max_height ? @max_height : (@children.map {|c| c.y + c.height}.max || 0).round + @width = @max_width ? @max_width : (@children.map {|c| c.x + c.width + c.margin_right}.max || 0).round + @height = @max_height ? @max_height : (@children.map {|c| c.y + c.height+ c.margin_top }.max || 0).round # Move child to parent after positioning @children.each do |child| @@ -104,8 +100,8 @@ module CyberarmEngine end def position_on_current_line(element) - element.x = @current_position.x - element.y = @current_position.y + element.x = element.margin_left + @current_position.x + element.y = element.margin_top + @current_position.y element.recalculate @@ -114,8 +110,8 @@ module CyberarmEngine end def move_to_next_line(element) - element.x = @current_position.x - element.y = @current_position.y + element.x = element.margin_left + @current_position.x + element.y = element.margin_top + @current_position.y element.recalculate diff --git a/lib/cyberarm_engine/ui/element.rb b/lib/cyberarm_engine/ui/element.rb index b8185ce..a3610cd 100644 --- a/lib/cyberarm_engine/ui/element.rb +++ b/lib/cyberarm_engine/ui/element.rb @@ -147,11 +147,11 @@ module CyberarmEngine end def width - @border_thickness_left + @padding_left + @width + @padding_right + @border_thickness_right + (@border_thickness_left + @padding_left) + @width + (@padding_right + @border_thickness_right) end def height - @border_thickness_top + @padding_top + @height + @padding_bottom + @border_thickness_bottom + (@border_thickness_top + @padding_top) + @height + (@padding_bottom + @border_thickness_bottom) end def background=(_background) diff --git a/lib/cyberarm_engine/ui/flow.rb b/lib/cyberarm_engine/ui/flow.rb index 5e6033c..7ad647c 100644 --- a/lib/cyberarm_engine/ui/flow.rb +++ b/lib/cyberarm_engine/ui/flow.rb @@ -10,8 +10,8 @@ module CyberarmEngine @current_position.x = @margin_left + @x @current_position.y += child.height + child.margin_bottom - child.x = @current_position.x - child.y = @current_position.y + child.x = element.margin_left + @current_position.x + child.y = element.margin_top + @current_position.y child.recalculate diff --git a/lib/cyberarm_engine/ui/theme.rb b/lib/cyberarm_engine/ui/theme.rb index 51a3e98..564d480 100644 --- a/lib/cyberarm_engine/ui/theme.rb +++ b/lib/cyberarm_engine/ui/theme.rb @@ -36,17 +36,17 @@ module CyberarmEngine height: 0, color: Gosu::Color::WHITE, background: Gosu::Color::NONE, - margin: 2, - padding: 2, + margin: 0, + padding: 0, border_thickness: 0, border_color: Gosu::Color::NONE, border_radius: 0, }, Button: { - margin: 2, - padding: 2, - border_thickness: 2, + margin: 1, + padding: 4, + border_thickness: 4, border_color: ["ffd59674".hex, "ffff8746".hex], border_radius: 0, background: ["ffc75e61".to_i(16), "ffe26623".to_i(16)], @@ -76,15 +76,15 @@ module CyberarmEngine }, Label: { - text_size: 24, + text_size: 28, text_shadow: false, - font: "Akaash" + font: "Arial", + margin: 0, + padding: 2 }, ToggleButton: { - checkmark: "√", - padding_left: 0, - margin_left: 0 + checkmark: "√" } } end