9

I'm doing some graphics programming using the Gosu gem. The thing is, when I create a Window my mouse pointer is hidden. I can guess where the mouse is at a certain moment, and I can intuitively click, but my users may not.

How can I show the pointer?

Geo
  • 93,257
  • 117
  • 344
  • 520

2 Answers2

20

If you want to use the system cursor you can do this

class Window < Gosu::Window
  def initialize
    super 320, 240, false
  end

  def needs_cursor?
    true
  end
end

Check out the documentation at libgosu

RubyGosu rdoc Reference / Window

Arrow
  • 221
  • 2
  • 3
  • 1
    Thanks, but at the time I asked this question, I think this wasn't available. – Geo Nov 25 '10 at 11:56
6

I'm using something like this:

class Game < Gosu::Window
  def initialize
    super 800, 600, false
    @cursor = Gosu::Image.new(self, 'media/cursor.png')
  end

  def draw
    @cursor.draw self.mouse_x, self.mouse_y, 0
  end
end

Game.new.show