當前位置: 首頁>>代碼示例>>Java>>正文


Java Box2DDebugRenderer類代碼示例

本文整理匯總了Java中com.badlogic.gdx.physics.box2d.Box2DDebugRenderer的典型用法代碼示例。如果您正苦於以下問題:Java Box2DDebugRenderer類的具體用法?Java Box2DDebugRenderer怎麽用?Java Box2DDebugRenderer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Box2DDebugRenderer類屬於com.badlogic.gdx.physics.box2d包,在下文中一共展示了Box2DDebugRenderer類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createCamera

import com.badlogic.gdx.physics.box2d.Box2DDebugRenderer; //導入依賴的package包/類
/**
 * Creates a new Orthographic Camera for the Game.
 *
 * @return the created camera.
 */
private OrthographicCamera createCamera() {
    OrthographicCamera camera = new OrthographicCamera(VIEWPORT_WIDTH / PIXEL_TO_METER,
            VIEWPORT_HEIGHT / PIXEL_TO_METER);

    camera.position.set(model.getBallModel().getX() / PIXEL_TO_METER,
            model.getBallModel().getY() / PIXEL_TO_METER, 0);
    camera.update();

    if (DEBUG_PHYSICS) {
        debugRenderer = new Box2DDebugRenderer();
        debugCamera = camera.combined.cpy();
        debugCamera.scl(1 / PIXEL_TO_METER);
    }

    return camera;
}
 
開發者ID:AndreFCruz,項目名稱:feup-lpoo-armadillo,代碼行數:22,代碼來源:GameScreen.java

示例2: undispose

import com.badlogic.gdx.physics.box2d.Box2DDebugRenderer; //導入依賴的package包/類
/**
 * Recreates all disposables.
 */
public void undispose() {
	if (!isDisposed) {
		return;
	}
	box2DDebugRenderer = new Box2DDebugRenderer(true, true, true, true, true, true);
	fogOfWarWorld = new World(new Vector2(0, 0), true);
	lightsWorld = new World(new Vector2(0, 0), true);
	createFogOfWarRayHandler();
	createLightsRayHandler();
	createViewConesRayHandler();
	
	isDisposed = false;
	
	for (int i = 0; i < gameObjects.size; ++i) {
		gameObjects.get(i).undispose();
	}
	
	for (Entry<TrapLocation, FilledPolygonRenderer> entry : traps.entries()) {
		traps.put(entry.key, entry.key.createRenderer());
	}
}
 
開發者ID:mganzarcik,項目名稱:fabulae,代碼行數:25,代碼來源:GameMap.java

示例3: show

import com.badlogic.gdx.physics.box2d.Box2DDebugRenderer; //導入依賴的package包/類
@Override
public void show() {
    this.box2DDebugRenderer = new Box2DDebugRenderer(true, true, false, true, false, true);
    this.camera = new OrthographicCamera(level.getWidth(), level.getWidth() * camera.viewportHeight / camera.viewportWidth);
    this.particlesStage.getViewport().setCamera(camera);
    this.bordersStage.getViewport().setCamera(camera);
    this.othersStage.getViewport().setCamera(camera);
    this.startColor = this.particlesStage.getBatch().getColor();
    this.xMin = level.getXMin();
    this.xMax = level.getXMax();
    this.yMin = level.getYMin();
    this.yMax = level.getYMax();
    Graphics.setCurrentCamera(camera);
    this.box2DDebugRenderer.SHAPE_AWAKE.set(0, 0, 0, 0.5f);

    GDXGameGP.currentGame.inputMultiplexer.addProcessor(this);
    GDXGameGP.currentGame.inputMultiplexer.addProcessor(new GestureDetector(this));
}
 
開發者ID:delphikettle,項目名稱:libgdxGP,代碼行數:19,代碼來源:LevelScreen.java

示例4: DebugRendererSystem

