From 4d36268b040bc799cb19e781d5e0e21be543e076 Mon Sep 17 00:00:00 2001 From: Cyberarm Date: Thu, 28 Jun 2018 09:30:17 -0500 Subject: [PATCH] Bug fixes: fixed crash with checkbox --- lib/cyberarm_engine/ui/check_box.rb | 6 +++--- lib/cyberarm_engine/ui/container.rb | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/cyberarm_engine/ui/check_box.rb b/lib/cyberarm_engine/ui/check_box.rb index 5c34d6d..897b22c 100644 --- a/lib/cyberarm_engine/ui/check_box.rb +++ b/lib/cyberarm_engine/ui/check_box.rb @@ -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 diff --git a/lib/cyberarm_engine/ui/container.rb b/lib/cyberarm_engine/ui/container.rb index edd4916..8be8a86 100644 --- a/lib/cyberarm_engine/ui/container.rb +++ b/lib/cyberarm_engine/ui/container.rb @@ -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)