By newbie
Date 2010-08-03 02:39
Edited 2010-08-03 16:16
I'm having trouble with this tutorial; I can't seem to figure out why gosu won't work! I installed gosu via rubygems and it said it was installed, but it won't work. I'm not sure if it's a problem with my code, but here it is: (Oh yeah, my compiler is NetBeans IDE 6.9)
require 'rubygems' require 'gosu'
class GameWindow < Gosu::Window
def initialize
super(640, 480, false) self.caption = 'Gosu Tutorial Game'
end
def update
end
def draw
end
end
window = GameWindow.new
window.show
Errors are:
K:/NetBeans 6.9/ruby/jruby-1.5.0/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in require': no such file to load -- gosu (LoadError)
from K:/NetBeans 6.9/ruby/jruby-1.5.0/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require'
from K:\Ruby191\Ruby Projects\GosuTutorial\lib\main.rb:5
You should never name a class GameWindow? with the ? mark included. Just delete it. For Ruby you don't need a compiler at all, just run it from a shell window or rename its extension to rbw I guess. Did you also install any other libraries required to run Gosu? Since I'm running it on Linux I'm used to that, never tried to run it on Windows for the last... year...
I think rubygems installs dependencies by default.
It installs gem dependencies, but not library dependencies. Fortunately, the win32 Gosu gem is statically linked to the requisite libraries (except fmod; that's a DLL).
By jlnr (dev)
Date 2010-08-03 08:06
And fmod.dll is included and looked up magically. :)
Is this your exact code, with the exception of the question marks? If so, then there is a slight problem. You can not create a method in the form
def foo end
in ruby. You need to write
def foo
end
or at least def foo; end;
Thus, in this case try
def update; end; def draw; end;
if you really want everything on one line. Otherwise I would suggest using multiple lines. It really is better that way.
It's not my exact code; Windows just likes to put on one line for some stupid reason. Thanks for trying to help, though.
Ah, ok then. Well I just read the error you got, and it looks like netbeans is trying to use JRuby. If I remember correctly, that's the implementation of ruby it uses by default, which makes sense as Netbeans is primarily a Java IDE. You will most likely have to change the ruby interpreter that is being used. Try poking around under settings or something. Sorry, but it's been a long time since I tried using netbeans and I have forgotten how to do this.
By newbie
Date 2010-08-03 18:23
Edited 2010-08-03 18:26
Hmm, that would make sense. I'll look for it under settings. I hope I don't have to download another darned editor, I've already done it twice!
You could use Notepad++ on Windows or SciTE, I tried the last one and I remember it included Ruby support by default.
Loading...