public class WorldObserver
extends java.lang.Object
WorldObserver.Listener of changes in the world.
Does NOT work on HTML5!| Modifier and Type | Class and Description |
|---|---|
static class |
WorldObserver.BodyChange
the changes of a
Body |
static interface |
WorldObserver.Change<T>
the changes of an object in a world since the last time
WorldObserver.Change.update(Object) was called |
static class |
WorldObserver.DistanceJointChange
the changes of a
DistanceJoint |
static class |
WorldObserver.FixtureChange
the changes of a
Fixture |
static class |
WorldObserver.FrictionJointChange
the changes of a
FrictionJoint |
static class |
WorldObserver.GearJointChange
the changes of a
GearJoint |
static class |
WorldObserver.JointChange<T extends com.badlogic.gdx.physics.box2d.Joint>
the changes of a
Joint |
static interface |
WorldObserver.Listener
the listener notified by a
WorldObserver |
static class |
WorldObserver.MotorJointChange
the changes of a
MotorJoint |
static class |
WorldObserver.MouseJointChange
the changes of a
MouseJoint |
static class |
WorldObserver.PrismaticJointChange
the changes of a
PrismaticJoint |
static class |
WorldObserver.RevoluteJointChange
the changes of a
RevoluteJoint |
static class |
WorldObserver.RopeJointChange
the changes of a
RopeJoint |
static class |
WorldObserver.UnexpectedListener
A Listener that calls another Listener on unpredictable/unexpected events.
|
static class |
WorldObserver.WeldJointChange
the changes of a
WeldJoint |
static class |
WorldObserver.WheelJointChange
the changes of a
WheelJoint |
static class |
WorldObserver.WorldChange
the changes of a
World |
| Modifier and Type | Field and Description |
|---|---|
private com.badlogic.gdx.utils.IntMap<WorldObserver.BodyChange> |
bodyChanges
the BodyChanges used to track Bodies, keys are hashes computed by
Box2DUtils#hashCode(Body) because a World pools its Bodies |
private com.badlogic.gdx.utils.IntMap<com.badlogic.gdx.physics.box2d.Body> |
currentBodies
the Bodies by
hash since this/the last time update(World, float) was called |
private com.badlogic.gdx.utils.IntMap<com.badlogic.gdx.physics.box2d.Fixture> |
currentFixtures
the Fixtures by
hash since this/the last time update(World, float) was called |
private com.badlogic.gdx.utils.Array<com.badlogic.gdx.physics.box2d.Joint> |
currentJoints
the Joints since this/the last time
update(World, float) was called |
private com.badlogic.gdx.utils.IntMap<WorldObserver.FixtureChange> |
fixtureChanges
the FixtureChanges used to track Fixtures, keys are hashes computed by
Box2DUtils#hashCode(Fixture) because a world pools its Fixtures |
private com.badlogic.gdx.utils.ObjectMap<com.badlogic.gdx.physics.box2d.Joint,WorldObserver.JointChange> |
jointChanges
the JointChanges used to track Joints
|
private WorldObserver.Listener |
listener
The Listener to notify.
|
private com.badlogic.gdx.utils.IntMap<com.badlogic.gdx.physics.box2d.Body> |
previousBodies
the Bodies by
hash since this/the last time update(World, float) was called |
private com.badlogic.gdx.utils.IntMap<com.badlogic.gdx.physics.box2d.Fixture> |
previousFixtures
the Fixtures by
hash since this/the last time update(World, float) was called |
private com.badlogic.gdx.utils.Array<com.badlogic.gdx.physics.box2d.Joint> |
previousJoints
the Joints since this/the last time
update(World, float) was called |
private com.badlogic.gdx.utils.Array<com.badlogic.gdx.physics.box2d.Body> |
tmpBodies
temporary array used internally
|
private WorldObserver.WorldChange |
worldChange
the WorldChange used to track the World
|
| Constructor and Description |
|---|
WorldObserver()
creates a new WorldObserver with no
listener |
WorldObserver(WorldObserver.Listener listener) |
| Modifier and Type | Method and 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) |
private WorldObserver.Listener listener
private final WorldObserver.WorldChange worldChange
private final com.badlogic.gdx.utils.IntMap<WorldObserver.BodyChange> bodyChanges
Box2DUtils#hashCode(Body) because a World pools its Bodiesprivate final com.badlogic.gdx.utils.IntMap<WorldObserver.FixtureChange> fixtureChanges
Box2DUtils#hashCode(Fixture) because a world pools its Fixturesprivate final com.badlogic.gdx.utils.ObjectMap<com.badlogic.gdx.physics.box2d.Joint,WorldObserver.JointChange> jointChanges
private final com.badlogic.gdx.utils.Array<com.badlogic.gdx.physics.box2d.Body> tmpBodies
private final com.badlogic.gdx.utils.IntMap<com.badlogic.gdx.physics.box2d.Body> currentBodies
hash since this/the last time update(World, float) was calledprivate final com.badlogic.gdx.utils.IntMap<com.badlogic.gdx.physics.box2d.Body> previousBodies
hash since this/the last time update(World, float) was calledprivate final com.badlogic.gdx.utils.IntMap<com.badlogic.gdx.physics.box2d.Fixture> currentFixtures
hash since this/the last time update(World, float) was calledprivate final com.badlogic.gdx.utils.IntMap<com.badlogic.gdx.physics.box2d.Fixture> previousFixtures
hash since this/the last time update(World, float) was calledprivate final com.badlogic.gdx.utils.Array<com.badlogic.gdx.physics.box2d.Joint> currentJoints
update(World, float) was calledprivate final com.badlogic.gdx.utils.Array<com.badlogic.gdx.physics.box2d.Joint> previousJoints
update(World, float) was calledpublic WorldObserver()
listenerpublic WorldObserver(WorldObserver.Listener listener)
listener - the listenerpublic void update(com.badlogic.gdx.physics.box2d.World world,
float step)
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 last stepped withpublic WorldObserver.BodyChange getBodyChange(int hash)
hash - the hash of the Body (computed via Box2DUtils#hashCode(Body)) which associated BodyChange to returnbodyChanges currently used for the Body with the given hash, or null if not foundpublic WorldObserver.FixtureChange getFixtureChange(int hash)
hash - the hash of the Fixture (computed via Box2DUtils#hashCode(Fixture)) which associated FixtureChange to returnfixtureChanges currently used for the Fixture with the given hash, or null if not foundpublic WorldObserver.JointChange getJointChange(com.badlogic.gdx.physics.box2d.Joint joint)
joint - the joint which associated JointChange to returnjointChanges currently used for the given Jointpublic WorldObserver.WorldChange getWorldChange()
worldChangepublic WorldObserver.Listener getListener()
listenerpublic void setListener(WorldObserver.Listener listener)
listener - the listener to set