无法在 Ruby 中使用 Gosu 打印文本(崩溃)

Cannot print a text with Gosu in Ruby (crash)

我正在尝试学习 Gosu 的一些基础知识。我可以显示图像,但是当我尝试使用文本时,应用程序崩溃了。这是我尝试 运行.

的简单代码
<!-- language: rb -->
require 'gosu'

class GameWindow < Gosu::Window
  def initialize(width=320, height=240, fullscreen=false)
    super
    self.caption = 'Hello'
    @message = Gosu::Image.from_text(self, "My text to print",Gosu.default_font_name,100)
  end

  def draw
    @message.draw(10, 10, 0)
  end
end

window = GameWindow.new
window.show

我的系统:

-Windows xp sp3

-ruby 1.93 448

-gosu 0.10.4

### cmd report image

### cmd report 2 image

适合我

gosu 0.10.4

ruby 2.1.2p95 (2014-05-08) [x86_64-linux-gnu]

运行 在 ubuntu

各位在 xp 上遇到这个问题的朋友,只要安装旧版本的 gosu,0.9.2 就可以了。

使用:gem install gosu -v"0.9.2"