* @param evt The touch event to be dispatched to all onTouch listeners\r
*/\r
public void onTouchEventQueued(TouchEvent evt) { \r
- ArrayList<Mapping> maps = bindings.get(TouchTrigger.touchHash());\r
+ ArrayList<Mapping> maps = bindings.get(TouchTrigger.touchHash(evt.getKeyCode()));\r
if (maps == null) {\r
return;\r
}\r
public interface TouchInput extends Input {
/**
+ * No filter, get all events
+ */
+ public static final int ALL = 0x00;
+ /**
+ * Home key
+ */
+ public static final int KEYCODE_HOME = 0x03;
+ /**
+ * Escape key.
+ */
+ public static final int KEYCODE_BACK = 0x04;
+ /**
+ * Context Menu key.
+ */
+ public static final int KEYCODE_MENU = 0x52;
+ /**
+ * Search key.
+ */
+ public static final int KEYCODE_SEARCH = 0x54;
+ /**
+ * Volume up key.
+ */
+ public static final int KEYCODE_VOLUME_UP = 0x18;
+ /**
+ * Volume down key.
+ */
+ public static final int KEYCODE_VOLUME_DOWN = 0x19;
+
+
+ /**
* Set whether mouse events should be generated
*
- * @param simulate Whether mouse events should be generated
+ * @param simulate if mouse events should be generated
*/
public void setSimulateMouse(boolean simulate);
/**
* Set whether keyboard events should be generated
*
- * @param simulate Whether keyboard events should be generated
+ * @param simulate if keyboard events should be generated
*/
public void setSimulateKeyboard(boolean simulate);
package com.jme3.input.controls;
+/**
+ * Class to trigger TouchEvents, keycode can be TouchInput.ALL(=0) or TouchInput.KEYCODE_*
+ * @author larynx
+ *
+ */
public class TouchTrigger implements Trigger {
-
- public TouchTrigger() {
+
+ private final int keyCode;
+
+ /**
+ * Constructor
+ * @param keyCode can be zero to get all events or TouchInput.KEYCODE_*
+ */
+ public TouchTrigger(int keyCode) {
super();
+ this.keyCode = keyCode;
}
@Override
public String getName() {
- return "TouchInput";
+ if (keyCode != 0)
+ return "TouchInput";
+ else
+ return "TouchInput KeyCode " + keyCode;
}
- public static int touchHash(){
- return 0xfedcba98;
+ public static int touchHash(int keyCode){
+ assert keyCode >= 0 && keyCode <= 255;
+ return 0xfedcba98 + keyCode;
}
public int triggerHashCode() {
- return touchHash();
+ return touchHash(keyCode);
+ }
+
+ public int getKeyCode(){
+ return keyCode;
}
}
this.posY = y;
this.deltaX = deltax;
this.deltaY = deltay;
+ pointerId = 0;
+ pressure = 0;
+ keyCode = 0;
+ scaleFactor = 0;
+ scaleSpan = 0;
+ characters = "";
consumed = false;
}