本文整理汇总了Java中org.jbox2d.callbacks.DebugDraw类的典型用法代码示例。如果您正苦于以下问题:Java DebugDraw类的具体用法?Java DebugDraw怎么用?Java DebugDraw使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DebugDraw类属于org.jbox2d.callbacks包,在下文中一共展示了DebugDraw类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawTree
import org.jbox2d.callbacks.DebugDraw; //导入依赖的package包/类
public void drawTree(DebugDraw argDraw, int node, int spot, int height) {
AABB a = m_aabb[node];
a.getVertices(drawVecs);
color.set(1, (height - spot) * 1f / height, (height - spot) * 1f / height);
argDraw.drawPolygon(drawVecs, 4, color);
argDraw.getViewportTranform().getWorldToScreen(a.upperBound, textVec);
argDraw.drawString(textVec.x, textVec.y, node + "-" + (spot + 1) + "/" + height, color);
int c1 = m_child1[node];
int c2 = m_child2[node];
if (c1 != NULL_NODE) {
drawTree(argDraw, c1, spot + 1, height);
}
if (c2 != NULL_NODE) {
drawTree(argDraw, c2, spot + 1, height);
}
}
示例2: drawTree
import org.jbox2d.callbacks.DebugDraw; //导入依赖的package包/类
public void drawTree(DebugDraw argDraw, DynamicTreeNode node, int spot, int height) {
node.aabb.getVertices(drawVecs);
color.set(1, (height - spot) * 1f / height, (height - spot) * 1f / height);
argDraw.drawPolygon(drawVecs, 4, color);
argDraw.getViewportTranform().getWorldToScreen(node.aabb.upperBound, textVec);
argDraw.drawString(textVec.x, textVec.y, node.id + "-" + (spot + 1) + "/" + height, color);
if (node.child1 != null) {
drawTree(argDraw, node.child1, spot + 1, height);
}
if (node.child2 != null) {
drawTree(argDraw, node.child2, spot + 1, height);
}
}
示例3: drawParticleSystem
import org.jbox2d.callbacks.DebugDraw; //导入依赖的package包/类
private void drawParticleSystem(ParticleSystem system) {
boolean wireframe = (m_debugDraw.getFlags() & DebugDraw.e_wireframeDrawingBit) != 0;
int particleCount = system.getParticleCount();
if (particleCount != 0) {
float particleRadius = system.getParticleRadius();
Vec2[] positionBuffer = system.getParticlePositionBuffer();
ParticleColor[] colorBuffer = null;
if (system.m_colorBuffer.data != null) {
colorBuffer = system.getParticleColorBuffer();
}
if (wireframe) {
m_debugDraw.drawParticlesWireframe(positionBuffer, particleRadius, colorBuffer,
particleCount);
} else {
m_debugDraw.drawParticles(positionBuffer, particleRadius, colorBuffer, particleCount);
}
}
}
示例4: drawTree
import org.jbox2d.callbacks.DebugDraw; //导入依赖的package包/类
public void drawTree(DebugDraw argDraw, DynamicTreeNode argNode, int spot, int height) {
argNode.aabb.getVertices(drawVecs);
color.set(1, (height - spot) * 1f / height, (height - spot) * 1f / height);
argDraw.drawPolygon(drawVecs, 4, color);
argDraw.getViewportTranform().getWorldToScreen(argNode.aabb.upperBound, textVec);
argDraw.drawString(textVec.x, textVec.y, (spot + 1) + "/" + height, color);
if (argNode.child1 != null) {
drawTree(argDraw, argNode.child1, spot + 1, height);
}
if (argNode.child2 != null) {
drawTree(argDraw, argNode.child2, spot + 1, height);
}
}
示例5: drawTree
import org.jbox2d.callbacks.DebugDraw; //导入依赖的package包/类
public void drawTree(DebugDraw argDraw, int nodeId, int spot, int height) {
final DynamicTreeNode node = m_nodes[nodeId];
node.aabb.getVertices(drawVecs);
color.set(1, (height - spot) * 1f / height, (height - spot) * 1f / height);
argDraw.drawPolygon(drawVecs, 4, color);
argDraw.getViewportTranform().getWorldToScreen(node.aabb.upperBound, textVec);
argDraw.drawString(textVec.x, textVec.y, nodeId + "-" + (spot + 1) + "/" + height, color);
if (node.child1 != NULL_NODE) {
drawTree(argDraw, node.child1, spot + 1, height);
}
if (node.child2 != NULL_NODE) {
drawTree(argDraw, node.child2, spot + 1, height);
}
}
示例6: showDebugDraw
import org.jbox2d.callbacks.DebugDraw; //导入依赖的package包/类
public void showDebugDraw (Physics game) {
debugDraw = new DebugDrawBox2D(game.plat, (int) (width / game.physScaleX),
(int) (height / game.physScaleY));
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 / game.physScaleX);
game.rootLayer.add(debugLayer = new ImageLayer(debugDraw.canvas.image));
world.setDebugDraw(debugDraw);
}
示例7: drawTree
import org.jbox2d.callbacks.DebugDraw; //导入依赖的package包/类
@Override
public void drawTree(DebugDraw argDraw) {
m_tree.drawTree(argDraw);
}
示例8: drawTree
import org.jbox2d.callbacks.DebugDraw; //导入依赖的package包/类
public void drawTree(DebugDraw argDraw) {
m_tree.drawTree(argDraw);
}
示例9: init
import org.jbox2d.callbacks.DebugDraw; //导入依赖的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();
}
示例10: drawTree
import org.jbox2d.callbacks.DebugDraw; //导入依赖的package包/类
public void drawTree(DebugDraw argDraw) {
m_tree.drawTree(argDraw);
}
示例11: PeaWorld
import org.jbox2d.callbacks.DebugDraw; //导入依赖的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);
}
}
示例12: drawTree
import org.jbox2d.callbacks.DebugDraw; //导入依赖的package包/类
@Override
public void drawTree(DebugDraw argDraw) {}
示例13: setDebugDraw
import org.jbox2d.callbacks.DebugDraw; //导入依赖的package包/类
public void setDebugDraw(DebugDraw argDraw) {
draw = argDraw;
}
示例14: getDebugDraw
import org.jbox2d.callbacks.DebugDraw; //导入依赖的package包/类
public DebugDraw getDebugDraw() {
return draw;
}