import com.badlogic.gdx.physics.box2d.Box2DDebugRenderer; //導入依賴的package包/類
public DebugRendererSystem(Entitas entitas, World world, Batch batch) {
    this.physics = world;
    this.entitas = entitas;
    this.batch = batch;

    this.shapeRenderer = new ShapeRenderer();
    this.debugRenderer = new Box2DDebugRenderer(DRAW_BOX2D_BODIES, DRAW_BOX2D_JOINTS, DRAW_BOX2D_ABBs,
            DRAW_BOX2D_INACTIVE_BODIES, DRAW_BOX2D_VELOCITIES, DRAW_BOX2D_CONTACTS);
    debugRenderer.setDrawAABBs(DRAW_BOX2D_ABBs);
    debugRenderer.setDrawBodies(DRAW_BOX2D_BODIES);
    debugRenderer.setDrawContacts(DRAW_BOX2D_CONTACTS);
    debugRenderer.setDrawInactiveBodies(DRAW_BOX2D_INACTIVE_BODIES);
    debugRenderer.setDrawJoints(DRAW_BOX2D_JOINTS);
    debugRenderer.setDrawVelocities(DRAW_BOX2D_VELOCITIES);

}
 
開發者ID:Rubentxu,項目名稱:Entitas-Java,代碼行數:17,代碼來源:DebugRendererSystem.java

示例5: RendererSystem

import com.badlogic.gdx.physics.box2d.Box2DDebugRenderer; //導入依賴的package包/類
public RendererSystem(Entitas entitas, Camera cam, Batch batch, World world) {
    this.physics = world;
    this.cam = cam;
    this.batch = batch;
    this.entitas = entitas;
    _groupTextureView = entitas.game.getGroup(GameMatcher.TextureView());
    this.debugShapeRenderer = new ShapeRenderer();
    this.debugRenderer = new Box2DDebugRenderer(DRAW_BOX2D_BODIES, DRAW_BOX2D_JOINTS, DRAW_BOX2D_ABBs,
            DRAW_BOX2D_INACTIVE_BODIES, DRAW_BOX2D_VELOCITIES, DRAW_BOX2D_CONTACTS);
    debugRenderer.setDrawAABBs(DRAW_BOX2D_ABBs);
    debugRenderer.setDrawBodies(DRAW_BOX2D_BODIES);
    debugRenderer.setDrawContacts(DRAW_BOX2D_CONTACTS);
    debugRenderer.setDrawInactiveBodies(DRAW_BOX2D_INACTIVE_BODIES);
    debugRenderer.setDrawJoints(DRAW_BOX2D_JOINTS);
    debugRenderer.setDrawVelocities(DRAW_BOX2D_VELOCITIES);
    this.inputs = entitas.input.getGroup(InputMatcher.Input());
}
 
開發者ID:Rubentxu,項目名稱:Entitas-Java,代碼行數:18,代碼來源:RendererSystem.java

示例6: GameScreen

import com.badlogic.gdx.physics.box2d.Box2DDebugRenderer; //導入依賴的package包/類
/**
 * 
 */
public GameScreen(SupaBox game) {
	this.game = game;
	
	//float aspectRatio = (float) Gdx.graphics.getHeight() / (float) Gdx.graphics.getWidth();
	
	camera = new OrthographicCamera();
	viewport = new FitViewport(24, 16, camera);
	viewport.apply();
	
	camera.position.set(viewport.getWorldWidth() / 2, viewport.getWorldHeight() / 2, 0);
	
	debugRenderer = new Box2DDebugRenderer();
	world = new World(new Vector2(0, -9.8f), true);
	
	mapLoader = new TmxMapLoader();
	map = mapLoader.load("crate.tmx");
	mapRenderer = new OrthogonalTiledMapRenderer(map, 1f / SupaBox.PPM);
	
	bodyBuilder = new BodyBuilder();
	bodyBuilder.createBodies(entities, world, map);
}
 
開發者ID:ryanshappell,項目名稱:SupaBax,代碼行數:25,代碼來源:GameScreen.java

示例7: create

