From 82bcdc13f91bca4fb84c06a53ae3bb333fe40757 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Wed, 21 Dec 2005 19:41:07 +0000 Subject: [PATCH] Allow statistics to be toggled on and off at runtime. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3796 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/java/com/threerings/jme/JmeApp.java | 31 ++++++++++++------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/java/com/threerings/jme/JmeApp.java b/src/java/com/threerings/jme/JmeApp.java index f845d8cea..fc29a1ef1 100644 --- a/src/java/com/threerings/jme/JmeApp.java +++ b/src/java/com/threerings/jme/JmeApp.java @@ -129,13 +129,6 @@ public class JmeApp _root.updateGeometricState(0f, true); _root.updateRenderState(); - // create and add our statistics display - if (displayStatistics()) { - _stats = new StatsDisplay(_display.getRenderer()); - _stats.updateGeometricState(0f, true); - _stats.updateRenderState(); - } - return true; } catch (Throwable t) { @@ -144,6 +137,21 @@ public class JmeApp } } + /** + * Configures whether or not we display FPS and other statistics atop the + * display. + */ + public void displayStatistics (boolean display) + { + if (display && (_stats == null)) { + _stats = new StatsDisplay(_display.getRenderer()); + _stats.updateGeometricState(0f, true); + _stats.updateRenderState(); + } else if (!display && (_stats != null)) { + _stats = null; + } + } + /** * Starts up the main rendering and event processing loop. This method * will not return until the application is terminated with a call to @@ -456,15 +464,6 @@ public class JmeApp System.exit(0); } - /** - * If true we'll display some renderer statistics at the bottom of the - * screen. - */ - protected boolean displayStatistics () - { - return false; - } - /** * Prepends the necessary bits onto the supplied path to properly * locate it in our configuration directory.