当前位置: 首页>>代码示例>>Java>>正文


Java TouchEvent.getDeltaY方法代码示例

本文整理汇总了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);
		}
	}
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:21,代码来源:Screen.java

示例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);
				}
			}
		}
	}
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:19,代码来源:Screen.java

示例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);
		}
	}
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:12,代码来源:ScrollPanel.java

示例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);
		}
	}
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:21,代码来源:BaseScreen.java

示例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);
	}
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:38,代码来源:BaseScreen.java

示例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);
		}
	}
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:12,代码来源:ScrollPanel.java

示例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);
	}
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:33,代码来源:Screen.java

示例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);
				}
			}
		}
	}
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:28,代码来源:SubScreen.java


注:本文中的com.jme3.input.event.TouchEvent.getDeltaY方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。