Sha256: 048bebef210830c4b36fb66b68bf7e0bdd625667984a8752fa155a06d3a5d134

Contents?: true

Size: 699 Bytes

Versions: 1

Compression:

Stored size: 699 Bytes

Contents

require_relative  'version'

class Box2D < Java::ProcessingBox2d::Box2DProcessing

  def init_options(args = {})
    scale = args[:scale] || 10.0
    gravity = args[:gravity] || [0, -10.0]
    warm = args[:warm] || true
    continuous = args[:continuous] || true
    set_options(scale, gravity.to_java(Java::float), warm, continuous)   
  end

  def step_options(args = {})
    time_step = args[:time_step] || 1.0 / 60
    velocity = args[:velocity_iter] || 8
    position = args[:position_iter] || 10
    set_step(time_step, velocity, position)
  end

  def gravity(args)
    change_gravity(args.to_java(Java::float))
  end

  def version
    format("pbox2d version %s", Pbox2D::VERSION)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pbox2d-0.2.0-java lib/pbox2d/box2d.rb