From ee58677ed9c47a3981c303776acb4822c114509b Mon Sep 17 00:00:00 2001 From: Stephen Gold Date: Wed, 17 Jan 2018 15:58:37 -0800 Subject: [PATCH] resolve deprecation warnings in jme3-niftygui --- .../src/main/java/com/jme3/niftygui/InputSystemJme.java | 6 +++--- .../java/com/jme3/niftygui/JmeBatchRenderBackend.java | 4 ++-- .../src/main/java/com/jme3/niftygui/NiftyJmeDisplay.java | 8 ++++---- .../src/main/java/com/jme3/niftygui/SoundDeviceJme.java | 5 +++-- .../src/main/java/com/jme3/niftygui/SoundHandleJme.java | 5 +++-- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/jme3-niftygui/src/main/java/com/jme3/niftygui/InputSystemJme.java b/jme3-niftygui/src/main/java/com/jme3/niftygui/InputSystemJme.java index d76fc0b20..b09956aaf 100644 --- a/jme3-niftygui/src/main/java/com/jme3/niftygui/InputSystemJme.java +++ b/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 = ""; } diff --git a/jme3-niftygui/src/main/java/com/jme3/niftygui/JmeBatchRenderBackend.java b/jme3-niftygui/src/main/java/com/jme3/niftygui/JmeBatchRenderBackend.java index 9dd831020..a8947fdea 100644 --- a/jme3-niftygui/src/main/java/com/jme3/niftygui/JmeBatchRenderBackend.java +++ b/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 diff --git a/jme3-niftygui/src/main/java/com/jme3/niftygui/NiftyJmeDisplay.java b/jme3-niftygui/src/main/java/com/jme3/niftygui/NiftyJmeDisplay.java index 8c9102ff0..435890151 100644 --- a/jme3-niftygui/src/main/java/com/jme3/niftygui/NiftyJmeDisplay.java +++ b/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(); diff --git a/jme3-niftygui/src/main/java/com/jme3/niftygui/SoundDeviceJme.java b/jme3-niftygui/src/main/java/com/jme3/niftygui/SoundDeviceJme.java index d7eeea71d..7868468e9 100644 --- a/jme3-niftygui/src/main/java/com/jme3/niftygui/SoundDeviceJme.java +++ b/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); } diff --git a/jme3-niftygui/src/main/java/com/jme3/niftygui/SoundHandleJme.java b/jme3-niftygui/src/main/java/com/jme3/niftygui/SoundHandleJme.java index 97f84bc56..545f3d201 100644 --- a/jme3-niftygui/src/main/java/com/jme3/niftygui/SoundHandleJme.java +++ b/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();