Parcourir la source

whitespace changes in jme3-niftygui (#1767)

Stephen Gold il y a 3 ans
Parent
commit
0086f7e775

+ 1 - 1
jme3-niftygui/src/main/java/com/jme3/cinematic/events/GuiEvent.java

@@ -55,7 +55,7 @@ public class GuiEvent extends AbstractCinematicEvent {
     private static final Logger log = Logger.getLogger(GuiEvent.class.getName());
 
     /**
-     * name of the associated Nifty screen(not null)
+     * name of the associated Nifty screen (not null)
      */
     protected String screen;
     /**

+ 6 - 6
jme3-niftygui/src/main/java/com/jme3/niftygui/InputSystemJme.java

@@ -170,13 +170,13 @@ public class InputSystemJme implements InputSystem, RawInputListener {
             // which is good ;-) If that ever happens to someone there is an easy fix possible:
             // nifty.setIgnoreMouseEvents() to completely stop Nifty from processing events.
 
-                boolean consumed = nic.processMouseEvent(x, y, 0, button, false);
+            boolean consumed = nic.processMouseEvent(x, y, 0, button, false);
 
-                // Only consume event if it ORIGINATED in nifty!
-                if (niftyOwnsDragging[button] && consumed) {
-                    evt.setConsumed();
-                    processSoftKeyboard();
-                }
+            // Only consume event if it ORIGINATED in nifty!
+            if (niftyOwnsDragging[button] && consumed) {
+                evt.setConsumed();
+                processSoftKeyboard();
+            }
 
             niftyOwnsDragging[button] = false;
             //System.out.format("niftyMouse(%d, %d, %d, false) = %b\n", x, y, button, consumed);

+ 1 - 1
jme3-niftygui/src/main/java/com/jme3/niftygui/JmeBatchRenderBackend.java

@@ -514,7 +514,7 @@ public class JmeBatchRenderBackend implements BatchRenderBackend {
         private final Material material;
 
         public Batch() {
-            // setup mesh
+            // set up mesh
             vertexPos.setupData(Usage.Stream, 2, VertexBuffer.Format.Float, BufferUtils.createFloatBuffer(BATCH_MAX_VERTICES * 2));
             vertexPosBuffer = (FloatBuffer) vertexPos.getData();
             mesh.setBuffer(vertexPos);

+ 78 - 79
jme3-niftygui/src/main/java/com/jme3/niftygui/NiftyJmeDisplay.java

@@ -114,10 +114,10 @@ public class NiftyJmeDisplay implements SceneProcessor {
      * @return new NiftyJmeDisplay instance
      */
     public static NiftyJmeDisplay newNiftyJmeDisplay(
-        final AssetManager assetManager,
-        final InputManager inputManager,
-        final AudioRenderer audioRenderer,
-        final ViewPort viewport) {
+            final AssetManager assetManager,
+            final InputManager inputManager,
+            final AudioRenderer audioRenderer,
+            final ViewPort viewport) {
         return newNiftyJmeDisplay(
                 assetManager,
                 inputManager,
@@ -145,11 +145,11 @@ public class NiftyJmeDisplay implements SceneProcessor {
      * @return new NiftyJmeDisplay instance
      */
     public static NiftyJmeDisplay newNiftyJmeDisplay(
-        final AssetManager assetManager,
-        final InputManager inputManager,
-        final AudioRenderer audioRenderer,
-        final ViewPort viewport,
-        final BatchRenderConfiguration batchRenderConfiguration) {
+            final AssetManager assetManager,
+            final InputManager inputManager,
+            final AudioRenderer audioRenderer,
+            final ViewPort viewport,
+            final BatchRenderConfiguration batchRenderConfiguration) {
         return new NiftyJmeDisplay(
                 assetManager,
                 inputManager,
@@ -185,61 +185,61 @@ public class NiftyJmeDisplay implements SceneProcessor {
      * instead of this constructor.
      */
     public NiftyJmeDisplay(
-        final AssetManager assetManager,
-        final InputManager inputManager,
-        final AudioRenderer audioRenderer,
-        final ViewPort viewport,
-        final int atlasWidth,
-        final int atlasHeight) {
-      // The code duplication in here really sucks - it's a copy of the
-      // private constructor below that takes a BatchRenderConfiguration as an
-      // additional parameter. This method should really be removed soon and
-      // users should simply call the new factory methods.
-      //
-      // For now, I keep this constructor as-is, but have marked it as deprecated
-      // to allow migration to the new way to instantiate this class.
-      initialize(assetManager, inputManager, audioRenderer, viewport);
-
-      this.renderDev = null;
-      this.batchRendererBackend = new JmeBatchRenderBackend(this);
-
-      BatchRenderConfiguration batchRenderConfiguration = new BatchRenderConfiguration();
-      batchRenderConfiguration.atlasWidth = atlasWidth;
-      batchRenderConfiguration.atlasHeight = atlasHeight;
-
-      nifty = new Nifty(
-          new BatchRenderDevice(batchRendererBackend, batchRenderConfiguration),
-          soundDev,
-          inputSys,
-          new AccurateTimeProvider());
-      inputSys.setNifty(nifty);
-
-      resourceLocation = new ResourceLocationJme();
-      nifty.getResourceLoader().removeAllResourceLocations();
-      nifty.getResourceLoader().addResourceLocation(resourceLocation);
+            final AssetManager assetManager,
+            final InputManager inputManager,
+            final AudioRenderer audioRenderer,
+            final ViewPort viewport,
+            final int atlasWidth,
+            final int atlasHeight) {
+        // The code duplication in here really sucks - it's a copy of the
+        // private constructor below that takes a BatchRenderConfiguration as an
+        // additional parameter. This method should really be removed soon and
+        // users should simply call the new factory methods.
+        //
+        // For now, I keep this constructor as-is, but have marked it as deprecated
+        // to allow migration to the new way to instantiate this class.
+        initialize(assetManager, inputManager, audioRenderer, viewport);
+
+        this.renderDev = null;
+        this.batchRendererBackend = new JmeBatchRenderBackend(this);
+
+        BatchRenderConfiguration batchRenderConfiguration = new BatchRenderConfiguration();
+        batchRenderConfiguration.atlasWidth = atlasWidth;
+        batchRenderConfiguration.atlasHeight = atlasHeight;
+
+        nifty = new Nifty(
+                new BatchRenderDevice(batchRendererBackend, batchRenderConfiguration),
+                soundDev,
+                inputSys,
+                new AccurateTimeProvider());
+        inputSys.setNifty(nifty);
+
+        resourceLocation = new ResourceLocationJme();
+        nifty.getResourceLoader().removeAllResourceLocations();
+        nifty.getResourceLoader().addResourceLocation(resourceLocation);
     }
 
     private NiftyJmeDisplay(
-        final AssetManager assetManager,
-        final InputManager inputManager,
-        final AudioRenderer audioRenderer,
-        final ViewPort viewport,
-        final BatchRenderConfiguration batchRenderConfiguration) {
-      initialize(assetManager, inputManager, audioRenderer, viewport);
-
-      this.renderDev = null;
-      this.batchRendererBackend = new JmeBatchRenderBackend(this);
-
-      nifty = new Nifty(
-          new BatchRenderDevice(batchRendererBackend, batchRenderConfiguration),
-          soundDev,
-          inputSys,
-          new AccurateTimeProvider());
-      inputSys.setNifty(nifty);
-
-      resourceLocation = new ResourceLocationJme();
-      nifty.getResourceLoader().removeAllResourceLocations();
-      nifty.getResourceLoader().addResourceLocation(resourceLocation);
+            final AssetManager assetManager,
+            final InputManager inputManager,
+            final AudioRenderer audioRenderer,
+            final ViewPort viewport,
+            final BatchRenderConfiguration batchRenderConfiguration) {
+        initialize(assetManager, inputManager, audioRenderer, viewport);
+
+        this.renderDev = null;
+        this.batchRendererBackend = new JmeBatchRenderBackend(this);
+
+        nifty = new Nifty(
+                new BatchRenderDevice(batchRendererBackend, batchRenderConfiguration),
+                soundDev,
+                inputSys,
+                new AccurateTimeProvider());
+        inputSys.setNifty(nifty);
+
+        resourceLocation = new ResourceLocationJme();
+        nifty.getResourceLoader().removeAllResourceLocations();
+        nifty.getResourceLoader().addResourceLocation(resourceLocation);
     }
 
     /**
@@ -252,9 +252,9 @@ public class NiftyJmeDisplay implements SceneProcessor {
      * @param vp Viewport to use
      */
     public NiftyJmeDisplay(AssetManager assetManager,
-                           InputManager inputManager,
-                           AudioRenderer audioRenderer,
-                           ViewPort vp){
+            InputManager inputManager,
+            AudioRenderer audioRenderer,
+            ViewPort vp) {
         initialize(assetManager, inputManager, audioRenderer, vp);
 
         this.renderDev = new RenderDeviceJme(this);
@@ -269,25 +269,25 @@ public class NiftyJmeDisplay implements SceneProcessor {
     }
 
     private void initialize(
-        final AssetManager assetManager,
-        final InputManager inputManager,
-        final AudioRenderer audioRenderer,
-        final ViewPort viewport) {
-      this.assetManager = assetManager;
-      this.inputManager = inputManager;
-      this.w = viewport.getCamera().getWidth();
-      this.h = viewport.getCamera().getHeight();
-      this.soundDev = new SoundDeviceJme(assetManager, audioRenderer);
-      this.inputSys = new InputSystemJme(inputManager);
+            final AssetManager assetManager,
+            final InputManager inputManager,
+            final AudioRenderer audioRenderer,
+            final ViewPort viewport) {
+        this.assetManager = assetManager;
+        this.inputManager = inputManager;
+        this.w = viewport.getCamera().getWidth();
+        this.h = viewport.getCamera().getHeight();
+        this.soundDev = new SoundDeviceJme(assetManager, audioRenderer);
+        this.inputSys = new InputSystemJme(inputManager);
     }
 
     @Override
     public void initialize(RenderManager rm, ViewPort vp) {
         this.renderManager = rm;
         if (renderDev != null) {
-          renderDev.setRenderManager(rm);
+            renderDev.setRenderManager(rm);
         } else {
-          batchRendererBackend.setRenderManager(rm);
+            batchRendererBackend.setRenderManager(rm);
         }
 
         if (inputManager != null) {
@@ -306,7 +306,7 @@ public class NiftyJmeDisplay implements SceneProcessor {
         return nifty;
     }
 
-    public void simulateKeyEvent( KeyInputEvent event ) {
+    public void simulateKeyEvent(KeyInputEvent event) {
         inputSys.onKeyEvent(event);
     }
 
@@ -326,7 +326,7 @@ public class NiftyJmeDisplay implements SceneProcessor {
         return w;
     }
 
-    Renderer getRenderer(){
+    Renderer getRenderer() {
         return renderer;
     }
 
@@ -373,5 +373,4 @@ public class NiftyJmeDisplay implements SceneProcessor {
     public void setProfiler(AppProfiler profiler) {
         // not implemented
     }
-
 }

+ 7 - 7
jme3-niftygui/src/main/java/com/jme3/niftygui/RenderFontJme.java

@@ -54,14 +54,14 @@ public class RenderFontJme implements RenderFont {
     }
 
     public BitmapText createText() {
-      return new BitmapText(font);
+        return new BitmapText(font);
     }
 
     public BitmapFont getFont() {
         return font;
     }
 
-    public BitmapText getText(){
+    public BitmapText getText() {
         return text;
     }
 
@@ -101,11 +101,11 @@ public class RenderFontJme implements RenderFont {
 
     @Override
     public int getWidth(final String str, final float size) {
-      // Note: This is supposed to return the width of the String when scaled
-      //       with the size factor. Since I don't know how to do that with
-      //       the font rendering in jme this will only work correctly with
-      //       a size value of 1.f and will return inaccurate values otherwise.
-      return getWidth(str);
+        // Note: This is supposed to return the width of the String when scaled
+        //       with the size factor. Since I don't know how to do that with
+        //       the font rendering in jme this will only work correctly with
+        //       a size value of 1.f and will return inaccurate values otherwise.
+        return getWidth(str);
     }
 
     /**

+ 3 - 3
jme3-niftygui/src/main/java/com/jme3/niftygui/RenderImageJme.java

@@ -45,7 +45,7 @@ public class RenderImageJme implements RenderImage {
     private int width;
     private int height;
 
-    public RenderImageJme(String filename, boolean linear, NiftyJmeDisplay display){
+    public RenderImageJme(String filename, boolean linear, NiftyJmeDisplay display) {
         TextureKey key = new TextureKey(filename, true);
 
         key.setAnisotropy(0);
@@ -60,7 +60,7 @@ public class RenderImageJme implements RenderImage {
         height = image.getHeight();
     }
 
-    public RenderImageJme(Texture2D texture){
+    public RenderImageJme(Texture2D texture) {
         if (texture.getImage() == null) {
             throw new IllegalArgumentException("texture.getImage() cannot be null");
         }
@@ -71,7 +71,7 @@ public class RenderImageJme implements RenderImage {
         height = image.getHeight();
     }
 
-    public Texture2D getTexture(){
+    public Texture2D getTexture() {
         return texture;
     }
 

+ 1 - 2
jme3-niftygui/src/main/java/com/jme3/niftygui/SoundDeviceJme.java

@@ -45,7 +45,7 @@ public class SoundDeviceJme implements SoundDevice {
     protected AssetManager assetManager;
     protected AudioRenderer ar;
 
-    public SoundDeviceJme(AssetManager assetManager, AudioRenderer ar){
+    public SoundDeviceJme(AssetManager assetManager, AudioRenderer ar) {
         this.assetManager = assetManager;
         this.ar = ar;
     }
@@ -69,5 +69,4 @@ public class SoundDeviceJme implements SoundDevice {
     @Override
     public void update(int delta) {
     }
-
 }

+ 5 - 5
jme3-niftygui/src/main/java/com/jme3/niftygui/SoundHandleJme.java

@@ -80,23 +80,23 @@ public class SoundHandleJme implements SoundHandle {
 
     @Override
     public void play() {
-        if (fileName != null){
-            if (node != null){
+        if (fileName != null) {
+            if (node != null) {
                 node.stop();
             }
 
-            node = new AudioNode(am, fileName,AudioData.DataType.Stream);
+            node = new AudioNode(am, fileName, AudioData.DataType.Stream);
             node.setPositional(false);
             node.setVolume(volume);
             node.play();
-        }else{
+        } else {
             node.playInstance();
         }
     }
 
     @Override
     public void stop() {
-        if (node != null){
+        if (node != null) {
             node.stop();
             // Do not nullify the node for non-streaming nodes!
             if (fileName != null) {