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


Java TouchEvent.getY方法代码示例

本文整理汇总了Java中com.jme3.input.event.TouchEvent.getY方法的典型用法代码示例。如果您正苦于以下问题:Java TouchEvent.getY方法的具体用法?Java TouchEvent.getY怎么用?Java TouchEvent.getY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jme3.input.event.TouchEvent的用法示例。


在下文中一共展示了TouchEvent.getY方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: androidTouchUpEvent

import com.jme3.input.event.TouchEvent; //导入方法依赖的package包/类
private void androidTouchUpEvent(TouchEvent evt) {
	Element target = eventElements.get(evt.getPointerId());
	if (target != null) {
		if (target instanceof MouseButtonListener) {
			MouseButtonEvent mbEvt = new MouseButtonEvent(0, true, (int)evt.getX(), (int)evt.getY());
			((MouseButtonListener)target).onMouseLeftReleased(mbEvt);
		}
		if (target instanceof TouchListener) {
			((TouchListener)target).onTouchUp(evt);
		}
		if (!(target.getAbsoluteParent() instanceof AutoHide)) {
			handleAndroidMenuState(target);
		}
		if (target != null)
			evt.setConsumed();
		eventElements.remove(evt.getPointerId());
		contactElements.remove(evt.getPointerId());
		elementOffsets.remove(evt.getPointerId());
		eventElementResizeDirections.remove(evt.getPointerId());
	} else
		handleMenuState();
	mousePressed = false;
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:24,代码来源:SubScreen.java

示例2: onTouchDown

import com.jme3.input.event.TouchEvent; //导入方法依赖的package包/类
@Override
public void onTouchDown(TouchEvent evt) {
	if (screen.getAnimManager().hasGameTimer(flingTimer)) {
		flingTimer.endGameTimer();
		screen.getAnimManager().removeGameTimer(flingTimer);
	}
	if (flingEnabled) {
		touchStartY = getScrollableAreaVerticalPosition();
		touchOffsetY = evt.getY() - touchStartY;
	}
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:12,代码来源:ScrollPanel.java

示例3: onTouchMove

import com.jme3.input.event.TouchEvent; //导入方法依赖的package包/类
@Override
public void onTouchMove(TouchEvent evt) {
	if (flingEnabled) {
		float nextY = evt.getY() - touchOffsetY;
		if (nextY <= getScrollableAreaHeight() && nextY >= innerBounds.getHeight()) {
			scrollYTo(nextY);
			setVThumbPositionToScrollArea();
			touchEndY = getScrollableAreaVerticalPosition();
		}
	}
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:12,代码来源:ScrollPanel.java

示例4: onTouchEvent

import com.jme3.input.event.TouchEvent; //导入方法依赖的package包/类
@Override
public void onTouchEvent(TouchEvent te) {
    if (!isEnabled()) {
        return;
    }
    PointerData pointerData;
    switch (te.getType()) {
        case DOWN:
            pointerData = getPointerData(
                    te.getPointerId(), (int)te.getX(), (int)te.getY());
            if (dispatchButton(pointerData, true)) {
                te.setConsumed();
            }
            break;
        case MOVE:
            pointerData = pointerDataMap.get(te.getPointerId());
            if (pointerData != null) {
                pointerData.lastX = (int)te.getX();
                pointerData.lastY = (int)te.getY();
            }
            break;
        case UP:
            pointerData = pointerDataMap.get(te.getPointerId());
            if (pointerData != null) {
                pointerData.lastX = (int)te.getX();
                pointerData.lastY = (int)te.getY();
                if (dispatchButton(pointerData, false)) {
                    te.setConsumed();
                }
                pointerDataMap.remove(te.getPointerId());
            }
            break;
        default:
            break;
    }
}
 
开发者ID:jMonkeyEngine-Contributions,项目名称:Lemur,代码行数:37,代码来源:TouchAppState.java

示例5: onTouchDown

import com.jme3.input.event.TouchEvent; //导入方法依赖的package包/类
@Override
public void onTouchDown(TouchEvent evt) {
	if (screen.getAnimManager().hasGameTimer(flingTimer)) {
		flingTimer.endGameTimer();
		screen.getAnimManager().removeGameTimer(flingTimer);
	}
	if (flingEnabled) {
		touchStartY = getScrollableAreaVerticalPosition();
		touchOffsetY = evt.getY()-touchStartY;
	}
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:12,代码来源:ScrollPanel.java

示例6: onTouchMove

import com.jme3.input.event.TouchEvent; //导入方法依赖的package包/类
@Override
public void onTouchMove(TouchEvent evt) {
	if (flingEnabled) {
		float nextY = evt.getY()-touchOffsetY;
		if (nextY <= getScrollableAreaHeight() && nextY >= innerBounds.getHeight()) {
			scrollYTo(nextY);
			setVThumbPositionToScrollArea();
			touchEndY = getScrollableAreaVerticalPosition();
		}
	}
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:12,代码来源:ScrollPanel.java

示例7: onTouchDown

import com.jme3.input.event.TouchEvent; //导入方法依赖的package包/类
@Override
public void onTouchDown(TouchEvent evt) {
	if (screen.getAnimManager().hasGameTimer(flingTimer)) {
		flingTimer.endGameTimer();
		screen.getAnimManager().removeGameTimer(flingTimer);
	}
	if (flingEnabled) {
		touchStartY = getScrollablePosition();
		touchOffsetY = evt.getY()-touchStartY;
	}
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:12,代码来源:ScrollArea.java

示例8: onTouchMove

import com.jme3.input.event.TouchEvent; //导入方法依赖的package包/类
@Override
public void onTouchMove(TouchEvent evt) {
	if (flingEnabled) {
		float nextY = evt.getY()-touchOffsetY;
		if (nextY <= getScrollableHeight() && nextY >= getHeight()-(this.getPadding())) {
			scrollYTo(nextY);
			vScrollBar.setThumbByPosition();
			touchEndY = getScrollablePosition();
		}
	}
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:12,代码来源:ScrollArea.java

示例9: 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

示例10: onTouch

import com.jme3.input.event.TouchEvent; //导入方法依赖的package包/类
@Override
public void onTouch(String name, TouchEvent e, float tpf) {
    Logger.getLogger("Fruity").log(Level.WARNING, "TouchEvent received");
    int width = scene.getApp().getContext().getSettings().getWidth();
    int height = scene.getApp().getContext().getSettings().getHeight();
    float x = e.getX();
    float y = e.getY();
    String identifier = "";

    if (x > width / 3 && x < width * 2 / 3
            && y > height / 3 && y <= height * 2 / 3) {
        scene.plantBomb();
    }
    if (y >= height / 3 && y <= (height * 2 / 3)) {// left or right
        if (x < width / 3) {// left
            identifier = "CharLeft";
        } else if (x > width * 2 / 3) {//right
            identifier = "CharRight";
        }
    } else if (y > height / 3) {//Up
        identifier = "CharUp";
    } else {//Down
        identifier = "CharDown";
    }

    switch (e.getType()) {
        case DOWN:
            Logger.getLogger("Fruity").log(Level.WARNING, "TouchEvent is DOWN");
            Logger.getLogger("Fruity").log(Level.WARNING, "identifier: {0}", identifier);

            onAction(identifier, true, tpf);
            break;
        case UP:
            Logger.getLogger("Fruity").log(Level.WARNING, "TouchEvent is UP");
            Logger.getLogger("Fruity").log(Level.WARNING, "identifier: {0}", identifier);

            walkDirection.set(0f, 0f, 0f);
            saChar.setWalkDirection(walkDirection);
            onAction(identifier, false, tpf);
            break;
    }

    e.setConsumed();
}
 
开发者ID:damhonglinh,项目名称:Fruity-Bang,代码行数:45,代码来源:Sa.java


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