// Path: src/main/java/com/simsilica/post/DefaultSceneProcessor.java
// public class DefaultSceneProcessor implements SceneProcessor {
// 
//     @Override
//     public void initialize( RenderManager rm, ViewPort vp ) {
//     }
// 
//     @Override
//     public void reshape( ViewPort vp, int w, int h ) {
//     }
// 
//     /**
//      *  Default implementation always returns true.  Note
//      *  that this may prevent initialize() from ever being called.
//      *  Subclasses that wish to have proper lifecycle should return
//      *  a real value from this method.
//      */
//     @Override
//     public boolean isInitialized() {
//         return true;
//     }
// 
//     @Override
//     public void preFrame( float tpf ) {
//     }
// 
//     @Override
//     public void postQueue( RenderQueue rq ) {
//     }
// 
//     @Override
//     public void postFrame( FrameBuffer out ) {
//     }
// 
//     @Override
//     public void cleanup() {
//     }
// 
//     @Override
//     public void setProfiler( AppProfiler profiler ) {
//     }
// }


import java.util.HashMap;
import java.util.Map;
import org.slf4j.*;
import com.jme3.app.Application;
import com.jme3.app.SimpleApplication;
import com.jme3.app.state.BaseAppState;
import com.jme3.math.Vector3f;
import com.jme3.post.SceneProcessor;
import com.jme3.renderer.Camera;
import com.jme3.renderer.ViewPort;
import com.jme3.scene.Node;
import com.jme3.util.SafeArrayList;
import com.simsilica.lemur.*;
import com.simsilica.lemur.component.BorderLayout;
import com.simsilica.lemur.component.SpringGridLayout;
import com.simsilica.lemur.core.*;
import com.simsilica.lemur.input.FunctionId;
import com.simsilica.lemur.style.ElementId;
import com.simsilica.post.DefaultSceneProcessor;

        screen.removeFromParent();
        getHudViewPort().removeProcessor(reshapeListener);
    }
    
    private class DebugView {
        String name;
        VersionedReference<String> ref;
        Label nameLabel;
        Label label;
        Location location;
        
        public DebugView( String name, Location location, VersionedReference<String> ref ) {
            this.name = name;
            this.location = location;
            this.ref = ref;
            this.nameLabel = new Label(name + ": ", new ElementId("debug.name.label"));
            this.label = new Label(ref.get(), new ElementId("debug.value.label"));
        }
        
        public void update() {
            if( ref.update() ) {            
                label.setText(ref.get());
            }
        }
    }

    /**
     *  The only way I've found in JME to listen for reshape events
     *  is to hook in a scene processor.
     */    

// Path: src/main/java/com/simsilica/post/DefaultSceneProcessor.java
// public class DefaultSceneProcessor implements SceneProcessor {
// 
//     @Override
//     public void initialize( RenderManager rm, ViewPort vp ) {
//     }
// 
//     @Override
//     public void reshape( ViewPort vp, int w, int h ) {
//     }
// 
//     /**
//      *  Default implementation always returns true.  Note
//      *  that this may prevent initialize() from ever being called.
//      *  Subclasses that wish to have proper lifecycle should return
//      *  a real value from this method.
//      */
//     @Override
//     public boolean isInitialized() {
//         return true;
//     }
// 
//     @Override
//     public void preFrame( float tpf ) {
//     }
// 
//     @Override
//     public void postQueue( RenderQueue rq ) {
//     }
// 
//     @Override
//     public void postFrame( FrameBuffer out ) {
//     }
// 
//     @Override
//     public void cleanup() {
//     }
// 
//     @Override
//     public void setProfiler( AppProfiler profiler ) {
//     }
// }


// Path: src/main/java/com/simsilica/state/DebugHudState.java
import java.util.HashMap;
import java.util.Map;
import org.slf4j.*;
import com.jme3.app.Application;
import com.jme3.app.SimpleApplication;
import com.jme3.app.state.BaseAppState;
import com.jme3.math.Vector3f;
import com.jme3.post.SceneProcessor;
import com.jme3.renderer.Camera;
import com.jme3.renderer.ViewPort;
import com.jme3.scene.Node;
import com.jme3.util.SafeArrayList;
import com.simsilica.lemur.*;
import com.simsilica.lemur.component.BorderLayout;
import com.simsilica.lemur.component.SpringGridLayout;
import com.simsilica.lemur.core.*;
import com.simsilica.lemur.input.FunctionId;
import com.simsilica.lemur.style.ElementId;
import com.simsilica.post.DefaultSceneProcessor;

        screen.removeFromParent();
        getHudViewPort().removeProcessor(reshapeListener);
    }
    
    private class DebugView {
        String name;
        VersionedReference<String> ref;
        Label nameLabel;
        Label label;
        Location location;
        
        public DebugView( String name, Location location, VersionedReference<String> ref ) {
            this.name = name;
            this.location = location;
            this.ref = ref;
            this.nameLabel = new Label(name + ": ", new ElementId("debug.name.label"));
            this.label = new Label(ref.get(), new ElementId("debug.value.label"));
        }
        
        public void update() {
            if( ref.update() ) {            
                label.setText(ref.get());
            }
        }
    }

    /**
     *  The only way I've found in JME to listen for reshape events
     *  is to hook in a scene processor.
     */    

    private class ReshapeListener extends DefaultSceneProcessor {
