Listener

From Box2D Wiki

In general, a listener is an object you register to catch events. Box2D implements listeners in consistent simple way.

The Box2D system uses the following listeners and listener-like callbacks (listeners that return a value):

Using listeners

All listeners are created by subclassing the given abstract base class and providing an implementation for its methods, and then attaching an instance to the world with a method beginning with Set. Thus all listeners are global and only one listener can be set for each type. It is up to you to implement more advanced forms of event dispatching if you desire them.

Note that many listeners can be called during a world's step. The world is locked to editing during the step, so it is necessary to buffer handling the event, or buffer the changes you want to make to the world.

See also

TOOLBOX
LANGUAGES