Class: Core::Cursor
Instance Method Summary collapse
- #attach(sprite) ⇒ Object
- #clear ⇒ Object
- #draw ⇒ Object
- #empty? ⇒ Boolean
-
#initialize ⇒ Cursor
constructor
A new instance of Cursor.
- #update(x, y) ⇒ Object
Constructor Details
Instance Method Details
#attach(sprite) ⇒ Object
29 30 31 |
# File 'lib/cursor.rb', line 29 def attach(sprite) @sprite = sprite end |
#clear ⇒ Object
33 34 35 |
# File 'lib/cursor.rb', line 33 def clear @sprite = nil end |
#draw ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/cursor.rb', line 16 def draw if !@x @x = 0 end if !@y @y = 0 end @cursor.draw(@x, @y, Core::CURSOR_Z) if @sprite @sprite.draw(@x+4, @y+8, Core::CURSOR_Z-1) end end |
#empty? ⇒ Boolean
37 38 39 |
# File 'lib/cursor.rb', line 37 def empty? return @sprite == nil end |
#update(x, y) ⇒ Object
12 13 14 |
# File 'lib/cursor.rb', line 12 def update(x, y) @x, @y = x, y end |