Commits

Michael Ludwig committed 3f4315a

Fix LWJGL scroll event reporting.
Fix JOGL's reporting of the CMD key.

  • Participants
  • Parent commits 73cc624

Comments (0)

Files changed (4)

ferox-renderer-jogl/src/main/java/com/ferox/renderer/impl/jogl/NEWTEventAdapter.java

             return KeyCode.NUMPAD_MULTIPLY;
 
         case com.jogamp.newt.event.KeyEvent.VK_ALT:
-            // as far as I can tell NEWT does not provide locations
             return KeyCode.LEFT_ALT;
+        case com.jogamp.newt.event.KeyEvent.VK_ALT_GRAPH:
+            return KeyCode.RIGHT_ALT;
         case com.jogamp.newt.event.KeyEvent.VK_CONTROL:
             return KeyCode.LEFT_CONTROL;
         case com.jogamp.newt.event.KeyEvent.VK_SHIFT:
             return KeyCode.LEFT_SHIFT;
         case com.jogamp.newt.event.KeyEvent.VK_META:
+        case com.jogamp.newt.event.KeyEvent.VK_WINDOWS:
             return KeyCode.LEFT_META;
         default:
             return KeyCode.UNKNOWN;
             return MouseButton.NONE;
         case com.jogamp.newt.event.MouseEvent.BUTTON1:
             return MouseButton.LEFT;
+        case com.jogamp.newt.event.MouseEvent.BUTTON3:
+            return MouseButton.RIGHT;
         case com.jogamp.newt.event.MouseEvent.BUTTON2:
-            return MouseButton.RIGHT;
-        case com.jogamp.newt.event.MouseEvent.BUTTON3:
             return MouseButton.CENTER;
         default:
             throw new IllegalArgumentException("Unknown NEWT button code");

ferox-renderer-jogl/src/test/java/com/ferox/renderer/impl/jogl/JoglInputTest.java

+package com.ferox.renderer.impl.jogl;
+
+import com.ferox.input.KeyEvent;
+import com.ferox.input.KeyListener;
+import com.ferox.input.MouseEvent;
+import com.ferox.input.MouseListener;
+import com.ferox.renderer.Framework;
+import com.ferox.renderer.OnscreenSurface;
+import com.ferox.renderer.OnscreenSurfaceOptions;
+
+/**
+ *
+ */
+public class JoglInputTest implements KeyListener, MouseListener {
+    public static void main(String[] args) throws Exception {
+        Framework f = Framework.Factory.create();
+        OnscreenSurface s = f.createSurface(new OnscreenSurfaceOptions());
+        s.addKeyListener(new JoglInputTest());
+        s.addMouseListener(new JoglInputTest());
+
+        try {
+            while (!s.isDestroyed()) {
+                Thread.sleep(100);
+            }
+        } finally {
+            f.destroy();
+        }
+    }
+
+    @Override
+    public void handleEvent(KeyEvent event) {
+        System.out.println(event);
+    }
+
+    @Override
+    public void handleEvent(MouseEvent event) {
+        System.out.println(event);
+    }
+}

ferox-renderer-lwjgl/src/main/java/com/ferox/renderer/impl/lwjgl/LwjglInputEventAdapter.java

             int scrollDelta = Mouse.getEventDWheel();
             if (scrollDelta != 0) {
                 // push a mouse-wheel-scroll event
-                dispatcher.dispatchEvent(
-                        new MouseEvent(MouseEvent.Type.SCROLL, source, x, y, 0, MouseEvent.MouseButton.NONE));
+                dispatcher.dispatchEvent(new MouseEvent(MouseEvent.Type.SCROLL, source, x, y, scrollDelta,
+                                                        MouseEvent.MouseButton.NONE));
             }
 
             switch (Mouse.getEventButton()) {

ferox-renderer-lwjgl/src/test/java/com/ferox/renderer/impl/lwjgl/LwjglInputTest.java

+package com.ferox.renderer.impl.lwjgl;
+
+import com.ferox.input.KeyEvent;
+import com.ferox.input.KeyListener;
+import com.ferox.input.MouseEvent;
+import com.ferox.input.MouseListener;
+import com.ferox.renderer.Framework;
+import com.ferox.renderer.OnscreenSurface;
+import com.ferox.renderer.OnscreenSurfaceOptions;
+
+/**
+ *
+ */
+public class LwjglInputTest implements KeyListener, MouseListener {
+    public static void main(String[] args) throws Exception {
+        Framework f = Framework.Factory.create();
+        OnscreenSurface s = f.createSurface(new OnscreenSurfaceOptions());
+        s.addKeyListener(new LwjglInputTest());
+        s.addMouseListener(new LwjglInputTest());
+
+        try {
+            while (!s.isDestroyed()) {
+                Thread.sleep(100);
+            }
+        } finally {
+            f.destroy();
+        }
+    }
+
+    @Override
+    public void handleEvent(KeyEvent event) {
+        System.out.println(event);
+    }
+
+    @Override
+    public void handleEvent(MouseEvent event) {
+        System.out.println(event);
+    }
+}