Prechádzať zdrojové kódy

resolve deprecation warnings in jme3-niftygui

Stephen Gold 7 rokov pred
rodič
commit
9675d52745

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

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2012 jMonkeyEngine
+ * Copyright (c) 2009-2018 jMonkeyEngine
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -179,7 +179,7 @@ public class InputSystemJme implements InputSystem, RawInputListener {
     }
 
     private void onTouchEventQueued(TouchEvent evt, NiftyInputConsumer nic) {
-        if (inputManager.getSimulateMouse()) {
+        if (inputManager.isSimulateMouse()) {
             return;
         }
 
@@ -311,7 +311,7 @@ public class InputSystemJme implements InputSystem, RawInputListener {
                 final TextField textField = element.getNiftyControl(TextField.class);
                 if (textField != null) {
                     Logger.getLogger(InputSystemJme.class.getName()).log(Level.FINE, "Current TextField: {0}", textField.getId());
-                    String initialValue = textField.getText();
+                    String initialValue = textField.getRealText();
                     if (initialValue == null) {
                         initialValue = "";
                     }

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

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2012 jMonkeyEngine
+ * Copyright (c) 2009-2018 jMonkeyEngine
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -219,7 +219,7 @@ public class JmeBatchRenderBackend implements BatchRenderBackend {
 
   @Override
   public Image loadImage(final ByteBuffer imageData, final int imageWidth, final int imageHeight) {
-    return new ImageImpl(new com.jme3.texture.Image(Format.RGBA8, imageWidth, imageHeight, imageData));
+    return new ImageImpl(new com.jme3.texture.Image(Format.RGBA8, imageWidth, imageHeight, imageData, ColorSpace.Linear));
   }
   
   @Override

+ 4 - 4
jme3-niftygui/src/main/java/com/jme3/niftygui/NiftyJmeDisplay.java

@@ -52,7 +52,7 @@ import com.jme3.texture.FrameBuffer;
 import de.lessvoid.nifty.Nifty;
 import de.lessvoid.nifty.render.batch.BatchRenderConfiguration;
 import de.lessvoid.nifty.render.batch.BatchRenderDevice;
-import de.lessvoid.nifty.tools.TimeProvider;
+import de.lessvoid.nifty.spi.time.impl.AccurateTimeProvider;
 import de.lessvoid.nifty.tools.resourceloader.ResourceLocation;
 
 public class NiftyJmeDisplay implements SceneProcessor {
@@ -210,7 +210,7 @@ public class NiftyJmeDisplay implements SceneProcessor {
           new BatchRenderDevice(batchRendererBackend, batchRenderConfiguration),
           soundDev,
           inputSys,
-          new TimeProvider());
+          new AccurateTimeProvider());
       inputSys.setNifty(nifty);
 
       resourceLocation = new ResourceLocationJme();
@@ -233,7 +233,7 @@ public class NiftyJmeDisplay implements SceneProcessor {
           new BatchRenderDevice(batchRendererBackend, batchRenderConfiguration),
           soundDev,
           inputSys,
-          new TimeProvider());
+          new AccurateTimeProvider());
       inputSys.setNifty(nifty);
 
       resourceLocation = new ResourceLocationJme();
@@ -259,7 +259,7 @@ public class NiftyJmeDisplay implements SceneProcessor {
         this.renderDev = new RenderDeviceJme(this);
         this.batchRendererBackend = null;
 
-        nifty = new Nifty(renderDev, soundDev, inputSys, new TimeProvider());
+        nifty = new Nifty(renderDev, soundDev, inputSys, new AccurateTimeProvider());
         inputSys.setNifty(nifty);
 
         resourceLocation = new ResourceLocationJme();

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

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2012 jMonkeyEngine
+ * Copyright (c) 2009-2018 jMonkeyEngine
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -32,6 +32,7 @@
 package com.jme3.niftygui;
 
 import com.jme3.asset.AssetManager;
+import com.jme3.audio.AudioData;
 import com.jme3.audio.AudioNode;
 import com.jme3.audio.AudioRenderer;
 import de.lessvoid.nifty.sound.SoundSystem;
@@ -53,7 +54,7 @@ public class SoundDeviceJme implements SoundDevice {
     }
 
     public SoundHandle loadSound(SoundSystem soundSystem, String filename) {
-        AudioNode an = new AudioNode(assetManager, filename, false);
+        AudioNode an = new AudioNode(assetManager, filename, AudioData.DataType.Buffer);
         an.setPositional(false);
         return new SoundHandleJme(ar, an);
     }

+ 3 - 2
jme3-niftygui/src/main/java/com/jme3/niftygui/SoundHandleJme.java

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2012 jMonkeyEngine
+ * Copyright (c) 2009-2018 jMonkeyEngine
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -32,6 +32,7 @@
 package com.jme3.niftygui;
 
 import com.jme3.asset.AssetManager;
+import com.jme3.audio.AudioData;
 import com.jme3.audio.AudioNode;
 import com.jme3.audio.AudioSource.Status;
 import com.jme3.audio.AudioRenderer;
@@ -77,7 +78,7 @@ public class SoundHandleJme implements SoundHandle {
                 node.stop();
             }
 
-            node = new AudioNode(am, fileName, true);
+            node = new AudioNode(am, fileName,AudioData.DataType.Stream);
             node.setPositional(false);
             node.setVolume(volume);
             node.play();