Class: GGLib::Cursor
- Inherits:
-
Object
- Object
- GGLib::Cursor
- Defined in:
- lib/mouse.rb
Instance Attribute Summary collapse
-
#img ⇒ Object
readonly
Returns the value of attribute img.
-
#imgObj ⇒ Object
readonly
Returns the value of attribute imgObj.
-
#visible ⇒ Object
Returns the value of attribute visible.
Instance Method Summary collapse
- #draw ⇒ Object
- #forceVisible(visible = true) ⇒ Object
-
#initialize(img, visible) ⇒ Cursor
constructor
A new instance of Cursor.
- #toggleVisible ⇒ Object
- #unforceVisible ⇒ Object
- #visible? ⇒ Boolean
Constructor Details
#initialize(img, visible) ⇒ Cursor
Returns a new instance of Cursor.
5 6 7 8 9 10 |
# File 'lib/mouse.rb', line 5 def initialize(img,visible) @img=img @visible=visible @imgObj=Gosu::Image.new($window,img,true) @forced=false end |
Instance Attribute Details
#img ⇒ Object (readonly)
Returns the value of attribute img.
4 5 6 |
# File 'lib/mouse.rb', line 4 def img @img end |
#imgObj ⇒ Object (readonly)
Returns the value of attribute imgObj.
4 5 6 |
# File 'lib/mouse.rb', line 4 def imgObj @imgObj end |
#visible ⇒ Object
Returns the value of attribute visible.
4 5 6 |
# File 'lib/mouse.rb', line 4 def visible @visible end |
Instance Method Details
#draw ⇒ Object
31 32 33 34 35 |
# File 'lib/mouse.rb', line 31 def draw if @visible @imgObj.draw($window.mouse_x,$window.mouse_y,ZOrder::Cursor) end end |
#forceVisible(visible = true) ⇒ Object
16 17 18 19 |
# File 'lib/mouse.rb', line 16 def forceVisible(visible=true) @forced=true @visible=visible end |
#toggleVisible ⇒ Object
11 12 13 14 15 |
# File 'lib/mouse.rb', line 11 def toggleVisible if not @forced @visible=!@visible end end |
#unforceVisible ⇒ Object
20 21 22 |
# File 'lib/mouse.rb', line 20 def unforceVisible @forced=false end |
#visible? ⇒ Boolean
23 24 25 |
# File 'lib/mouse.rb', line 23 def visible? return visible end |