class LUIT::Toggle
Attributes
value[RW]
Public Class Methods
new(holder, id, x, y, size = 30)
click to toggle source
Calls superclass method
LUIT::LUITElement::new
# File lib/luit.rb, line 297 def initialize(holder, id, x, y, size = 30) h = [30, size].max w = h * 2 super(holder, id, x, y, w, h) @buttonColor = LUIT.uiColor @value = false end
Public Instance Methods
draw(x = 0, y = 0)
click to toggle source
# File lib/luit.rb, line 305 def draw(x = 0, y = 0) x += @x y += @y Gosu::draw_rect(x, y, @w, @h, @buttonColor, LUIT.z) @value ? v = 1 : v = 0 Gosu::draw_rect(x + 4 + (@h * v), y + 4, @h - 8, @h - 8, @value ? 0xff_ffffff : 0xff_000000, LUIT.z + 1) end
update(x = 0, y = 0)
click to toggle source
Calls superclass method
LUIT::LUITElement#update
# File lib/luit.rb, line 313 def update(x = 0, y = 0) x += @x y += @y updateHover(x, y) @buttonColor = @hover ? LUIT.uiColorLight : LUIT.uiColor super end