lib/cyberarm_engine/ui/button.rb in cyberarm_engine-0.7.1 vs lib/cyberarm_engine/ui/button.rb in cyberarm_engine-0.8.0
- old
+ new
@@ -1,11 +1,11 @@
module CyberarmEngine
class Button < Label
def initialize(text, options = {}, block = nil)
super(text, options, block)
- @background_canvas.background = default(:background)
+ @style.background_canvas.background = default(:background)
end
def render
draw_text
end
@@ -16,21 +16,21 @@
def enter(sender)
@focus = false unless window.button_down?(Gosu::MsLeft)
if @focus
- @background_canvas.background = default(:active, :background)
+ @style.background_canvas.background = default(:active, :background)
@text.color = default(:active, :color)
else
- @background_canvas.background = default(:hover, :background)
+ @style.background_canvas.background = default(:hover, :background)
@text.color = default(:hover, :color)
end
end
def left_mouse_button(sender, x, y)
@focus = true
- @background_canvas.background = default(:active, :background)
+ @style.background_canvas.background = default(:active, :background)
window.current_state.focus = self
@text.color = default(:active, :color)
end
def released_left_mouse_button(sender,x, y)
@@ -40,10 +40,10 @@
def clicked_left_mouse_button(sender, x, y)
@block.call(self) if @block
end
def leave(sender)
- @background_canvas.background = default(:background)
+ @style.background_canvas.background = default(:background)
@text.color = default(:color)
end
def blur(sender)
@focus = false
\ No newline at end of file