Added debug logging for number of box2d bodies generated

This commit is contained in:
Collin Smith 2019-11-19 23:55:50 -08:00
parent 4e5fbc03d6
commit 3bd3e5f64e

View File

@ -6,6 +6,7 @@ import com.badlogic.ashley.core.Entity;
import com.badlogic.ashley.core.EntityListener;
import com.badlogic.ashley.core.Family;
import com.badlogic.ashley.systems.IntervalIteratingSystem;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.BodyDef;
@ -25,6 +26,9 @@ import com.riiablo.engine.component.VelocityComponent;
import java.util.Arrays;
public class Box2DPhysicsSystem extends IntervalIteratingSystem implements EntityListener, Disposable {
private static final String TAG = "Box2DPhysicsSystem";
private static final boolean DEBUG = true;
private final ComponentMapper<PositionComponent> positionComponent = ComponentMapper.getFor(PositionComponent.class);
private final ComponentMapper<Box2DComponent> box2dComponent = ComponentMapper.getFor(Box2DComponent.class);
@ -76,6 +80,7 @@ public class Box2DPhysicsSystem extends IntervalIteratingSystem implements Entit
if (this.map != map) {
this.map = map;
createBodies();
if (DEBUG) Gdx.app.debug(TAG, "bodies=" + world.getBodyCount());
}
}