Package net.dermetfan.gdx.physics.box2d
Class WorldObserver
java.lang.Object
net.dermetfan.gdx.physics.box2d.WorldObserver
Notifies a
WorldObserver.Listener of changes in the world.
Does NOT work on HTML5!- Since:
- 0.6.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classthe changes of aBodystatic interfacethe changes of an object in a world since the last timeWorldObserver.Change.update(Object)was calledstatic classthe changes of aDistanceJointstatic classthe changes of aFixturestatic classthe changes of aFrictionJointstatic classthe changes of aGearJointstatic classWorldObserver.JointChange<T extends com.badlogic.gdx.physics.box2d.Joint>the changes of aJointstatic interfacethe listener notified by aWorldObserverstatic classthe changes of aMotorJointstatic classthe changes of aMouseJointstatic classthe changes of aPrismaticJointstatic classthe changes of aRevoluteJointstatic classthe changes of aRopeJointstatic classA Listener that calls another Listener on unpredictable/unexpected events.static classthe changes of aWeldJointstatic classthe changes of aWheelJointstatic classthe changes of aWorld -
Constructor Summary
ConstructorsConstructorDescriptioncreates a new WorldObserver with nolistenerWorldObserver(WorldObserver.Listener listener) -
Method Summary
Modifier and TypeMethodDescriptiongetBodyChange(int hash) getFixtureChange(int hash) getJointChange(com.badlogic.gdx.physics.box2d.Joint joint) voidsetListener(WorldObserver.Listener listener) voidupdate(com.badlogic.gdx.physics.box2d.World world, float step)
-
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 laststeppedwith
-
getBodyChange
- Parameters:
hash- the hash of the Body (computed viaBox2DUtils#hashCode(Body)) which associated BodyChange to return- Returns:
- the BodyChange from
bodyChangescurrently 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
fixtureChangescurrently 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
jointChangescurrently used for the given Joint
-
getWorldChange
- Returns:
- the
worldChange
-
getListener
- Returns:
- the
listener
-
setListener
- Parameters:
listener- thelistenerto set
-