Class: GGLib::Cursor

Inherits:
Object
  • Object
show all
Defined in:
lib/mouse.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#imgObject (readonly)

Returns the value of attribute img.



4
5
6
# File 'lib/mouse.rb', line 4

def img
  @img
end

#imgObjObject (readonly)

Returns the value of attribute imgObj.



4
5
6
# File 'lib/mouse.rb', line 4

def imgObj
  @imgObj
end

#visibleObject

Returns the value of attribute visible.



4
5
6
# File 'lib/mouse.rb', line 4

def visible
  @visible
end

Instance Method Details

#drawObject



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

#toggleVisibleObject



11
12
13
14
15
# File 'lib/mouse.rb', line 11

def toggleVisible
  if not @forced
    @visible=!@visible
  end
end

#unforceVisibleObject



20
21
22
# File 'lib/mouse.rb', line 20

def unforceVisible
  @forced=false
end

#visible?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/mouse.rb', line 23

def visible?
  return visible
end