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
@checked = checked
@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
end
@@ -55,8 +55,8 @@ module CyberarmEngine
end
def mouse_over?
if $window.mouse.x.between?(@x, @x+width)
if $window.mouse.y.between?(@y, @y+height)
if $window.mouse_x.between?(@x, @x+width)
if $window.mouse_y.between?(@y, @y+height)
true
end
end

View File

@@ -114,7 +114,7 @@ module CyberarmEngine
end
# 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)
end
@@ -132,12 +132,12 @@ module CyberarmEngine
# Return X position relative to container
def relative_x(int)
int-self.x
self.x+int
end
# Return Y position relative to container
def relative_y(int)
int-self.y
self.y+int
end
def calc_percentage(positive, total)