本文整理汇总了Java中com.jme3.input.event.MouseMotionEvent类的典型用法代码示例。如果您正苦于以下问题:Java MouseMotionEvent类的具体用法?Java MouseMotionEvent怎么用?Java MouseMotionEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MouseMotionEvent类属于com.jme3.input.event包,在下文中一共展示了MouseMotionEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: forwardEvents
import com.jme3.input.event.MouseMotionEvent; //导入依赖的package包/类
public void forwardEvents(NiftyInputConsumer nic) {
int queueSize = inputQueue.size();
for (int i = 0; i < queueSize; i++){
InputEvent evt = inputQueue.get(i);
if (evt instanceof MouseMotionEvent){
onMouseMotionEventQueued( (MouseMotionEvent)evt, nic);
}else if (evt instanceof MouseButtonEvent){
onMouseButtonEventQueued( (MouseButtonEvent)evt, nic);
}else if (evt instanceof KeyInputEvent){
onKeyEventQueued( (KeyInputEvent)evt, nic);
}
}
inputQueue.clear();
}
示例2: update
import com.jme3.input.event.MouseMotionEvent; //导入依赖的package包/类
public void update() {
int newX = location.x;
int newY = location.y;
int newWheel = wheelPos;
// invert DY
MouseMotionEvent evt = new MouseMotionEvent(newX, newY,
newX - lastEventX,
lastEventY - newY,
wheelPos, lastEventWheel - wheelPos);
listener.onMouseMotionEvent(evt);
int size = eventQueue.size();
for (int i = 0; i < size; i++){
listener.onMouseButtonEvent(eventQueue.get(i));
}
eventQueue.clear();
lastEventX = newX;
lastEventY = newY;
lastEventWheel = newWheel;
}
示例3: s3dOnTouchMoveEvent
import com.jme3.input.event.MouseMotionEvent; //导入依赖的package包/类
private void s3dOnTouchMoveEvent(TouchEvent evt) {
float x = ToolKit.isAndroid() ? touchXY.x : mouseXY.x;
float y = ToolKit.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) {
((MouseMovementListener<NodeEventTarget>) target)
.onMouseMove(new MouseUIMotionEvent<NodeEventTarget>(
new MouseMotionEvent((int) x, (int) y, (int) evt.getDeltaX(),
(int) evt.getDeltaY(), 0, 0),
new NodeEventTarget(this, target), keyboardModifiers));
}
if (target instanceof TouchListener) {
((TouchListener) target).onTouchMove(evt);
}
}
}
}
}
示例4: onMouseMotionEvent
import com.jme3.input.event.MouseMotionEvent; //导入依赖的package包/类
@Override
public void onMouseMotionEvent(MouseMotionEvent mme) {
super.onMouseMotionEvent(mme);
// if one of the terrain edit buttons is not enabled, return
if (!isTerrainEditButtonEnabled()) {
return;
}
// move the marker
Vector3f pos = getTerrainCollisionPoint();
if (pos != null) {
toolController.doMoveEditTool(pos);
}
}
示例5: 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));
}
}
}
}
}
示例6: onGetFocus
import com.jme3.input.event.MouseMotionEvent; //导入依赖的package包/类
@Override
public void onGetFocus(MouseMotionEvent evt) {
if (isEnabled) {
if (!getHasFocus()) {
if (!isToggled) {
runHoverEffect(true);
}
screen.setCursor(CursorType.HAND);
onButtonFocus(evt);
if (screen.getUseToolTips()) {
}
}
setHasFocus(true);
}
}
示例7: 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);
}
}
示例8: 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();
}
}
示例9: s3dOnTouchMoveEvent
import com.jme3.input.event.MouseMotionEvent; //导入依赖的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);
}
}
}
}
}
示例10: onMouseMotionEvent
import com.jme3.input.event.MouseMotionEvent; //导入依赖的package包/类
@Override
public void onMouseMotionEvent(MouseMotionEvent mme) {
super.onMouseMotionEvent(mme);
// if one of the terrain edit buttons is not enabled, return
if (!isTerrainEditButtonEnabled()) {
return;
}
// move the marker
Vector3f pos = getTerrainCollisionPoint();
if (pos != null) {
toolController.doMoveEditTool(pos);
}
}
示例11: onMouseMotionEvent
import com.jme3.input.event.MouseMotionEvent; //导入依赖的package包/类
public void onMouseMotionEvent(MouseMotionEvent evt) {
x += evt.getDX();
y += evt.getDY();
// Prevent mouse from leaving screen
AppSettings settings = TestSoftwareMouse.this.settings;
x = FastMath.clamp(x, 0, settings.getWidth());
y = FastMath.clamp(y, 0, settings.getHeight());
// adjust for hotspot
cursor.setPosition(x, y - 64);
}
示例12: 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();
// }
}
示例13: onMouseMotionEvent
import com.jme3.input.event.MouseMotionEvent; //导入依赖的package包/类
public void onMouseMotionEvent(MouseMotionEvent evt) {
// Only forward the event if there's actual motion involved.
// No longer ignores mouse wheel
if (inputManager.isCursorVisible() && (evt.getDX() != 0 ||
evt.getDY() != 0 ||
evt.getDeltaWheel() != 0)){
inputQueue.add(evt);
}
}
示例14: onMouseMotionEvent
import com.jme3.input.event.MouseMotionEvent; //导入依赖的package包/类
/**
* Callback from RawInputListener. Do not use.
*/
public void onMouseMotionEvent(MouseMotionEvent evt) {
if (!eventsPermitted) {
throw new UnsupportedOperationException("MouseInput has raised an event at an illegal time.");
}
cursorPos.set(evt.getX(), evt.getY());
inputQueue.add(evt);
}
示例15: androidTouchMoveEvent
import com.jme3.input.event.MouseMotionEvent; //导入依赖的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);
}
}