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
This commit is contained in:
parent
2bc7128eb6
commit
859123673e
@ -578,6 +578,10 @@ public class AndroidInput extends GLSurfaceView implements
|
|||||||
public void setSimulateMouse(boolean simulate) {
|
public void setSimulateMouse(boolean simulate) {
|
||||||
mouseEventsEnabled = simulate;
|
mouseEventsEnabled = simulate;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public boolean getSimulateMouse() {
|
||||||
|
return mouseEventsEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSimulateKeyboard(boolean simulate) {
|
public void setSimulateKeyboard(boolean simulate) {
|
||||||
|
@ -731,6 +731,17 @@ public class InputManager implements RawInputListener {
|
|||||||
touch.setSimulateMouse(value);
|
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.
|
* Enable simulation of keyboard events. Used for touchscreen input only.
|
||||||
|
@ -74,6 +74,12 @@ public interface TouchInput extends Input {
|
|||||||
*/
|
*/
|
||||||
public void setSimulateMouse(boolean simulate);
|
public void setSimulateMouse(boolean simulate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get if mouse events are generated
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public boolean getSimulateMouse();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set if keyboard events should be generated
|
* Set if keyboard events should be generated
|
||||||
*
|
*
|
||||||
|
@ -95,9 +95,10 @@ public class InputSystemJme implements InputSystem, RawInputListener {
|
|||||||
x = (int) evt.getX();
|
x = (int) evt.getX();
|
||||||
y = (int) (height - evt.getY());
|
y = (int) (height - evt.getY());
|
||||||
|
|
||||||
|
if (!inputManager.getSimulateMouse()) {
|
||||||
switch (evt.getType()) {
|
switch (evt.getType()) {
|
||||||
case DOWN:
|
case DOWN:
|
||||||
consumed = nic.processMouseEvent(x, y, 0, 0, false);
|
consumed = nic.processMouseEvent(x, y, 0, 0, true);
|
||||||
isDragging = true;
|
isDragging = true;
|
||||||
niftyOwnsDragging = consumed;
|
niftyOwnsDragging = consumed;
|
||||||
if (consumed){
|
if (consumed){
|
||||||
@ -108,7 +109,7 @@ public class InputSystemJme implements InputSystem, RawInputListener {
|
|||||||
|
|
||||||
case UP:
|
case UP:
|
||||||
if (niftyOwnsDragging){
|
if (niftyOwnsDragging){
|
||||||
consumed = nic.processMouseEvent(x, y, 0, buttonIndex, pressed);
|
consumed = nic.processMouseEvent(x, y, 0, 0, false);
|
||||||
if (consumed){
|
if (consumed){
|
||||||
evt.setConsumed();
|
evt.setConsumed();
|
||||||
}
|
}
|
||||||
@ -119,6 +120,7 @@ public class InputSystemJme implements InputSystem, RawInputListener {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void onMouseMotionEventQueued(MouseMotionEvent evt, NiftyInputConsumer nic) {
|
private void onMouseMotionEventQueued(MouseMotionEvent evt, NiftyInputConsumer nic) {
|
||||||
x = evt.getX();
|
x = evt.getX();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user