Forums Archived

The forums are being archived. See this topic for more information.

Installing Rubygame 2.4.1 in Windows

Get help and support with Rubygame

Re: Installing Rubygame 2.4.1 in Windows

Postby shawn42 » Mon Apr 20, 2009 10:22 pm

constants.rb is defining mouse mappings. Notice in constants.rb that nowhere does it actually say MOUSE_LEFT = something

That happens in rubygame_event.c:

rb_define_const(mRubygame,"MOUSE_LEFT",UINT2NUM(SDL_BUTTON_LEFT));

This actually defines MOUSE_LEFT constant in the Rubygame module as 1.
Can you post the full stacktrace and I'll take a look?

Code: Select all
irb
irb(main):001:0> require 'rubygame'
=> true
irb(main):002:0> p Rubygame::MOUSE_LEFT
1
=> 1
User avatar
shawn42
 
Posts: 109
Joined: Tue Feb 10, 2009 8:22 pm

Re: Installing Rubygame 2.4.1 in Windows

Postby bmatthew1 » Tue Apr 21, 2009 6:58 am

Can you post the full stacktrace and I'll take a look?


I know if I'm using rake I can use the --trace option but how do I go about getting the full stacktrace from irb or ruby itself.
User avatar
bmatthew1
 
Posts: 28
Joined: Wed Apr 01, 2009 2:20 pm
Location: England

Re: Installing Rubygame 2.4.1 in Windows

Postby shawn42 » Tue Apr 21, 2009 7:29 am

Run the code in irb (just like I did). paste all the terminal output here.

Also, run ruby rubygame_demo.rb from the samples directory and paste the output.
User avatar
shawn42
 
Posts: 109
Joined: Tue Feb 10, 2009 8:22 pm

Re: Installing Rubygame 2.4.1 in Windows

Postby bmatthew1 » Tue Apr 21, 2009 7:38 am

Ok, here you go...

If I put require 'rubygame' into irb this is what I get...

Code: Select all
irb(main):001:0> require 'rubygame'
NameError: uninitialized constant Rubygame::Mouse::MOUSE_LEFT
        from c:/ruby/lib/ruby/1.8/rubygame/constants.rb:25
        from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from c:/ruby/lib/ruby/1.8/rubygame.rb:45
        from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from (irb):1


If I try & run demo_rubygame.rb this is what I get...

Code: Select all
c:/ruby/lib/ruby/1.8/rubygame/constants.rb:25: uninitialized constant Rubygame::Mouse::MOUSE_LEFT (NameError)
        from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from c:/ruby/lib/ruby/1.8/rubygame.rb:45
        from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from demo_rubygame.rb:25
User avatar
bmatthew1
 
Posts: 28
Joined: Wed Apr 01, 2009 2:20 pm
Location: England

Re: Installing Rubygame 2.4.1 in Windows

Postby shawn42 » Tue Apr 21, 2009 8:06 am

If I had to guess, I would say those demos are possibly outdated.
can you list:
c:/ruby/lib/ruby/gems/1.8/gems/rubygame*
and run gem list rubygame

where are you running the demo from? is it in the c:/ruby/lib/ruby/gems/1.8/gems/rubygame<version>/samples directory?
User avatar
shawn42
 
Posts: 109
Joined: Tue Feb 10, 2009 8:22 pm

Re: Installing Rubygame 2.4.1 in Windows

Postby bmatthew1 » Tue Apr 21, 2009 8:35 am

I doubt the demos are outdated because they're the ones which came with the 2.4.1 source which I downloaded from here.

The contents of C:\ruby\lib\ruby\gems\1.8\gems are as follows. (The fact that rubygame-2.3.0 is listed there can be ignored because I uninstalled it & the rubygame 2.4.1 gem never successfully installed.)

