为什么 Gosu 隐藏我的鼠标指针?

发布于 2024-08-05 02:39:44 字数 107 浏览 3 评论 0原文

我正在使用 Gosu gem 进行一些图形编程。问题是,当我创建一个窗口时,我的鼠标指针被隐藏。我可以猜测某个时刻鼠标在哪里,并且我可以直观地点击,但我的用户可能不会。

如何显示指针?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

伴我老 2024-08-12 02:39:44

如果你想使用系统光标,你可以这样做

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

  def needs_cursor?
    true
  end
end

查看 libgosu 的文档

RubyGosu rdoc 参考/窗口

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

恍梦境° 2024-08-12 02:39:44

我正在使用这样的东西:

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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文