Sha256: 023aef662bbfab5ef77c61767245316ce84dd969ba9d64b14271baf5b0c57aab

Contents?: true

Size: 436 Bytes

Versions: 1

Compression:

Stored size: 436 Bytes

Contents

# A Box class, note how to access class ParticleGroupDef in jruby
# which is imported into PB module (not in global namespace)
class Box
  attr_accessor :pg
  def initialize(b2d, x, y)
    w = rand(1..3)
    h = rand(1..3)
    shape = PolygonShape.new
    pos = b2d.processing_to_world(x, y)
    shape.setAsBox(w, h, pos, 0)
    pd = PB::ParticleGroupDef.new
    pd.shape = shape
    @pg = b2d.world.create_particle_group(pd)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pbox2d-0.5.0-java examples/lib/box.rb