Code: Select all
fxri-0.3.7
fxruby-1.6.19-x86-mswin32-60
hpricot-0.8.1-x86-mswin32
log4r-1.0.5
mkrf-0.2.3
ptools-1.1.6
rake-0.8.4
rbgooey-0.0.6
ruby-opengl-0.60.1
rubygame-2.3.0
rubygame-2.4.1
rubygems-update-1.3.1
rubyscript2exe-0.5.3
rubysdl-2.1.0
sources-0.0.1
test-unit-2.0.2
win32-api-1.4.0-x86-mswin32-60
win32-clipboard-0.4.4
win32-dir-0.3.3
win32-eventlog-0.5.0
win32-file-0.6.1
win32-file-stat-1.3.3
win32-process-0.6.0
win32-sapi-0.1.4
win32-sound-0.4.1
windows-api-0.3.0
windows-pr-1.0.2


Running gem list rubygame doesn't return anything, which is probably because I haven't installed rubygame as a gem. I placed the rubygame dll, rubygame.rb & rubygame folder at C:\ruby\lib\ruby\1.8.

I usually run the demos from my desktop because it doesn't really matter where you run them. Samples from previous rubygame versions worked fine wherever you loaded them from.
User avatar
bmatthew1
 
Posts: 28
Joined: Wed Apr 01, 2009 2:20 pm
Location: England

Re: Installing Rubygame 2.4.1 in Windows

Postby shawn42 » Tue Apr 21, 2009 8:54 am

HA,
I've been misreading that error this whole time. The constants.rb file is trying to use MOUSE_LEFT from within the Rubygame::Mouse module. Ruby is displaying its normal "I don't know about BLAH" message. That constant is defined in rubygame_event.c (as mentioned earlier), which eventually gets rolled up into rubygame_core.dll. You have rubygame_core.dll because we aren't seeing:
Code: Select all
LoadError: no such file to load -- rubygame_core


So, this leads me to believe that your rubygame_core didn't build and/or link correctly with rubygame_event.c

I'd go back to the craziness you were doing to link these and make sure that rubygame_event.o exists (so we know it compiled it) and then check your dll linking to make sure that rubygame_event.o got linked into rubygame_core.dll
User avatar
shawn42
 
Posts: 109
Joined: Tue Feb 10, 2009 8:22 pm

Re: Installing Rubygame 2.4.1 in Windows

Postby bmatthew1 » Tue Apr 21, 2009 9:12 am

When I first built my rubygame.dll I was getting that error... :P
Code: Select all
LoadError: no such file to load -- rubygame_core

I solved it by changing line 32 in rubygame.rb from...
Code: Select all
require "rubygame_core"

to...
Code: Select all
require "rubygame.%s"%[Config::CONFIG["DLEXT2"]]

Which is how the person who compiled rubygame-1.1.0 for Windows solved the same problem.

I then got the following error...
Code: Select all
LoadError: 127: The specified procedure could not be found.   - Init_rubygame

I solved that by adding the following to rubygame_main.c after the include statements...
Code: Select all
void __cdecl Init_rubygame(){;}

All that does is make sure that Init_rubygame gets exported to the .def file for the .dll, which is a similar way to how the same problem was achieved for rubygame-1.1.0.
User avatar
bmatthew1
 
Posts: 28
Joined: Wed Apr 01, 2009 2:20 pm
Location: England

Re: Installing Rubygame 2.4.1 in Windows

Postby bmatthew1 » Tue Apr 21, 2009 2:40 pm

I've got one of the examples to work, demo_gl.rb. :D

Image

I changed line 105 in rubygame_main.c from...
Code: Select all
void Init_rubygame_core()

to...
Code: Select all
void Init_rubygame()


None of the other examples work though because they depend on the SDL libraries which aren't being detected, even though I linked to them all during compilation.
User avatar
bmatthew1
 
Posts: 28
Joined: Wed Apr 01, 2009 2:20 pm
Location: England

Re: Installing Rubygame 2.4.1 in Windows

Postby shawn42 » Tue Apr 21, 2009 3:43 pm

Yay for one working demo!

what are the outputs of:

Code: Select all
irb
irb(main):001:0> require 'rubygame_core'
=> true
irb(main):002:0> require 'rubygame_gfx'
=> true
irb(main):003:0> require 'rubygame_image'
=> true
irb(main):004:0> require 'rubygame_ttf'
=> true
irb(main):005:0> require 'rubygame_mixer'
=> true
irb(main):006:0>
User avatar
shawn42
 
Posts: 109
Joined: Tue Feb 10, 2009 8:22 pm

PreviousNext

Return to Help & Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron