public void onMouseButtonEvent(MouseButtonEvent event) { if (event.isReleased()) { return; } if (mouseStatus == null) { return; } PlayerControler p = game.getPlayerControler(); if (event.getButtonIndex() == 0) // links { if (mouseStatus.getModel() == null) { p.mouseClick(0, mouseStatus.getX(), mouseStatus.getY()); } else { p.mouseClick(0, (Unit) mouseStatus.getModel().getParent()); } } else if (event.getButtonIndex() == 1) // rechts { if (mouseStatus.getModel() == null) { p.mouseClick(1, mouseStatus.getX(), mouseStatus.getY()); } else { p.mouseClick(1, (Unit) mouseStatus.getModel().getParent()); } } else { // mitte } }
/** Callback from RawInputListener. Do not use. */ public void onMouseButtonEvent(MouseButtonEvent evt) { if (!eventsPermitted) { throw new UnsupportedOperationException("MouseInput has raised an event at an illegal time."); } // updating cursor pos on click, so that non android touch events can properly update cursor // position. cursorPos.set(evt.getX(), evt.getY()); inputQueue.add(evt); }
public void onMouseButtonEvent(MouseButtonEvent evt) { if (evt.getButtonIndex() == 0 && evt.isPressed()) { if (inventoryType == InventoryType.PointClick) { if (cursor.getUserData("worldObject") != null) { InteractiveNode node = cursor.getUserData("worldObject"); main.getRootNode().attachChild(node); node.setIsInScene(true); cursor.setUserData("worldObject", null); cursor.setTextureAtlasImage(objIcons, iconDefault); } } } }
public void update() { if (!context.isRenderable()) return; while (Mouse.next()) { int btn = Mouse.getEventButton(); int wheelDelta = Mouse.getEventDWheel(); int xDelta = Mouse.getEventDX(); int yDelta = Mouse.getEventDY(); int x = Mouse.getX(); int y = Mouse.getY(); curWheel += wheelDelta; if (cursorVisible) { xDelta = x - curX; yDelta = y - curY; curX = x; curY = y; } else { x = curX + xDelta; y = curY + yDelta; curX = x; curY = y; } if (xDelta != 0 || yDelta != 0 || wheelDelta != 0) { MouseMotionEvent evt = new MouseMotionEvent(x, y, xDelta, yDelta, curWheel, wheelDelta); evt.setTime(Mouse.getEventNanoseconds()); listener.onMouseMotionEvent(evt); } if (btn != -1) { MouseButtonEvent evt = new MouseButtonEvent(btn, Mouse.getEventButtonState(), x, y); evt.setTime(Mouse.getEventNanoseconds()); listener.onMouseButtonEvent(evt); } } }
private void onMouseButtonEventQueued(MouseButtonEvent evt) { int hash = MouseButtonTrigger.mouseButtonHash(evt.getButtonIndex()); invokeActions(hash, evt.isPressed()); invokeTimedActions(hash, evt.getTime(), evt.isPressed()); }