本文整理汇总了Java中com.jme3.input.event.TouchEvent.getDeltaY方法的典型用法代码示例。如果您正苦于以下问题:Java TouchEvent.getDeltaY方法的具体用法?Java TouchEvent.getDeltaY怎么用?Java TouchEvent.getDeltaY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.input.event.TouchEvent
的用法示例。
在下文中一共展示了TouchEvent.getDeltaY方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: androidFlingEvent
import com.jme3.input.event.TouchEvent; //导入方法依赖的package包/类
/**
* This scales the current event values of deltaX and deltaY to a value between 0.0f and 1.0f
* @param evt
*/
private void androidFlingEvent(TouchEvent evt) {
setTouchXY(evt.getX(),evt.getY());
float flingX = 1f/8000f*evt.getDeltaX();
float flingY = 1f/8000f*evt.getDeltaY();
evt.set(evt.getType(), touchXY.x, touchXY.y, flingX, flingY);
Element contact = getContactElement(touchXY.x, touchXY.y, EventCheckType.Fling);
Vector2f offset = tempElementOffset.clone();
Element target = getEventElement(touchXY.x, touchXY.y, EventCheckType.Fling);
if (target != null) {
if (target instanceof FlingListener) {
((FlingListener)target).onFling(evt);
}
}
}
示例2: s3dOnTouchMoveEvent
import com.jme3.input.event.TouchEvent; //导入方法依赖的package包/类
private void s3dOnTouchMoveEvent(TouchEvent evt) {
float x = Screen.isAndroid() ? touchXY.x : mouseXY.x;
float y = Screen.isAndroid() ? touchXY.y : mouseXY.y;
for (Integer key : eventNodes.keySet()) {
if (key == evt.getPointerId()) {
Node target = eventNodes.get(key);
if (target != null) {
if (target instanceof MouseMovementListener) {
MouseMotionEvent mbEvt = new MouseMotionEvent((int)x,(int)y,(int)evt.getDeltaX(),(int)evt.getDeltaY(),0,0);
((MouseMovementListener)target).onMouseMove(mbEvt);
}
if (target instanceof TouchListener) {
((TouchListener)target).onTouchMove(evt);
}
}
}
}
}
示例3: onFling
import com.jme3.input.event.TouchEvent; //导入方法依赖的package包/类
@Override
public void onFling(TouchEvent evt) {
if (flingEnabled && (evt.getDeltaY() > 0.2f || evt.getDeltaY() < -0.2f)) {
if (!screen.getAnimManager().hasGameTimer(flingTimer)) {
flingTimer.reset(false);
flingDir = (evt.getDeltaY() < 0) ? true : false;
flingSpeed = FastMath.abs(evt.getDeltaY());
screen.getAnimManager().addGameTimer(flingTimer);
}
}
}
示例4: androidFlingEvent
import com.jme3.input.event.TouchEvent; //导入方法依赖的package包/类
/**
* This scales the current event values of deltaX and deltaY to a value
* between 0.0f and 1.0f
*
* @param evt
*/
private void androidFlingEvent(TouchEvent evt) {
setTouchXY(evt.getX(), evt.getY());
float flingX = 1f / 8000f * evt.getDeltaX();
float flingY = 1f / 8000f * evt.getDeltaY();
evt.set(evt.getType(), touchXY.x, touchXY.y, flingX, flingY);
BaseElement target = getEventElement(touchXY.x, touchXY.y, EventCheckType.Fling);
if (target != null) {
if (target instanceof FlingListener) {
((FlingListener) target).onFling(evt);
}
}
}
示例5: androidTouchMoveEvent
import com.jme3.input.event.TouchEvent; //导入方法依赖的package包/类
private void androidTouchMoveEvent(TouchEvent evt) {
// setTouchXY(evt.getX(),evt.getY());
for (Integer key : eventElements.keySet()) {
if (key == evt.getPointerId()) {
BaseElement target = eventElements.get(key);
if (target != null) {
BaseElement contact = contactElements.get(key);
Vector2f offset = elementOffsets.get(key);
Borders dir = eventElementResizeDirections.get(key);
boolean movable = contact.isMovable();
if (dir != null) {
resizeElement(target, touchXY.x, touchXY.y, dir);
} else if (movable) {
moveElement(target, touchXY.x - offset.x, touchXY.y - offset.y);
}
MouseUIMotionEvent<BaseElement> mbEvt = new MouseUIMotionEvent<BaseElement>(
new MouseMotionEvent((int) touchXY.x, (int) touchXY.y, (int) evt.getDeltaX(),
(int) evt.getDeltaY(), 0, 0),
target, keyboardModifiers);
if (target instanceof MouseMovementListener) {
((MouseMovementListener<UIEventTarget>) target)
.onMouseMove(new MouseUIMotionEvent<UIEventTarget>(mbEvt, target, keyboardModifiers));
}
eventCaster.fireMouseMotionEvent(target, mbEvt);
if (target instanceof TouchListener) {
((TouchListener) target).onTouchMove(evt);
}
}
}
}
if (use3DSceneSupport) {
s3dOnTouchMoveEvent(evt);
}
}
示例6: onFling
import com.jme3.input.event.TouchEvent; //导入方法依赖的package包/类
@Override
public void onFling(TouchEvent evt) {
if (flingEnabled && (evt.getDeltaY() > 0.2f || evt.getDeltaY() < -0.2f)) {
if (!screen.getAnimManager().hasGameTimer(flingTimer)) {
flingTimer.reset(false);
flingDir = (evt.getDeltaY() < 0) ? true : false;
flingSpeed = FastMath.abs(evt.getDeltaY());
screen.getAnimManager().addGameTimer(flingTimer);
}
}
}
示例7: androidTouchMoveEvent
import com.jme3.input.event.TouchEvent; //导入方法依赖的package包/类
private void androidTouchMoveEvent(TouchEvent evt) {
// setTouchXY(evt.getX(),evt.getY());
for (Integer key : eventElements.keySet()) {
if (key == evt.getPointerId()) {
Element target = eventElements.get(key);
if (target != null) {
Element contact = contactElements.get(key);
Vector2f offset = elementOffsets.get(key);
Borders dir = eventElementResizeDirections.get(key);
boolean movable = contact.getIsMovable();
if (dir != null) {
target.resize(touchXY.x, touchXY.y, dir);
} else if (movable) {
target.moveTo(touchXY.x-offset.x, touchXY.y-offset.y);
}
if (target instanceof MouseMovementListener) {
MouseMotionEvent mbEvt = new MouseMotionEvent((int)touchXY.x,(int)touchXY.y,(int)evt.getDeltaX(),(int)evt.getDeltaY(),0,0);
((MouseMovementListener)target).onMouseMove(mbEvt);
}
if (target instanceof TouchListener) {
((TouchListener)target).onTouchMove(evt);
}
}
}
}
if (use3DSceneSupport) {
s3dOnTouchMoveEvent(evt);
}
}
示例8: androidTouchMoveEvent
import com.jme3.input.event.TouchEvent; //导入方法依赖的package包/类
private void androidTouchMoveEvent(TouchEvent evt) {
for (Integer key : eventElements.keySet()) {
if (key == evt.getPointerId()) {
Element target = eventElements.get(key);
if (target != null) {
Element contact = contactElements.get(key);
Vector2f offset = elementOffsets.get(key);
Borders dir = eventElementResizeDirections.get(key);
boolean movable = contact.getIsMovable();
if (dir != null) {
target.resize(evt.getX(), evt.getY(), dir);
} else if (movable) {
target.moveTo(evt.getX()-offset.x, evt.getY()-offset.y);
}
if (target instanceof MouseMovementListener) {
MouseMotionEvent mbEvt = new MouseMotionEvent((int)evt.getX(),(int)evt.getY(),(int)evt.getDeltaX(),(int)evt.getDeltaY(),0,0);
((MouseMovementListener)target).onMouseMove(mbEvt);
}
if (target instanceof TouchListener) {
((TouchListener)target).onTouchMove(evt);
}
}
}
}
}