class LUIT::LUITElement

Attributes

h[R]
hover[R]
id[R]
w[R]
x[R]
y[R]

Public Class Methods

new(holder, id, x, y, w, h) click to toggle source
# File lib/luit.rb, line 48
def initialize(holder, id, x, y, w, h)
        @holder = holder
        @id = id
        @x = x
        @y = y
        @w = w
        @h = h
        @msDown = false
        @hover = true
end

Public Instance Methods

button_down(id) click to toggle source
# File lib/luit.rb, line 85
def button_down(id)
        if id == Gosu::MsLeft && @hover
                @holder.onClick(@id)
        end
end
draw(x = 0, y = 0) click to toggle source
# File lib/luit.rb, line 59
def draw(x = 0, y = 0)
end
draw_rel(x = 0, y = 0) click to toggle source
# File lib/luit.rb, line 62
def draw_rel(x = 0, y = 0)
        draw(x - (@w/2), y - (@h/2))
end
update(x = 0, y = 0) click to toggle source
# File lib/luit.rb, line 70
def update(x = 0, y = 0)
        if Gosu::button_down?(Gosu::MsLeft) or LUIT.touchDown
                if !@msDown
                        button_down(Gosu::MsLeft)
                end
                @msDown = true
        else
                @msDown = false
        end
end
updateHover(x, y) click to toggle source
# File lib/luit.rb, line 66
def updateHover(x, y)
        @hover = LUIT.mX.between?(x, x + @w) && LUIT.mY.between?(y, y + @h)
end
update_rel(x = 0, y = 0) click to toggle source
# File lib/luit.rb, line 81
def update_rel(x = 0, y = 0)
        update(x - (@w/2), y - (@h/2))
end