import com.badlogic.gdx.physics.box2d.Box2DDebugRenderer; //導入依賴的package包/類
public void create () {
	cam = new OrthographicCamera(48, 32);
	cam.position.set(0, 15, 0);
	renderer = new Box2DDebugRenderer();

	world = new World(new Vector2(0, -10), true);
	Body body = world.createBody(new BodyDef());
	CircleShape shape = new CircleShape();
	shape.setRadius(1f);
	MassData mass = new MassData();
	mass.mass = 1f;
	body.setMassData(mass);
	body.setFixedRotation(true);
	body.setType(BodyType.KinematicBody);
	body.createFixture(shape, 1);
	body.setBullet(true);
	body.setTransform(new Vector2(0, 0), body.getAngle());
	body.setLinearVelocity(new Vector2(50f, 0));
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:20,代碼來源:KinematicBodyTest.java

示例8: CatchrScreen

import com.badlogic.gdx.physics.box2d.Box2DDebugRenderer; //導入依賴的package包/類
public CatchrScreen(Catchr game, boolean debug)
{
	super(game);
	this.debug = debug;

	this.batch = new SpriteBatch();

	this.cam = new OrthographicCamera();
	this.cam.viewportHeight = Catchr.WINDOW_HEIGHT;
	this.cam.viewportWidth = Catchr.WINDOW_WIDTH;
	this.cam.position.set(this.cam.viewportWidth / 2, this.cam.viewportHeight / 2, 0f);

	this.board = new Board(game, this.cam, this.debug);

	this.debugRenderer = new Box2DDebugRenderer();

}
 
開發者ID:xzela,項目名稱:catchr,代碼行數:18,代碼來源:CatchrScreen.java

示例9: JastroScreen

import com.badlogic.gdx.physics.box2d.Box2DDebugRenderer; //導入依賴的package包/類
public JastroScreen()
{
	this.debug = JastroBlast.DEBUG;
	this.batch = new SpriteBatch();

	this.camera = new OrthographicCamera();
	this.camera.viewportHeight = JastroBlast.WINDOW_HEIGHT;
	this.camera.viewportWidth = JastroBlast.WINDOW_WIDTH;
	this.camera.position.set(this.camera.viewportWidth / 2, this.camera.viewportHeight / 2 , 0);


	this.space = new Space(this.camera, this.debug);
	this.boxDebugRenderer = new Box2DDebugRenderer();
	this.shipController = new ShipController(this.space.getShip());
	this.hud = new Hud(this.space);
}
 
開發者ID:xzela,項目名稱:jastroblast,代碼行數:17,代碼來源:JastroScreen.java

示例10: PhysicsManager

import com.badlogic.gdx.physics.box2d.Box2DDebugRenderer; //導入依賴的package包/類
/**
    * Create a physics scene
    * 
    * @param gameService
    */
   public PhysicsManager(IGameService gameService) {
super(gameService);
debugRender = new Box2DDebugRenderer();
debugMatrix = new Matrix4(services.getCamera().combined);
debugMatrix.scale(BOX_TO_WORLD, BOX_TO_WORLD, 1f);
   }
 
開發者ID:game-libgdx-unity,項目名稱:GDX-Engine,代碼行數:12,代碼來源:PhysicsManager.java

示例11: create

import com.badlogic.gdx.physics.box2d.Box2DDebugRenderer; //導入依賴的package包/類
@Override
public void create() {
	camera = new OrthographicCamera();
	stage = new Stage(new StretchViewport(Gdx.graphics.getWidth() / 100, Gdx.graphics.getHeight() / 100, camera));

	// Create box2d world
	world = new World(new Vector2(0, -10), true);
	world.setContactListener(new MyContactListener());
	debugRenderer = new Box2DDebugRenderer();
	
	water = new Water();
	water.createBody(world, 3f, 0, 8, 2); //world, x, y, width, height
	//water.setDebugMode(true);
}
 
開發者ID:jocasolo,項目名稱:water2d-libgdx,代碼行數:15,代碼來源:GameMain.java

示例12: PlayScreen

import com.badlogic.gdx.physics.box2d.Box2DDebugRenderer; //導入依賴的package包/類
public PlayScreen(NoObjectionGame game) {
    atlas = new TextureAtlas("dudestuff3.pack");

    this.game = game;
    bg = new Texture("main_background.png");
    gameCam = new OrthographicCamera();
    gamePort = new FitViewport(NoObjectionGame.V_WIDTH / NoObjectionGame.PPM, NoObjectionGame.V_HEIGHT / NoObjectionGame.PPM, gameCam);
    hud = new Hud(game.batch);

    maploader = new TmxMapLoader();
    map = maploader.load("map1.tmx");
    renderer = new OrthoCachedTiledMapRenderer(map, 1 / NoObjectionGame.PPM);
    gameCam.position.set(gamePort.getWorldWidth() / 2, gamePort.getWorldHeight() / 2, 0);

    world = new World(new Vector2(0, -10), true);
    b2dr = new Box2DDebugRenderer();

    new B2WorldCreator(world, map);
    hero = new Hero(world, this);
    controller = new Controller();
    worldContactListener = new WorldContactListener();
    world.setContactListener(worldContactListener);

    //timer
    sb = new SpriteBatch();
    viewport = new FitViewport(NoObjectionGame.V_WIDTH, NoObjectionGame.V_HEIGHT, new OrthographicCamera());
    stage = new Stage(viewport, sb);
    table = new Table();
    table.top();
    table.setFillParent(true);
    countDownLabel = new Label(Float.toString(playTime), new Label.LabelStyle(new BitmapFont(), Color.WHITE));
    table.add(countDownLabel).expandX();
    stage.addActor(table);


}
 
開發者ID:MissionBit,項目名稱:summer17-android,代碼行數:37,代碼來源:PlayScreen.java

示例13: init

import com.badlogic.gdx.physics.box2d.Box2DDebugRenderer; //導入依賴的package包/類
private void init() {

		//初始化世界 初始化重力
		mWorld = new World(new Vector2(0, -9.8f), true);

		//初始化剛體世界相機
		mBox2DCamera = new OrthographicCamera();
		mBox2DCamera.setToOrtho(false, MyGdxGame.VIEW_WIDTH / Constant.RATE, MyGdxGame.VIEW_HEIGHT / Constant.RATE);

		//初始化Box2D渲染器
		mBox2DRender = new Box2DDebugRenderer();

		//初始化蟠桃與藍瓶
		mTaos = new Array<Tao>();
		mBlues = new Array<Blue>();

		//創建地圖
		createMap();

		//創建天兵
		createEnemy();

		//創建Boss
		createBoss(level);

		//創建主角
		createActor();

		//初始化所有控件
		initWidget();

		//初始化孫悟空所有按鈕的監聽事件
		initListener();

		//注冊碰撞監聽事件
		mContactListener = new Box2DContactListener();
		mWorld.setContactListener(mContactListener);
	}
 
開發者ID:heyzqt,項目名稱:libGdx-xiyou,代碼行數:39,代碼來源:Play.java

示例14: initDebugRenderer

import com.badlogic.gdx.physics.box2d.Box2DDebugRenderer; //導入依賴的package包/類
private void initDebugRenderer() {
    if (!DEBUG_RENDERER) {
        return;
    }

    mDebugRenderer = new Box2DDebugRenderer();
    mDebugFont = new BitmapFont();

    mDebugTextLayout = new GlyphLayout(mDebugFont, "test");
}
 
開發者ID:tgobbens,項目名稱:fluffybalance,代碼行數:11,代碼來源:Balanceball.java

示例15: CollisionHandler

import com.badlogic.gdx.physics.box2d.Box2DDebugRenderer; //導入依賴的package包/類
public CollisionHandler(OverworldCamera ovwCam, boolean renderCollision) {
    this.overworldCam = ovwCam;
    this.rendererCam = new OrthographicCamera(640, 480);
    this.rendererCam.zoom = 1 / OverworldController.METERS_TO_PIXELS;
    this.destroyed = false;
    this.reset();

    this.renderer = new Box2DDebugRenderer(true, true, false, true, false, true);
}
 
開發者ID:Xemiru,項目名稱:Undertailor,代碼行數:10,代碼來源:CollisionHandler.java


注:本文中的com.badlogic.gdx.physics.box2d.Box2DDebugRenderer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。