Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / Ruby Gosu tutorial doesn't work
- - 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
Parent - - By kyonides Date 2010-08-03 03:15
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...
Parent - - By Basic Date 2010-08-03 07:05
I think rubygems installs dependencies by default.
Parent - - By RunnerPack Date 2010-08-03 07:12
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).
Parent - By jlnr (dev) Date 2010-08-03 08:06
And fmod.dll is included and looked up magically. :)
Parent - - By RavensKrag Date 2010-08-03 16:18
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.
Parent - - By newbie Date 2010-08-03 16:27
It's not my exact code; Windows just likes to put on one line for some stupid reason. Thanks for trying to help, though.
Parent - - By RavensKrag Date 2010-08-03 16:41
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.
Parent - 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!
Parent - By kyonides Date 2010-08-03 17:46
You could use Notepad++ on Windows or SciTE, I tried the last one and I remember it included Ruby support by default.
- - By newbie Date 2010-08-03 18:27
Crap, there IS no settings! Looking for preferences now...
Parent - By newbie Date 2010-08-03 18:31
Will Ruby work on Notepad?
- By newbie Date 2010-08-03 19:08
Eh, guess I'll just get Notepad++, since I can't change the settings.
Up Topic Gosu / Gosu Exchange / Ruby Gosu tutorial doesn't work

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill