Ruby library?

Official forum for the Chipmunk2D Physics Library.
rjs
Posts: 3
Joined: Fri Mar 14, 2008 10:31 am
Contact:

Re: Ruby library?

Post by rjs »

I don't remember the exact steps (once done then forget :)), but I downloaded the mingw installer version of the one click installer from the links in
http://groups.google.com/group/comp.lan ... 1e3b?tvc=1
I made ruby from that and then used that to create the makefile using 'ruby extconf.rb'. I actually made a Netbeans C project to do the rest (using the makefile just created), but you should be able to type 'make' from the command line. The version of chipmunk.so created works with the standard one-click-installer version of Ruby as well.
jaymcgavren
Posts: 2
Joined: Tue Apr 15, 2008 1:57 pm
Contact:

Re: Ruby library?

Post by jaymcgavren »

rjs wrote:The version of chipmunk.so created works with the standard one-click-installer version of Ruby as well.
Indeed it does:

Code: Select all

require 'chipmunk'

include CP

space = Space.new
space.gravity = Vec2.new(0, -100)
radius = 10.0
body = Body.new(10.0, moment_for_circle(15.0, 0.0, radius, Vec2.new(0, 0)))
ball = Shape::Circle.new(body, radius, Vec2.new(0, 0))
space.add_body(body)

5.times do
	space.step(1.0 / 60.0)
	puts body.p
end

Code: Select all

( 0.000, -0.028)
( 0.000, -0.083)
( 0.000, -0.167)
( 0.000, -0.278)
( 0.000, -0.417)
I'm going to do a prototype integration with my main game library now, and I'll save those instructions in case I need them again. Hopefully someone will beat me to the punch and release a Windows binary gem, though. :mrgreen:
Post Reply

Who is online

Users browsing this forum: No registered users and 24 guests