فهرست منبع

Turns out I did things a bit wrong with respect to the new nifty mouse even queue....
I called stuff that was meant to be internal to nifty. That's fixed now. Also had to replace the nifty examples jar with a new version. This version os BIG (15Mb). Void is working on a smaller one, but at least with this big one, things work as expected.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7117 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

rac..om 14 سال پیش
والد
کامیت
5ae44319ea

BIN
engine/lib/niftygui/nifty-examples-1.3-SNAPSHOT.jar


+ 5 - 16
engine/src/niftygui/com/jme3/niftygui/InputSystemJme.java

@@ -56,6 +56,7 @@ public class InputSystemJme implements InputSystem, RawInputListener {
     private InputManager inputManager;
 
     private boolean pressed = false;
+    private int buttonIndex;
     private int x, y;
     private int height;
 
@@ -64,6 +65,7 @@ public class InputSystemJme implements InputSystem, RawInputListener {
 
     private Nifty nifty;
 
+
     public InputSystemJme(InputManager inputManager){
         this.inputManager = inputManager;
     }
@@ -101,13 +103,7 @@ public class InputSystemJme implements InputSystem, RawInputListener {
     private void onMouseMotionEventQueued(MouseMotionEvent evt, NiftyInputConsumer nic) {
         x = evt.getX();
         y = height - evt.getY();
-        MouseInputEventQueue niftyEvtQueue = nifty.getMouseInputEventQueue();
-        NiftyMouseInputEvent niftyEvt = new NiftyMouseInputEvent();
-        if (niftyEvtQueue.hasLastMouseDownEvent()) {
-            niftyEvt = niftyEvtQueue.getLastMouseDownEvent();
-        }
-        niftyEvt.initialize(x, y, evt.getDeltaWheel(), niftyEvt.isButton0Down(), niftyEvt.isButton1Down(), niftyEvt.isButton2Down());
-        niftyEvtQueue.process(niftyEvt);
+        nic.processMouseEvent(x, y, evt.getDeltaWheel(), buttonIndex, pressed);
         //MouseInputEvent niftyEvt = new MouseInputEvent(x, y, pressed);
 //        if (nic.processMouseEvent(niftyEvt) /*|| nifty.getCurrentScreen().isMouseOverElement()*/){
             // Do not consume motion events
@@ -126,16 +122,9 @@ public class InputSystemJme implements InputSystem, RawInputListener {
     }
 
     private void onMouseButtonEventQueued(MouseButtonEvent evt, NiftyInputConsumer nic) {
+        buttonIndex = evt.getButtonIndex();
         pressed = evt.isPressed();
-        MouseInputEventQueue niftyEvtQueue = nifty.getMouseInputEventQueue();
-        NiftyMouseInputEvent niftyEvt = new NiftyMouseInputEvent();
-        if (niftyEvtQueue.hasLastMouseDownEvent()) {
-            niftyEvt = niftyEvtQueue.getLastMouseDownEvent();
-        }
-        niftyEvt.initialize(x, y, 0, evt.getButtonIndex() == 0 && evt.isPressed(), evt.getButtonIndex() == 1
-                && evt.isPressed(), evt.getButtonIndex() == 2 && evt.isPressed());
-        niftyEvtQueue.process(niftyEvt);
-
+        nic.processMouseEvent(x, y, 0, buttonIndex, pressed);
 //        MouseInputEvent niftyEvt = new MouseInputEvent(x, y, pressed);
 //        if (nic.processMouseEvent(niftyEvt) /*|| nifty.getCurrentScreen().isMouseOverElement()*/){
             evt.setConsumed();