-
Notifications
You must be signed in to change notification settings - Fork 0
Home
monkstone edited this page Nov 9, 2014
·
16 revisions
You should have ruby-processing and the pbox2d gem installed, from your processing sketch require pbox2d
require 'pbox2d'
# A list we'll use to track fixed objects
attr_reader :box2d, :boundaries, :boxesIn your before setup you need to include ContactListener (the java interface as a module), by the magic that
is jruby this has the effect of implementing the java interface in the Sketch class (that wraps the bare sketch at runtime).
include ContactListenerYou then need to create an instance of Box2D in the setup
def setup
size(400,300)
@box2d = Box2D.new(self)
box2d.init_options(gravity: [0, -20])
box2d.create_world
...