Bug fixes: fixed crash with checkbox

This commit is contained in:
2018-06-28 09:30:17 -05:00
parent b4852fbbd6
commit 4d36268b04
2 changed files with 6 additions and 6 deletions

View File

@@ -9,7 +9,7 @@ module CyberarmEngine
@x, @y = x, y @x, @y = x, y
@checked = checked @checked = checked
@size = size @size = size
@text = Text.new("", false, x: x, y: y, size: size, color: BUTTON_TEXT_COLOR, shadow: true) @text = Text.new("", x: x, y: y, size: size, color: BUTTON_TEXT_COLOR, shadow: true)
return self return self
end end
@@ -55,8 +55,8 @@ module CyberarmEngine
end end
def mouse_over? def mouse_over?
if $window.mouse.x.between?(@x, @x+width) if $window.mouse_x.between?(@x, @x+width)
if $window.mouse.y.between?(@y, @y+height) if $window.mouse_y.between?(@y, @y+height)
true true
end end
end end

View File

@@ -114,7 +114,7 @@ module CyberarmEngine
end end
# Fills container background with color # Fills container background with color
def fill(color = Gosu::Color::BLACK, z = 0) def fill(color = Gosu::Color::BLACK, z = -1)
$window.draw_rect(@x, @y, @width, @height, color, z) $window.draw_rect(@x, @y, @width, @height, color, z)
end end
@@ -132,12 +132,12 @@ module CyberarmEngine
# Return X position relative to container # Return X position relative to container
def relative_x(int) def relative_x(int)
int-self.x self.x+int
end end
# Return Y position relative to container # Return Y position relative to container
def relative_y(int) def relative_y(int)
int-self.y self.y+int
end end
def calc_percentage(positive, total) def calc_percentage(positive, total)