mirror of
https://github.com/cyberarm/cyberarm_engine.git
synced 2025-12-16 05:02:34 +00:00
Fixed Image element background and border not working, made button use Style as sole source of background and color colors
This commit is contained in:
@@ -10,7 +10,7 @@ module CyberarmEngine
|
|||||||
|
|
||||||
super(text_or_image, options, block)
|
super(text_or_image, options, block)
|
||||||
|
|
||||||
@style.background_canvas.background = default(:background)
|
@style.background_canvas.background = @style.background
|
||||||
end
|
end
|
||||||
|
|
||||||
def render
|
def render
|
||||||
@@ -38,14 +38,14 @@ module CyberarmEngine
|
|||||||
@focus = false unless window.button_down?(Gosu::MsLeft)
|
@focus = false unless window.button_down?(Gosu::MsLeft)
|
||||||
|
|
||||||
if !@enabled
|
if !@enabled
|
||||||
@style.background_canvas.background = default(:disabled, :background)
|
@style.background_canvas.background = @style.disabled[:background]
|
||||||
@text.color = default(:disabled, :color)
|
@text.color = @style.disabled[:color]
|
||||||
elsif @focus
|
elsif @focus
|
||||||
@style.background_canvas.background = default(:active, :background)
|
@style.background_canvas.background = @style.active[:background]
|
||||||
@text.color = default(:active, :color)
|
@text.color = @style.active[:color]
|
||||||
else
|
else
|
||||||
@style.background_canvas.background = default(:hover, :background)
|
@style.background_canvas.background = @style.hover[:background]
|
||||||
@text.color = default(:hover, :color)
|
@text.color = @style.hover[:color]
|
||||||
end
|
end
|
||||||
|
|
||||||
:handled
|
:handled
|
||||||
@@ -55,11 +55,11 @@ module CyberarmEngine
|
|||||||
@focus = true
|
@focus = true
|
||||||
|
|
||||||
unless @enabled
|
unless @enabled
|
||||||
@style.background_canvas.background = default(:disabled, :background)
|
@style.background_canvas.background = @style.disabled[:background]
|
||||||
@text.color = default(:disabled, :color)
|
@text.color = @style.disabled[:color]
|
||||||
else
|
else
|
||||||
@style.background_canvas.background = default(:active, :background)
|
@style.background_canvas.background = @style.active[:background]
|
||||||
@text.color = default(:active, :color)
|
@text.color = @style.active[:color]
|
||||||
end
|
end
|
||||||
|
|
||||||
window.current_state.focus = self
|
window.current_state.focus = self
|
||||||
@@ -81,11 +81,11 @@ module CyberarmEngine
|
|||||||
|
|
||||||
def leave(_sender)
|
def leave(_sender)
|
||||||
unless @enabled
|
unless @enabled
|
||||||
@style.background_canvas.background = default(:disabled, :background)
|
@style.background_canvas.background = @style.disabled[:background]
|
||||||
@text.color = default(:disabled, :color)
|
@text.color = @style.disabled[:color]
|
||||||
else
|
else
|
||||||
@style.background_canvas.background = default(:background)
|
@style.background_canvas.background = @style.background
|
||||||
@text.color = default(:color)
|
@text.color = @style.color
|
||||||
end
|
end
|
||||||
|
|
||||||
:handled
|
:handled
|
||||||
@@ -99,11 +99,11 @@ module CyberarmEngine
|
|||||||
|
|
||||||
def recalculate
|
def recalculate
|
||||||
unless @enabled
|
unless @enabled
|
||||||
@style.background_canvas.background = default(:disabled, :background)
|
@style.background_canvas.background = @style.disabled[:background]
|
||||||
@text.color = default(:disabled, :color)
|
@text.color = @style.disabled[:color]
|
||||||
else
|
else
|
||||||
@style.background_canvas.background = default(:background)
|
@style.background_canvas.background = @style.background
|
||||||
@text.color = default(:color)
|
@text.color = @style.color
|
||||||
end
|
end
|
||||||
|
|
||||||
if @image
|
if @image
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ module CyberarmEngine
|
|||||||
|
|
||||||
@width = _width || @image.width.round * @scale_x
|
@width = _width || @image.width.round * @scale_x
|
||||||
@height = _height || @image.height.round * @scale_y
|
@height = _height || @image.height.round * @scale_y
|
||||||
|
|
||||||
|
update_background
|
||||||
end
|
end
|
||||||
|
|
||||||
def value
|
def value
|
||||||
|
|||||||
Reference in New Issue
Block a user