Class: LUIT::LUITElement
- Inherits:
-
Object
- Object
- LUIT::LUITElement
- Defined in:
- lib/luit.rb
Direct Known Subclasses
Button, ClickArea, ClickPoint, List, Slider, TextArea, Toggle, VerticalSlider
Instance Attribute Summary collapse
-
#h ⇒ Object
readonly
Returns the value of attribute h.
-
#hover ⇒ Object
readonly
Returns the value of attribute hover.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#w ⇒ Object
readonly
Returns the value of attribute w.
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
Instance Method Summary collapse
- #button_down(id) ⇒ Object
- #draw(x = 0, y = 0) ⇒ Object
- #draw_rel(x = 0, y = 0) ⇒ Object
-
#initialize(holder, id, x, y, w, h) ⇒ LUITElement
constructor
A new instance of LUITElement.
- #update(x = 0, y = 0) ⇒ Object
- #update_rel(x = 0, y = 0) ⇒ Object
- #updateHover(x, y) ⇒ Object
Constructor Details
#initialize(holder, id, x, y, w, h) ⇒ LUITElement
48 49 50 51 52 53 54 55 56 57 |
# 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 |
Instance Attribute Details
#h ⇒ Object (readonly)
Returns the value of attribute h.
47 48 49 |
# File 'lib/luit.rb', line 47 def h @h end |
#hover ⇒ Object (readonly)
Returns the value of attribute hover.
47 48 49 |
# File 'lib/luit.rb', line 47 def hover @hover end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
47 48 49 |
# File 'lib/luit.rb', line 47 def id @id end |
#w ⇒ Object (readonly)
Returns the value of attribute w.
47 48 49 |
# File 'lib/luit.rb', line 47 def w @w end |
#x ⇒ Object (readonly)
Returns the value of attribute x.
47 48 49 |
# File 'lib/luit.rb', line 47 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
47 48 49 |
# File 'lib/luit.rb', line 47 def y @y end |
Instance Method Details
#button_down(id) ⇒ Object
85 86 87 88 89 |
# File 'lib/luit.rb', line 85 def (id) if id == Gosu::MsLeft && @hover @holder.onClick(@id) end end |
#draw(x = 0, y = 0) ⇒ Object
59 60 |
# File 'lib/luit.rb', line 59 def draw(x = 0, y = 0) end |
#draw_rel(x = 0, y = 0) ⇒ Object
62 63 64 |
# 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) ⇒ Object
70 71 72 73 74 75 76 77 78 79 |
# File 'lib/luit.rb', line 70 def update(x = 0, y = 0) if Gosu::(Gosu::MsLeft) or LUIT.touchDown if !@msDown (Gosu::MsLeft) end @msDown = true else @msDown = false end end |
#update_rel(x = 0, y = 0) ⇒ Object
81 82 83 |
# File 'lib/luit.rb', line 81 def update_rel(x = 0, y = 0) update(x - (@w/2), y - (@h/2)) end |