Debug overlay always rendered regardless of debug status.

This commit is contained in:
2014-06-18 12:04:18 -04:30
parent 8bd799f146
commit a247d24770
3 changed files with 20 additions and 31 deletions

View File

@@ -255,17 +255,15 @@ public class NxtARCore extends Game implements ApplicationEventsListener{
ShaderProgram.pedantic = false; ShaderProgram.pedantic = false;
// Set up the overlay font. // Set up the overlay font.
if(ProjectConstants.DEBUG){ overlayX = -((Gdx.graphics.getWidth() * ProjectConstants.OVERSCAN) / 2) + 10;
overlayX = -((Gdx.graphics.getWidth() * ProjectConstants.OVERSCAN) / 2) + 10; overlayY = ((Gdx.graphics.getHeight() * ProjectConstants.OVERSCAN) / 2) - 10;
overlayY = ((Gdx.graphics.getHeight() * ProjectConstants.OVERSCAN) / 2) - 10;
font = new BitmapFont(); font = new BitmapFont();
font.setColor(1.0f, 1.0f, 0.0f, 1.0f); font.setColor(1.0f, 1.0f, 0.0f, 1.0f);
if(!Ouya.runningOnOuya){ if(!Ouya.runningOnOuya){
font.setScale(1.0f); font.setScale(1.0f);
}else{ }else{
font.setScale(2.5f); font.setScale(2.5f);
}
} }
// Start networking. // Start networking.
@@ -386,17 +384,15 @@ public class NxtARCore extends Game implements ApplicationEventsListener{
} }
// Render the debug overlay. // Render the debug overlay.
if(ProjectConstants.DEBUG){ batch.setProjectionMatrix(pixelPerfectCamera.combined);
batch.setProjectionMatrix(pixelPerfectCamera.combined); batch.begin();{
batch.begin();{ // Draw the FPS overlay.
// Draw the FPS overlay. font.draw(batch, String.format("Render FPS: %d", Gdx.graphics.getFramesPerSecond()), overlayX, overlayY);
font.draw(batch, String.format("Render FPS: %d", Gdx.graphics.getFramesPerSecond()), overlayX, overlayY); font.draw(batch, String.format("Total stream FPS: %d", videoThread.getFps()), overlayX, overlayY - font.getCapHeight() - 5);
font.draw(batch, String.format("Total stream FPS: %d", videoThread.getFps()), overlayX, overlayY - font.getCapHeight() - 5); font.draw(batch, String.format("Lost stream FPS: %d", videoThread.getLostFrames()), overlayX, overlayY - (2 * font.getCapHeight()) - 10);
font.draw(batch, String.format("Lost stream FPS: %d", videoThread.getLostFrames()), overlayX, overlayY - (2 * font.getCapHeight()) - 10); font.draw(batch, String.format("Light sensor data: %d", sensorThread.getLightSensorReading()), overlayX, overlayY - (3 * font.getCapHeight()) - 15);
font.draw(batch, String.format("Light sensor data: %d", sensorThread.getLightSensorReading()), overlayX, overlayY - (3 * font.getCapHeight()) - 15); font.draw(batch, String.format("Device roll: %f", Gdx.input.getRoll()), overlayX, overlayY - (4 * font.getCapHeight()) - 20);
font.draw(batch, String.format("Device roll: %f", Gdx.input.getRoll()), overlayX, overlayY - (4 * font.getCapHeight()) - 20); }batch.end();
}batch.end();
}
} }
/** /**
@@ -437,9 +433,7 @@ public class NxtARCore extends Game implements ApplicationEventsListener{
// Dispose graphic objects. // Dispose graphic objects.
fadeTexture.dispose(); fadeTexture.dispose();
batch.dispose(); batch.dispose();
if(ProjectConstants.DEBUG){ font.dispose();
font.dispose();
}
// Dispose screens. // Dispose screens.
for(int i = 0; i < states.length; i++){ for(int i = 0; i < states.length; i++){
@@ -484,8 +478,7 @@ public class NxtARCore extends Game implements ApplicationEventsListener{
;;;;;;;;;;;;;;;;;;*/ ;;;;;;;;;;;;;;;;;;*/
/** /**
* <p>Show a toast message on screen using the O.S. functionality * <p>Show a toast message on screen using the {@link ActionResolver}.</p>
* provider.</p>
* @param msg The message to show. * @param msg The message to show.
* @param longToast True for a lasting toast. False for a short toast. * @param longToast True for a lasting toast. False for a short toast.
*/ */

View File

@@ -111,8 +111,6 @@ public class OuyaMainMenuState extends MainMenuStateBase{
@Override @Override
public boolean buttonDown(Controller controller, int buttonCode){ public boolean buttonDown(Controller controller, int buttonCode){
// TODO: Test this.
if(stateActive){ if(stateActive){
if(buttonCode == Ouya.BUTTON_O){ if(buttonCode == Ouya.BUTTON_O){
Gdx.app.log(TAG, CLASS_NAME + ".buttonDown(): O button pressed."); Gdx.app.log(TAG, CLASS_NAME + ".buttonDown(): O button pressed.");
@@ -148,8 +146,6 @@ public class OuyaMainMenuState extends MainMenuStateBase{
@Override @Override
public boolean buttonUp(Controller controller, int buttonCode){ public boolean buttonUp(Controller controller, int buttonCode){
// TODO: Test this.
if(stateActive){ if(stateActive){
if(buttonCode == Ouya.BUTTON_O){ if(buttonCode == Ouya.BUTTON_O){
Gdx.app.log(TAG, CLASS_NAME + ".buttonDown(): O button released."); Gdx.app.log(TAG, CLASS_NAME + ".buttonDown(): O button released.");

View File

@@ -40,7 +40,7 @@ public abstract class GameSettings{
if(getEntityCreator() == null){ if(getEntityCreator() == null){
entityCreator = new BombGameEntityCreator(); entityCreator = new BombGameEntityCreator();
entityCreator.setWorld(GameSettings.getGameWorld()); entityCreator.setWorld(gameWorld);
entityCreator.setCore(core); entityCreator.setCore(core);
} }