Skip to content

Commit

Permalink
#3 added FPSLogger to debug render
Browse files Browse the repository at this point in the history
  • Loading branch information
KOTerra committed Dec 28, 2022
1 parent 25cf5c9 commit 0d8fb09
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ void addTestAssets() {

void debugControls() {
if (Strafer.inDebug) {

if (Gdx.input.isKeyPressed(Keys.NUMPAD_SUBTRACT)) {
Strafer.worldCamera.zoom += .02f;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.straferdeliberator.game.world.collision;

import com.badlogic.gdx.graphics.FPSLogger;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Box2DDebugRenderer;
import com.badlogic.gdx.physics.box2d.World;
Expand All @@ -11,6 +12,8 @@ public class Box2DWorld implements Disposable {

private Box2DDebugRenderer debugRenderer;

FPSLogger fps = new FPSLogger();

public Box2DWorld() {
world = new World(new Vector2(0f, 0f), false);
debugRenderer = new Box2DDebugRenderer();
Expand All @@ -26,6 +29,7 @@ public void step(float delta) {
public void render() {
if (Strafer.inDebug) {
debugRenderer.render(world, Strafer.worldCamera.combined);
fps.log();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.utils.ScreenUtils;
import com.straferdeliberator.Strafer;
import com.straferdeliberator.game.world.GameWorld;

Expand Down Expand Up @@ -38,7 +39,7 @@ public void resize(int width, int height) {
public void render(float delta) {
update(delta);

// ScreenUtils.clear(0, 0, 0, 1);
ScreenUtils.clear(0, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);

Strafer.tiledMapRenderer.render();
Expand Down

0 comments on commit 0d8fb09

Please sign in to comment.