Java Code Examples for com.badlogic.gdx.Input.Buttons#MIDDLE
The following examples show how to use
com.badlogic.gdx.Input.Buttons#MIDDLE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FluidSimulatorSPH.java From fluid-simulator-v2 with Apache License 2.0 | 6 votes |
public boolean touchDown(int x, int y, int pointer, int button) { touching = true; camera.unproject(testPoint.set(x, y, 0)); testPoint2D.x = testPoint.x; testPoint2D.y = testPoint.y; if (button == Buttons.LEFT) { if (!IS_DESKTOP) { isRepulsing = true; isAttracting = false; } else { isAttracting = false; isRepulsing = false; } } if (button == Buttons.RIGHT) { isAttracting = true; } if (button == Buttons.MIDDLE) { isRepulsing = true; } return false; }
Example 2
Source File: AttackBattleState.java From Norii with Apache License 2.0 | 5 votes |
@Override public void buttonPressed(int button) { switch (button) { case Buttons.RIGHT: ParticleMaker.deactivateAllParticlesOfType(ParticleType.ATTACK); exit(); break; case Buttons.LEFT: break; case Buttons.MIDDLE: break; default: break; } }
Example 3
Source File: MovementBattleState.java From Norii with Apache License 2.0 | 5 votes |
@Override public void buttonPressed(int button) { switch (button) { case Buttons.RIGHT: ParticleMaker.deactivateAllParticlesOfType(ParticleType.MOVE); exit(); break; case Buttons.LEFT: break; case Buttons.MIDDLE: break; default: break; } }
Example 4
Source File: SpellBattleState.java From Norii with Apache License 2.0 | 5 votes |
@Override public void buttonPressed(final int button) { switch (button) { case Buttons.RIGHT: ParticleMaker.deactivateAllParticlesOfType(ParticleType.SPELL); exit(); break; case Buttons.LEFT: break; case Buttons.MIDDLE: break; default: break; } }
Example 5
Source File: InputController.java From TerraLegion with MIT License | 5 votes |
/** * Returns the last input that was pressed. * * @return an integer representing either Buttons.LEFT, Buttons.MIDDLE, or Buttons.RIGHT. -1 if not one of the buttons. */ private int getButtonPressed() { if (Gdx.input.isButtonPressed(Buttons.LEFT)) return Buttons.LEFT; else if (Gdx.input.isButtonPressed(Buttons.MIDDLE)) return Buttons.MIDDLE; else if (Gdx.input.isButtonPressed(Buttons.RIGHT)) return Buttons.RIGHT; return -1; }
Example 6
Source File: FluidSimulatorSPH.java From fluid-simulator-v2 with Apache License 2.0 | 5 votes |
public boolean touchUp(int x, int y, int pointer, int button) { touching = false; if (!IS_DESKTOP) { isRepulsing = false; isAttracting = false; } if (button == Buttons.RIGHT) { isAttracting = false; } if (button == Buttons.MIDDLE) { isRepulsing = false; } return false; }
Example 7
Source File: FluidSimulatorMPM.java From fluid-simulator-v2 with Apache License 2.0 | 5 votes |
@Override public boolean touchUp(int x, int y, int pointer, int button) { touching = false; // MPM Fluid interaction mpmSolver.pressed = false; if (!IS_DESKTOP) { isRepulsing = false; isAttracting = false; } if (button == Buttons.RIGHT) { isAttracting = false; } if (button == Buttons.MIDDLE) { isRepulsing = false; } // if a mouse joint exists we simply destroy it if (mouseJoint != null) { if (dragVelocity.len() > 1) mouseJoint.getBodyB().setLinearVelocity(dragVelocity.scl(50000)); world.destroyJoint(mouseJoint); mouseJoint = null; } hitBody = null; dragVelocity.set(0, 0); if (pointer == 2) { emitType ++; if (emitType > 3) emitType = 1; } return false; }
Example 8
Source File: FluidSimulatorLiquid.java From fluid-simulator-v2 with Apache License 2.0 | 4 votes |
@Override public boolean touchDown(int x, int y, int pointer, int button) { touching = true; camera.unproject(testPoint.set(x, y, 0)); testPoint2D.x = testPoint.x; testPoint2D.y = testPoint.y; oldDragPos.set(testPoint2D); if (button == Buttons.LEFT) { // Drag Mode if (isDragging) { for (Piece piece : pieces.values()) { hitBody = null; if (piece.body.getFixtureList().get(0).testPoint(testPoint2D)) { hitBody = piece.body; if (hitBody.getType() == BodyType.KinematicBody || hitBody.getType() == BodyType.StaticBody) continue; MouseJointDef def = new MouseJointDef(); def.bodyA = groundBody; def.bodyB = hitBody; def.collideConnected = true; def.target.set(testPoint2D); def.maxForce = 10.0f * hitBody.getMass(); mouseJoint = (MouseJoint)world.createJoint(def); hitBody.setAwake(true); break; } } if (mouseJoint != null) return false; } if (!IS_DESKTOP) { isRepulsing = true; isAttracting = false; } else { isAttracting = false; isRepulsing = false; } } if (button == Buttons.RIGHT) { isAttracting = true; } if (button == Buttons.MIDDLE) { isRepulsing = true; } return false; }
Example 9
Source File: FluidSimulatorLiquid.java From fluid-simulator-v2 with Apache License 2.0 | 4 votes |
@Override public boolean touchUp(int x, int y, int pointer, int button) { touching = false; if (!IS_DESKTOP) { isRepulsing = false; isAttracting = false; } if (button == Buttons.RIGHT) { isAttracting = false; } if (button == Buttons.MIDDLE) { isRepulsing = false; } // if a mouse joint exists we simply destroy it if (mouseJoint != null) { if (dragVelocity.len() > 1) mouseJoint.getBodyB().setLinearVelocity(dragVelocity.scl(50000)); world.destroyJoint(mouseJoint); mouseJoint = null; } hitBody = null; dragVelocity.set(0, 0); if (pointer == 1 || pointer == 3) { if (pointer == 3) enableBox2DCollisions = !enableBox2DCollisions; if (pointer == 1) bgMode = !bgMode; // if (shapes) // dropRadiusK = 1.3f; // else // dropRadiusK = 2.5f; // dropRadius = 0.1f + dropRadiusK; // dropRadiusPixel = (int) (dropRadius * PARTICLE_SIZE); // dropRadiusPixel2 = dropRadiusPixel * dropRadiusPixel; // dropSprite.setSize(dropRadiusPixel, dropRadiusPixel); } else if (pointer == 2) { emitType ++; if (emitType > 3) emitType = 1; for (Particle p : particles) p.type = emitType; } return false; }
Example 10
Source File: FluidSimulator.java From fluid-simulator-v2 with Apache License 2.0 | 4 votes |
@Override public boolean touchDown(int x, int y, int pointer, int button) { touching = true; camera.unproject(testPoint.set(x, y, 0)); testPoint2D.x = testPoint.x; testPoint2D.y = testPoint.y; oldDragPos.set(testPoint2D); if (button == Buttons.LEFT) { // Drag Mode if (isDragging) { for (Piece piece : pieces.values()) { hitBody = null; if (piece.body.getFixtureList().get(0).testPoint(testPoint2D)) { hitBody = piece.body; if (hitBody.getType() == BodyType.KinematicBody || hitBody.getType() == BodyType.StaticBody) continue; MouseJointDef def = new MouseJointDef(); def.bodyA = groundBody; def.bodyB = hitBody; def.collideConnected = true; def.target.set(testPoint2D); def.maxForce = 10.0f * hitBody.getMass(); mouseJoint = (MouseJoint)world.createJoint(def); hitBody.setAwake(true); break; } } if (mouseJoint != null) return false; } if (!IS_DESKTOP) { isRepulsing = true; isAttracting = false; } else { isAttracting = false; isRepulsing = false; } } if (button == Buttons.RIGHT) { isAttracting = true; } if (button == Buttons.MIDDLE) { isRepulsing = true; } return false; }
Example 11
Source File: FluidSimulator.java From fluid-simulator-v2 with Apache License 2.0 | 4 votes |
@Override public boolean touchUp(int x, int y, int pointer, int button) { touching = false; if (!IS_DESKTOP) { isRepulsing = false; isAttracting = false; } if (button == Buttons.RIGHT) { isAttracting = false; } if (button == Buttons.MIDDLE) { isRepulsing = false; } // if a mouse joint exists we simply destroy it if (mouseJoint != null) { if (dragVelocity.len() > 1) mouseJoint.getBodyB().setLinearVelocity(dragVelocity.scl(50000)); world.destroyJoint(mouseJoint); mouseJoint = null; } hitBody = null; dragVelocity.set(0, 0); if (pointer == 1 || pointer == 3) { if (pointer == 3) enableBox2DCollisions = !enableBox2DCollisions; if (pointer == 1) bgMode = !bgMode; // if (shapes) // dropRadiusK = 1.3f; // else // dropRadiusK = 2.5f; // dropRadius = 0.1f + dropRadiusK; // dropRadiusPixel = (int) (dropRadius * PARTICLE_SIZE); // dropRadiusPixel2 = dropRadiusPixel * dropRadiusPixel; // dropSprite.setSize(dropRadiusPixel, dropRadiusPixel); } else if (pointer == 2) { emitType ++; if (emitType > 3) emitType = 1; for (Particle p : particles) p.type = emitType; } return false; }
Example 12
Source File: FluidSimulatorMPM.java From fluid-simulator-v2 with Apache License 2.0 | 4 votes |
@Override public boolean touchDown(int x, int y, int pointer, int button) { touching = true; camera.unproject(testPoint.set(x, y, 0)); testPoint2D.x = testPoint.x; testPoint2D.y = testPoint.y; oldDragPos.set(testPoint2D); if (button == Buttons.LEFT) { // MPM mpmSolver.pressed = true; mpmSolver.mx = (int)testPoint2D.x; mpmSolver.my = BOX_HEIGHT - (int)testPoint2D.y; // Drag Mode if (isDragging) { for (Piece piece : pieces.values()) { hitBody = null; if (piece.body.getFixtureList().get(0).testPoint(testPoint2D)) { hitBody = piece.body; if (hitBody.getType() == BodyType.KinematicBody || hitBody.getType() == BodyType.StaticBody) continue; MouseJointDef def = new MouseJointDef(); def.bodyA = groundBody; def.bodyB = hitBody; def.collideConnected = true; def.target.set(testPoint2D); def.maxForce = 10.0f * hitBody.getMass(); mouseJoint = (MouseJoint)world.createJoint(def); hitBody.setAwake(true); break; } } if (mouseJoint != null) return false; } if (!IS_DESKTOP) { isRepulsing = true; isAttracting = false; } else { isAttracting = false; isRepulsing = false; } } if (button == Buttons.RIGHT) { isAttracting = true; } if (button == Buttons.MIDDLE) { isRepulsing = true; } return false; }