private void setupTarget(InputEvent event) { if (targetSystem.isTargetAvailable()) { event.setTargetInfo( targetSystem.getTarget(), targetSystem.getTargetBlockPosition(), targetSystem.getHitPosition(), targetSystem.getHitNormal()); } }
private void processBindRepeats(float delta) { for (BindableButtonImpl button : buttonBinds) { button.update( getInputEntities(), delta, targetSystem.getTarget(), targetSystem.getTargetBlockPosition(), targetSystem.getHitPosition(), targetSystem.getHitNormal()); } }
private void processBindAxis(float delta) { for (BindableAxisImpl axis : axisBinds) { axis.update( getInputEntities(), delta, targetSystem.getTarget(), targetSystem.getTargetBlockPosition(), targetSystem.getHitPosition(), targetSystem.getHitNormal()); } }
private void processKeyboardInput(float delta) { for (InputAction action : keyboard.getInputQueue()) { boolean consumed = sendKeyEvent(action.getInput(), action.getInputChar(), action.getState(), delta); // Update bind BindableButtonImpl bind = keyBinds.get(action.getInput().getId()); if (bind != null && action.getState() != ButtonState.REPEAT) { bind.updateBindState( action.getInput(), (action.getState() == ButtonState.DOWN), delta, getInputEntities(), targetSystem.getTarget(), targetSystem.getTargetBlockPosition(), targetSystem.getHitPosition(), targetSystem.getHitNormal(), consumed); } } }
private void processMouseInput(float delta) { if (!engine.hasFocus()) return; Vector2i deltaMouse = mouse.getDelta(); // process mouse movement x axis if (deltaMouse.x != 0) { mouseXEvent(deltaMouse, delta); } // process mouse movement y axis if (deltaMouse.y != 0) { mouseYEvent(deltaMouse, delta); } // process mouse clicks for (InputAction action : mouse.getInputQueue()) { switch (action.getInput().getType()) { case MOUSE_BUTTON: int id = action.getInput().getId(); if (id != -1) { MouseInput button = MouseInput.find(action.getInput().getType(), action.getInput().getId()); boolean consumed = sendMouseEvent( button, action.getState().isDown(), action.getMousePosition(), delta); BindableButtonImpl bind = mouseButtonBinds.get(button); if (bind != null) { bind.updateBindState( action.getInput(), action.getState().isDown(), delta, getInputEntities(), targetSystem.getTarget(), targetSystem.getTargetBlockPosition(), targetSystem.getHitPosition(), targetSystem.getHitNormal(), consumed); } } break; case MOUSE_WHEEL: int dir = action.getInput().getId(); if (dir != 0 && action.getTurns() != 0) { boolean consumed = sendMouseWheelEvent(action.getMousePosition(), dir * action.getTurns(), delta); BindableButtonImpl bind = (dir == 1) ? mouseWheelUpBind : mouseWheelDownBind; if (bind != null) { for (int i = 0; i < action.getTurns(); ++i) { bind.updateBindState( action.getInput(), true, delta, getInputEntities(), targetSystem.getTarget(), targetSystem.getTargetBlockPosition(), targetSystem.getHitPosition(), targetSystem.getHitNormal(), consumed); bind.updateBindState( action.getInput(), false, delta, getInputEntities(), targetSystem.getTarget(), targetSystem.getTargetBlockPosition(), targetSystem.getHitPosition(), targetSystem.getHitNormal(), consumed); } } } break; case KEY: break; } } }