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 classWorldObserver.BodyChangethe changes of aBodystatic interfaceWorldObserver.Change<T>the changes of an object in a world since the last timeWorldObserver.Change.update(Object)was calledstatic classWorldObserver.DistanceJointChangethe changes of aDistanceJointstatic classWorldObserver.FixtureChangethe changes of aFixturestatic classWorldObserver.FrictionJointChangethe changes of aFrictionJointstatic classWorldObserver.GearJointChangethe changes of aGearJointstatic classWorldObserver.JointChange<T extends com.badlogic.gdx.physics.box2d.Joint>the changes of aJointstatic interfaceWorldObserver.Listenerthe listener notified by aWorldObserverstatic classWorldObserver.MotorJointChangethe changes of aMotorJointstatic classWorldObserver.MouseJointChangethe changes of aMouseJointstatic classWorldObserver.PrismaticJointChangethe changes of aPrismaticJointstatic classWorldObserver.RevoluteJointChangethe changes of aRevoluteJointstatic classWorldObserver.RopeJointChangethe changes of aRopeJointstatic classWorldObserver.UnexpectedListenerA Listener that calls another Listener on unpredictable/unexpected events.static classWorldObserver.WeldJointChangethe changes of aWeldJointstatic classWorldObserver.WheelJointChangethe changes of aWheelJointstatic classWorldObserver.WorldChangethe changes of aWorld -
Constructor Summary
Constructors Constructor Description WorldObserver()creates a new WorldObserver with nolistenerWorldObserver(WorldObserver.Listener listener) -
Method Summary
Modifier and Type Method Description WorldObserver.BodyChangegetBodyChange(int hash)WorldObserver.FixtureChangegetFixtureChange(int hash)WorldObserver.JointChangegetJointChange(com.badlogic.gdx.physics.box2d.Joint joint)WorldObserver.ListenergetListener()WorldObserver.WorldChangegetWorldChange()voidsetListener(WorldObserver.Listener listener)voidupdate(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 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
-