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


Java MouseMotionEvent.getX方法代码示例

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


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

示例1: onMouseMove

import com.jme3.input.event.MouseMotionEvent; //导入方法依赖的package包/类
@Override
public void onMouseMove(MouseMotionEvent evt) {
	if (!Screen.isAndroid()) {
		float x = evt.getX()-getX();
		float y = scrollableArea.getAbsoluteHeight()-menuPadding.z-evt.getY();

		if (currentMenuItemIndex != (int)Math.floor(y/menuItemHeight)) {
			currentMenuItemIndex = (int)Math.floor(y/menuItemHeight);

			if (currentMenuItemIndex > -1 && currentMenuItemIndex < menuItems.size()) {
				setHighlight(currentMenuItemIndex);
				this.hideAllSubmenus(false);
				Menu subMenu = menuItems.get(currentMenuItemIndex).getSubMenu();
				if (subMenu != null) {
					subMenu.showMenu(this, getAbsoluteWidth()-this.menuOverhang, scrollableArea.getAbsoluteHeight()-(menuItemHeight+(currentMenuItemIndex*menuItemHeight))-(subMenu.getHeight()-menuItemHeight));
				}
			}
		}
	}
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:21,代码来源:Menu.java

示例2: onMouseMove

import com.jme3.input.event.MouseMotionEvent; //导入方法依赖的package包/类
@Override
public void onMouseMove(MouseMotionEvent evt) {
    float x = evt.getX() - getX();
    float y = scrollableArea.getAbsoluteHeight() - tablePadding - (headersVisible ? headerHeight : 0) - evt.getY();

    for (int i = 0; i < columns.size(); i++) {
        TableColumn header = columns.get(i);
        if (x >= header.getX() && x <= header.getX() + header.getWidth()) {
            currentColumnIndex = i;
            break;
        }
    }
    if (currentRowIndex != (int) Math.floor(y / rowHeight)) {
        currentRowIndex = (int) Math.floor(y / rowHeight);
    }
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:17,代码来源:Table.java

示例3: onMouseMove

import com.jme3.input.event.MouseMotionEvent; //导入方法依赖的package包/类
@Override
public void onMouseMove(MouseMotionEvent evt) {
	if (mouseLook) {
		if (enabled) {
			if (evt.getY() > lastY)
				bridge.getChaseCamera().onAnalog("ChaseCamUp", -evt.getDY()*(bridge.getCurrentTPF()/2), bridge.getCurrentTPF());
			else
				bridge.getChaseCamera().onAnalog("ChaseCamDown", evt.getDY()*(bridge.getCurrentTPF()/2), bridge.getCurrentTPF());
			if (evt.getX() > lastX)
				bridge.getChaseCamera().onAnalog("ChaseCamMoveRight", evt.getDX()*(bridge.getCurrentTPF()/2), bridge.getCurrentTPF());
			else
				bridge.getChaseCamera().onAnalog("ChaseCamMoveLeft", -evt.getDX()*(bridge.getCurrentTPF()/2), bridge.getCurrentTPF());
		}
		lastX = evt.getX();
		lastY = evt.getY();
		evt.setConsumed();
	}
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:19,代码来源:OSRViewPort.java

示例4: onMouseMotionEventQueued

import com.jme3.input.event.MouseMotionEvent; //导入方法依赖的package包/类
private void onMouseMotionEventQueued(MouseMotionEvent evt, NiftyInputConsumer nic) {
        x = evt.getX();
        y = height - evt.getY();
        nic.processMouseEvent(x, y, evt.getDeltaWheel(), buttonIndex, pressed);
        //MouseInputEvent niftyEvt = new MouseInputEvent(x, y, pressed);
//        if (nic.processMouseEvent(niftyEvt) /*|| nifty.getCurrentScreen().isMouseOverElement()*/){
            // Do not consume motion events
            //evt.setConsumed();
//        }
    }
 
开发者ID:mleoking,项目名称:PhET,代码行数:11,代码来源:InputSystemJme.java

示例5: onMouseMove

import com.jme3.input.event.MouseMotionEvent; //导入方法依赖的package包/类
@Override
public void onMouseMove(MouseMotionEvent evt) {
	float x = evt.getX()-getX();
	float y = scrollableArea.getAbsoluteHeight()-listPadding-evt.getY();
	
	if (currentListItemIndex != (int)Math.floor(y/listItemHeight)) {
		currentListItemIndex = (int)Math.floor(y/listItemHeight);
	}
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:10,代码来源:SelectList.java

示例6: onMouseMotionEventQueued

import com.jme3.input.event.MouseMotionEvent; //导入方法依赖的package包/类
private void onMouseMotionEventQueued(MouseMotionEvent evt, NiftyInputConsumer nic) {
        x = evt.getX();
        y = height - evt.getY();
        nic.processMouseEvent(x, y, evt.getDeltaWheel(), buttonIndex, pressed);
//        if (nic.processMouseEvent(niftyEvt) /*|| nifty.getCurrentScreen().isMouseOverElement()*/){
            // Do not consume motion events
            //evt.setConsumed();
//        }
    }
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:10,代码来源:InputSystemJme.java

示例7: MouseUIMotionEvent

import com.jme3.input.event.MouseMotionEvent; //导入方法依赖的package包/类
public MouseUIMotionEvent(MouseMotionEvent originator, E element, int modifiers) {
	this(originator, element == null ? 0 : (int) (originator.getX() - element.getAbsoluteX()),
			element == null ? 0 : (int) (originator.getY() - element.getAbsoluteY()), element, modifiers);

}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:6,代码来源:MouseUIMotionEvent.java

示例8: onMouseMotionEvent

import com.jme3.input.event.MouseMotionEvent; //导入方法依赖的package包/类
public void onMouseMotionEvent(MouseMotionEvent mme) {
    mouseX = mme.getX();
    mouseY = mme.getY();
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:5,代码来源:AbstractCameraController.java

示例9: onMouseMotionEvent

import com.jme3.input.event.MouseMotionEvent; //导入方法依赖的package包/类
@Override
public void onMouseMotionEvent(MouseMotionEvent evt, SandboxViewport viewport) {
    if (currentState == RotateState.IDLE) {
        return;
    }
    Vector2f screenCoords = new Vector2f(evt.getX(), evt.getY());
    Camera cam = viewport.getCamera();
    Vector3f p1 = cam.getWorldCoordinates(screenCoords, 0.01f);
    Vector3f p2 = cam.getWorldCoordinates(screenCoords, 0.95f);
    Vector3f pa = new Vector3f();
    Vector3f pb = new Vector3f();
    Vector2f t = new Vector2f();
    if (RayIntersect.rayIntersect(p1, p2, pickOffset, pickOffset.add(rotationDir), pa, pb, t)) {

        float projectedLength = pb.distance(pickOffset) * 100.0f;
        if (pb.subtract(pickOffset).dot(rotationDir) > 0) {
            projectedLength = -projectedLength;
        }

        Vector3f axis = null;
        switch (currentState) {
            case ROTATEX:
                axis = Vector3f.UNIT_X;
                break;
            case ROTATEY:
                axis = Vector3f.UNIT_Y;
                break;
            case ROTATEZ:
                axis = Vector3f.UNIT_Z;
                break;
        }
        Quaternion q = new Quaternion();
        q.fromAngleAxis(projectedLength * FastMath.DEG_TO_RAD, axis);

        for (Node n : viewport.getSelection()) {
            Quaternion base = n.getUserData("BaseRotation");
            Quaternion newValue = base.mult(q);

            if (n instanceof Prefab) {
                Prefab p = (Prefab) n;
                ObjectType oType = p.getObjectType();
                if (oType != null) {
                    Parameter rotation = oType.findParameter("TransformComponent", "rotation");
                    if (rotation != null) {
                        rotation.invokeSet(p, newValue, true);
                    }
                } else {
                    Logger.getLogger("DArtE").log(Level.INFO, "Could not find object type for :{0}", p.getClass().getName());
                }
            }
        }
    }
}
 
开发者ID:samynk,项目名称:DArtE,代码行数:54,代码来源:RotateTool.java


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