Package net.dermetfan.gdx.physics.box2d
Class WorldObserver
java.lang.Object
net.dermetfan.gdx.physics.box2d.WorldObserver
public class WorldObserver
extends java.lang.Object
Notifies a
WorldObserver.Listener
of changes in the world.
Does NOT work on HTML5!- Since:
- 0.6.0
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WorldObserver.BodyChange
the changes of aBody
static interface
WorldObserver.Change<T>
the changes of an object in a world since the last timeWorldObserver.Change.update(Object)
was calledstatic class
WorldObserver.DistanceJointChange
the changes of aDistanceJoint
static class
WorldObserver.FixtureChange
the changes of aFixture
static class
WorldObserver.FrictionJointChange
the changes of aFrictionJoint
static class
WorldObserver.GearJointChange
the changes of aGearJoint
static class
WorldObserver.JointChange<T extends com.badlogic.gdx.physics.box2d.Joint>
the changes of aJoint
static interface
WorldObserver.Listener
the listener notified by aWorldObserver
static class
WorldObserver.MotorJointChange
the changes of aMotorJoint
static class
WorldObserver.MouseJointChange
the changes of aMouseJoint
static class
WorldObserver.PrismaticJointChange
the changes of aPrismaticJoint
static class
WorldObserver.RevoluteJointChange
the changes of aRevoluteJoint
static class
WorldObserver.RopeJointChange
the changes of aRopeJoint
static class
WorldObserver.UnexpectedListener
A Listener that calls another Listener on unpredictable/unexpected events.static class
WorldObserver.WeldJointChange
the changes of aWeldJoint
static class
WorldObserver.WheelJointChange
the changes of aWheelJoint
static class
WorldObserver.WorldChange
the changes of aWorld
-
Constructor Summary
Constructors Constructor Description WorldObserver()
creates a new WorldObserver with nolistener
WorldObserver(WorldObserver.Listener listener)
-
Method Summary
Modifier and Type Method Description WorldObserver.BodyChange
getBodyChange(int hash)
WorldObserver.FixtureChange
getFixtureChange(int hash)
WorldObserver.JointChange
getJointChange(com.badlogic.gdx.physics.box2d.Joint joint)
WorldObserver.Listener
getListener()
WorldObserver.WorldChange
getWorldChange()
void
setListener(WorldObserver.Listener listener)
void
update(com.badlogic.gdx.physics.box2d.World world, float step)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
WorldObserver
public WorldObserver()creates a new WorldObserver with nolistener
-
WorldObserver
- Parameters:
listener
- thelistener
-
-
Method Details
-
update
public void update(com.badlogic.gdx.physics.box2d.World world, float step)- Parameters:
world
- Ideally always the same World because its identity is not checked. Passing in another world instance will cause all differences between the two worlds to be processed.step
- the time the world was laststepped
with
-
getBodyChange
- Parameters:
hash
- the hash of the Body (computed viaBox2DUtils#hashCode(Body)
) which associated BodyChange to return- Returns:
- the BodyChange from
bodyChanges
currently used for the Body with the given hash, or null if not found
-
getFixtureChange
- Parameters:
hash
- the hash of the Fixture (computed viaBox2DUtils#hashCode(Fixture)
) which associated FixtureChange to return- Returns:
- the FixtureChange from
fixtureChanges
currently used for the Fixture with the given hash, or null if not found
-
getJointChange
- Parameters:
joint
- the joint which associated JointChange to return- Returns:
- the JointChange from
jointChanges
currently used for the given Joint
-
getWorldChange
- Returns:
- the
worldChange
-
getListener
- Returns:
- the
listener
-
setListener
- Parameters:
listener
- thelistener
to set
-