Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jme3-lwjgl3/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ if (!hasProperty('mainClass')) {
ext.mainClass = ''
}

def lwjglVersion = '3.1.5'
def lwjglVersion = '3.1.6'

sourceCompatibility = '1.8'

Expand Down
11 changes: 5 additions & 6 deletions jme3-lwjgl3/src/main/java/com/jme3/input/lwjgl/GlfwKeyInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,16 @@

package com.jme3.input.lwjgl;

import static org.lwjgl.glfw.GLFW.*;
import com.jme3.input.KeyInput;
import com.jme3.input.RawInputListener;
import com.jme3.input.event.KeyInputEvent;
import com.jme3.system.lwjgl.LwjglWindow;
import org.lwjgl.glfw.GLFWCharCallback;
import org.lwjgl.glfw.GLFWKeyCallback;

import java.util.LinkedList;
import java.util.ArrayDeque;
import java.util.Queue;
import java.util.logging.Logger;
import static org.lwjgl.glfw.GLFW.*;
import org.lwjgl.glfw.GLFWCharCallback;
import org.lwjgl.glfw.GLFWKeyCallback;

/**
* The LWJGL implementation of {@link KeyInput}.
Expand All @@ -54,7 +53,7 @@ public class GlfwKeyInput implements KeyInput {
/**
* The queue of key events.
*/
private final Queue<KeyInputEvent> keyInputEvents = new LinkedList<>();
private final Queue<KeyInputEvent> keyInputEvents = new ArrayDeque<>();

/**
* The LWJGL context.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,24 @@
*/
package com.jme3.input.lwjgl;

import static org.lwjgl.glfw.GLFW.*;
import com.jme3.cursors.plugins.JmeCursor;
import com.jme3.input.MouseInput;
import com.jme3.input.RawInputListener;
import com.jme3.input.event.MouseButtonEvent;
import com.jme3.input.event.MouseMotionEvent;
import com.jme3.system.lwjgl.LwjglWindow;
import com.jme3.util.BufferUtils;
import org.lwjgl.glfw.*;
import org.lwjgl.system.MemoryStack;
import org.lwjgl.system.MemoryUtil;

import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.util.ArrayDeque;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.Queue;
import java.util.logging.Logger;
import org.lwjgl.glfw.*;
import static org.lwjgl.glfw.GLFW.*;
import org.lwjgl.system.MemoryStack;
import org.lwjgl.system.MemoryUtil;

/**
* Captures mouse input using GLFW callbacks. It then temporarily stores these
Expand Down Expand Up @@ -110,8 +109,8 @@ private static ByteBuffer transformCursorImage(final IntBuffer imageData, final

private final Map<JmeCursor, long[]> jmeToGlfwCursorMap = new HashMap<>();

private final Queue<MouseMotionEvent> mouseMotionEvents = new LinkedList<>();
private final Queue<MouseButtonEvent> mouseButtonEvents = new LinkedList<>();
private final Queue<MouseMotionEvent> mouseMotionEvents = new ArrayDeque<>();
private final Queue<MouseButtonEvent> mouseButtonEvents = new ArrayDeque<>();

private final LwjglWindow context;

Expand Down
18 changes: 11 additions & 7 deletions jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@

package com.jme3.system.lwjgl;

import static org.lwjgl.glfw.GLFW.*;
import static org.lwjgl.opengl.GL11.GL_FALSE;
import static org.lwjgl.system.MemoryUtil.NULL;
import com.jme3.input.JoyInput;
import com.jme3.input.KeyInput;
import com.jme3.input.MouseInput;
Expand All @@ -47,9 +44,6 @@
import com.jme3.system.JmeSystem;
import com.jme3.system.NanoTimer;
import com.jme3.util.BufferUtils;
import org.lwjgl.Version;
import org.lwjgl.glfw.*;

import java.awt.*;
import java.awt.image.BufferedImage;
import java.nio.ByteBuffer;
Expand All @@ -59,6 +53,11 @@
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.lwjgl.Version;
import org.lwjgl.glfw.*;
import static org.lwjgl.glfw.GLFW.*;
import static org.lwjgl.opengl.GL11.GL_FALSE;
import static org.lwjgl.system.MemoryUtil.NULL;

/**
* A wrapper class over the GLFW framework in LWJGL 3.
Expand Down Expand Up @@ -383,6 +382,10 @@ protected void destroyContext() {
}

if (errorCallback != null) {

// We need to specifically set this to null as we might set a new callback before we reinit GLFW
glfwSetErrorCallback(null);

errorCallback.close();
errorCallback = null;
}
Expand All @@ -401,6 +404,8 @@ protected void destroyContext() {
glfwDestroyWindow(window);
window = NULL;
}

glfwTerminate();
} catch (final Exception ex) {
listener.handleError("Failed to destroy context", ex);
}
Expand Down Expand Up @@ -548,7 +553,6 @@ private void setFrameRateLimit(int frameRateLimit) {
/**
* De-initialize in the OpenGL thread.
*/

protected void deinitInThread() {
listener.destroy();

Expand Down