문제 설명
Ruby에서 Gosu로 텍스트를 인쇄할 수 없음(충돌) (Cannot print a text with Gosu in Ruby (crash))
고수의 기초를 배우려고 합니다. 이미지를 표시할 수 있지만 텍스트로 시도할 때 응용 프로그램이 충돌했습니다. 다음은 실행하려는 간단한 코드입니다.
<!‑‑ 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
참조 솔루션
방법 1:
to everyone who have this problem on xp just install a previous version of gosu, with 0.9.2 works well.
Use: gem install gosu ‑v"0.9.2"
방법 2:
Works fine for me
gosu 0.10.4
ruby 2.1.2p95 (2014‑05‑08) [x86_64‑linux‑gnu]
Running on ubuntu
(by Scias Bof IV、Arctia、Damiano Stoffie)