简体   繁体   中英

How to use JBox2D debug-draw in Slick2D?

JBox2D , the Java port of the Box2D physics engine, features an extensible module for creating debug drawing of shapes. How can I use this with the Slick2D game library?

Using the JBox2D DebugDraw class for Slick2D it is simple to add debug drawing. Put the below code in your init method:

Slick2DJBox2DDebugDraw debugDraw = new Slick2DJBox2DDebugDraw(gameContainer);
debugDraw.setFlags(DebugDraw.e_shapeBit);
world.setDebugDraw(debugDraw); // Where world is your JBox2D world

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM