本文整理汇总了Java中org.jbox2d.dynamics.World.setDebugDraw方法的典型用法代码示例。如果您正苦于以下问题:Java World.setDebugDraw方法的具体用法?Java World.setDebugDraw怎么用?Java World.setDebugDraw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jbox2d.dynamics.World
的用法示例。
在下文中一共展示了World.setDebugDraw方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DwDebugDraw
import org.jbox2d.dynamics.World; //导入方法依赖的package包/类
public DwDebugDraw(PApplet papplet, World world, DwViewportTransform transform, PGraphics canvas){
super(transform);
this.papplet = papplet;
this.canvas = canvas;
this.transform = transform;
this.world = world;
// default flags
this.m_drawFlags = 0;
this.m_drawFlags |= DwDebugDraw.e_shapeBit; // m_bodyList
// this.m_drawFlags |= DwDebugDraw.e_wireframeDrawingBit; // m_bodyList
// this.m_drawFlags |= DwDebugDraw.e_aabbBit; // m_bodyList AABB
this.m_drawFlags |= DwDebugDraw.e_centerOfMassBit; // m_bodyList xf
this.m_drawFlags |= DwDebugDraw.e_pairBit; // m_contactManager
this.m_drawFlags |= DwDebugDraw.e_jointBit; // m_jointList
// this.m_drawFlags |= DwDebugDraw.e_dynamicTreeBit; // m_contactManager
setStrokeWeight(1f);
// Font for rendering Strings
font = papplet.createFont("Calibri", 12);
// Sprite for rendering Particles
float particle_rad = world.getParticleRadius() * 2 * PARTICLE_RADIUS_SCALE;
int radius_screen = (int) (Math.ceil(particle_rad * transform.screen_scale) * 2);
PARTICLE_SPRITE = DwUtils.createSprite(papplet, radius_screen, 2, 1, 1);
world.setDebugDraw(this);
}
示例2: init
import org.jbox2d.dynamics.World; //导入方法依赖的package包/类
public void init(World world, boolean deserialized) {
m_world = world;
pointCount = 0;
stepCount = 0;
bombSpawning = false;
model.getDebugDraw().setViewportTransform(camera.getTransform());
world.setDestructionListener(destructionListener);
world.setParticleDestructionListener(particleDestructionListener);
world.setContactListener(this);
world.setDebugDraw(model.getDebugDraw());
title = getTestName();
initTest(deserialized);
}
示例3: init
import org.jbox2d.dynamics.World; //导入方法依赖的package包/类
public void init(World world, boolean deserialized) {
m_world = world;
pointCount = 0;
stepCount = 0;
bombSpawning = false;
model.getDebugDraw().setViewportTransform(camera.getTransform());
world.setDestructionListener(destructionListener);
world.setContactListener(this);
world.setDebugDraw(model.getDebugDraw());
title = getTestName();
initTest(deserialized);
}
示例4: init
import org.jbox2d.dynamics.World; //导入方法依赖的package包/类
public void init(DebugDraw argDebugDraw){
m_debugDraw = argDebugDraw;
destructionListener = new DestructionListener() {
public void sayGoodbye(Fixture fixture) {
}
public void sayGoodbye(Joint joint) {
if(m_mouseJoint == joint){
m_mouseJoint = null;
}else{
jointDestroyed(joint);
}
}
};
Vec2 gravity = new Vec2(0, -10f);
m_world = new World(gravity, true);
m_bomb = null;
m_textLine = 30;
m_mouseJoint = null;
m_pointCount = 0;
m_world.setDestructionListener(destructionListener);
m_world.setContactListener(this);
m_world.setDebugDraw(m_debugDraw);
bombSpawning = false;
m_stepCount = 0;
// Contact.activeContacts = 0;
BodyDef bodyDef = new BodyDef();
m_groundBody = m_world.createBody(bodyDef);
if(hasCachedCamera){
setCamera(cachedCameraX, cachedCameraY, cachedCameraScale);
}else{
setCamera(0, 10, 10);
}
setTitle(getTestName());
initTest();
}
示例5: PeaWorld
import org.jbox2d.dynamics.World; //导入方法依赖的package包/类
public PeaWorld(GroupLayer scaledLayer) {
staticLayerBack = graphics().createGroupLayer();
scaledLayer.add(staticLayerBack);
dynamicLayer = graphics().createGroupLayer();
scaledLayer.add(dynamicLayer);
staticLayerFront = graphics().createGroupLayer();
scaledLayer.add(staticLayerFront);
// create the physics world
Vec2 gravity = new Vec2(0.0f, 10.0f);
world = new World(gravity, true);
world.setWarmStarting(true);
world.setAutoClearForces(true);
world.setContactListener(this);
// create the ground
Body ground = world.createBody(new BodyDef());
PolygonShape groundShape = new PolygonShape();
groundShape.setAsEdge(new Vec2(0, height), new Vec2(width, height));
ground.createFixture(groundShape, 0.0f);
// create the walls
Body wallLeft = world.createBody(new BodyDef());
PolygonShape wallLeftShape = new PolygonShape();
wallLeftShape.setAsEdge(new Vec2(0, 0), new Vec2(0, height));
wallLeft.createFixture(wallLeftShape, 0.0f);
Body wallRight = world.createBody(new BodyDef());
PolygonShape wallRightShape = new PolygonShape();
wallRightShape.setAsEdge(new Vec2(width, 0), new Vec2(width, height));
wallRight.createFixture(wallRightShape, 0.0f);
if (showDebugDraw) {
CanvasLayer canvasLayer =
graphics().createCanvasLayer((int) (width / Peas.physUnitPerScreenUnit),
(int) (height / Peas.physUnitPerScreenUnit));
graphics().rootLayer().add(canvasLayer);
debugDraw = new DebugDrawBox2D();
debugDraw.setCanvas(canvasLayer);
debugDraw.setFlipY(false);
debugDraw.setStrokeAlpha(150);
debugDraw.setFillAlpha(75);
debugDraw.setStrokeWidth(2.0f);
debugDraw.setFlags(DebugDraw.e_shapeBit | DebugDraw.e_jointBit | DebugDraw.e_aabbBit);
debugDraw.setCamera(0, 0, 1f / Peas.physUnitPerScreenUnit);
world.setDebugDraw(debugDraw);
}
}