Committed patch from iwgEric that fixes a couple of issues on android touchinput http://jmonkeyengine.org/groups/android/forum/topic/error-with-nifty-and-awt/?topic_page=2#post-165433

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9226 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 13 years ago
parent 2bc7128eb6
commit 859123673e
  1. 4
      engine/src/android/com/jme3/input/android/AndroidInput.java
  2. 11
      engine/src/core/com/jme3/input/InputManager.java
  3. 6
      engine/src/core/com/jme3/input/TouchInput.java
  4. 6
      engine/src/niftygui/com/jme3/niftygui/InputSystemJme.java

@ -578,6 +578,10 @@ public class AndroidInput extends GLSurfaceView implements
public void setSimulateMouse(boolean simulate) {
mouseEventsEnabled = simulate;
}
@Override
public boolean getSimulateMouse() {
return mouseEventsEnabled;
}
@Override
public void setSimulateKeyboard(boolean simulate) {

@ -731,6 +731,17 @@ public class InputManager implements RawInputListener {
touch.setSimulateMouse(value);
}
}
/**
* Returns state of simulation of mouse events. Used for touchscreen input only.
*
*/
public boolean getSimulateMouse() {
if (touch != null) {
return touch.getSimulateMouse();
} else {
return false;
}
}
/**
* Enable simulation of keyboard events. Used for touchscreen input only.

@ -74,6 +74,12 @@ public interface TouchInput extends Input {
*/
public void setSimulateMouse(boolean simulate);
/**
* Get if mouse events are generated
*
*/
public boolean getSimulateMouse();
/**
* Set if keyboard events should be generated
*

@ -95,9 +95,10 @@ public class InputSystemJme implements InputSystem, RawInputListener {
x = (int) evt.getX();
y = (int) (height - evt.getY());
if (!inputManager.getSimulateMouse()) {
switch (evt.getType()) {
case DOWN:
consumed = nic.processMouseEvent(x, y, 0, 0, false);
consumed = nic.processMouseEvent(x, y, 0, 0, true);
isDragging = true;
niftyOwnsDragging = consumed;
if (consumed){
@ -108,7 +109,7 @@ public class InputSystemJme implements InputSystem, RawInputListener {
case UP:
if (niftyOwnsDragging){
consumed = nic.processMouseEvent(x, y, 0, buttonIndex, pressed);
consumed = nic.processMouseEvent(x, y, 0, 0, false);
if (consumed){
evt.setConsumed();
}
@ -119,6 +120,7 @@ public class InputSystemJme implements InputSystem, RawInputListener {
break;
}
}
}
private void onMouseMotionEventQueued(MouseMotionEvent evt, NiftyInputConsumer nic) {
x = evt.getX();

Loading…
Cancel
Save