Package net.dermetfan.gdx.physics.box2d
Class MouseJointAdapter
java.lang.Object
com.badlogic.gdx.InputAdapter
net.dermetfan.gdx.physics.box2d.MouseJointAdapter
- All Implemented Interfaces:
com.badlogic.gdx.InputProcessor
public class MouseJointAdapter
extends com.badlogic.gdx.InputAdapter
an
InputAdapter managing a MouseJoint-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceMouseJointAdapter.ListenerclassMouseJointAdapter.ManagerManagesMouseJointAdaptersby creating new ones if necessary. -
Constructor Summary
Constructors Constructor Description MouseJointAdapter(com.badlogic.gdx.physics.box2d.joints.MouseJointDef jointDef, boolean adaptMaxForceToBodyMass, com.badlogic.gdx.graphics.Camera camera)constructs aMouseJointAdapterwith pointer set to 0 (useful for desktop)MouseJointAdapter(com.badlogic.gdx.physics.box2d.joints.MouseJointDef jointDef, boolean adaptMaxForceToBodyMass, com.badlogic.gdx.graphics.Camera camera, byte pointer)MouseJointAdapter(com.badlogic.gdx.physics.box2d.joints.MouseJointDef jointDef, boolean adaptMaxForceToBodyMass, com.badlogic.gdx.graphics.Camera camera, byte pointer, MouseJointAdapter.Listener listener)constructs aMouseJointAdapterusing the givenMouseJointDefMouseJointAdapter(com.badlogic.gdx.physics.box2d.joints.MouseJointDef jointDef, boolean adaptMaxForceToBodyMass, com.badlogic.gdx.graphics.Camera camera, MouseJointAdapter.Listener listener)MouseJointAdapter(MouseJointAdapter other)constructs a newMouseJointAdapterthat equals the given other one -
Method Summary
Modifier and Type Method Description com.badlogic.gdx.graphics.CameragetCamera()com.badlogic.gdx.physics.box2d.joints.MouseJointgetJoint()com.badlogic.gdx.physics.box2d.joints.MouseJointDefgetJointDef()MouseJointAdapter.ListenergetListener()bytegetPointer()booleanisAdaptMaxForceToBodyMass()booleanisMouseMoved()booleanmouseMoved(int screenX, int screenY)booleanreactsToPointer(int pointer)voidsetAdaptMaxForceToBodyMass(boolean adaptMaxForceToBodyMass)voidsetCamera(com.badlogic.gdx.graphics.Camera camera)voidsetJoint(com.badlogic.gdx.physics.box2d.joints.MouseJoint joint)voidsetJointDef(com.badlogic.gdx.physics.box2d.joints.MouseJointDef jointDef)voidsetListener(MouseJointAdapter.Listener listener)voidsetMouseMoved(boolean mouseMoved)voidsetPointer(byte pointer)booleantouchDown(int screenX, int screenY, int pointer, int button)usesqueryCallbackto createjointifjointisnullbooleantouchDragged(int screenX, int screenY, int pointer)booleantouchUp(int screenX, int screenY, int pointer, int button)Methods inherited from class com.badlogic.gdx.InputAdapter
keyDown, keyTyped, keyUp, scrolledMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
MouseJointAdapter
public MouseJointAdapter(com.badlogic.gdx.physics.box2d.joints.MouseJointDef jointDef, boolean adaptMaxForceToBodyMass, com.badlogic.gdx.graphics.Camera camera)constructs aMouseJointAdapterwith pointer set to 0 (useful for desktop) -
MouseJointAdapter
public MouseJointAdapter(com.badlogic.gdx.physics.box2d.joints.MouseJointDef jointDef, boolean adaptMaxForceToBodyMass, com.badlogic.gdx.graphics.Camera camera, byte pointer) -
MouseJointAdapter
public MouseJointAdapter(com.badlogic.gdx.physics.box2d.joints.MouseJointDef jointDef, boolean adaptMaxForceToBodyMass, com.badlogic.gdx.graphics.Camera camera, MouseJointAdapter.Listener listener) -
MouseJointAdapter
public MouseJointAdapter(com.badlogic.gdx.physics.box2d.joints.MouseJointDef jointDef, boolean adaptMaxForceToBodyMass, com.badlogic.gdx.graphics.Camera camera, byte pointer, MouseJointAdapter.Listener listener)constructs aMouseJointAdapterusing the givenMouseJointDef- Parameters:
jointDef- TheMouseJointDefto use. Note that itsbodyBwill be changed by theMouseJointAdapterso it can be null butbodyAhas to be set!adaptMaxForceToBodyMass- theadaptMaxForceToBodyMasscamera- thecamerapointer- thepointerlistener- thelistener
-
MouseJointAdapter
constructs a newMouseJointAdapterthat equals the given other one
-
-
Method Details
-
touchDown
public boolean touchDown(int screenX, int screenY, int pointer, int button)usesqueryCallbackto createjointifjointisnull- Specified by:
touchDownin interfacecom.badlogic.gdx.InputProcessor- Overrides:
touchDownin classcom.badlogic.gdx.InputAdapter
-
touchDragged
public boolean touchDragged(int screenX, int screenY, int pointer)- Specified by:
touchDraggedin interfacecom.badlogic.gdx.InputProcessor- Overrides:
touchDraggedin classcom.badlogic.gdx.InputAdapter
-
mouseMoved
public boolean mouseMoved(int screenX, int screenY)- Specified by:
mouseMovedin interfacecom.badlogic.gdx.InputProcessor- Overrides:
mouseMovedin classcom.badlogic.gdx.InputAdapter
-
touchUp
public boolean touchUp(int screenX, int screenY, int pointer, int button)- Specified by:
touchUpin interfacecom.badlogic.gdx.InputProcessor- Overrides:
touchUpin classcom.badlogic.gdx.InputAdapter
-
reactsToPointer
public boolean reactsToPointer(int pointer)- Returns:
- if this MouseJointAdapter reacts to the specified pointer
-
getPointer
public byte getPointer()- Returns:
- the
pointer
-
setPointer
public void setPointer(byte pointer)- Parameters:
pointer- thepointerto set
-
getListener
- Returns:
- the
listener
-
setListener
- Parameters:
listener- thelistenerto set
-
getCamera
public com.badlogic.gdx.graphics.Camera getCamera()- Returns:
- the
camera
-
setCamera
public void setCamera(com.badlogic.gdx.graphics.Camera camera)- Parameters:
camera- thecamerato set
-
isAdaptMaxForceToBodyMass
public boolean isAdaptMaxForceToBodyMass()- Returns:
- the
adaptMaxForceToBodyMass
-
setAdaptMaxForceToBodyMass
public void setAdaptMaxForceToBodyMass(boolean adaptMaxForceToBodyMass)- Parameters:
adaptMaxForceToBodyMass- theadaptMaxForceToBodyMassto set
-
isMouseMoved
public boolean isMouseMoved()- Returns:
- the
mouseMoved
-
setMouseMoved
public void setMouseMoved(boolean mouseMoved)- Parameters:
mouseMoved- themouseMovedto set
-
getJointDef
public com.badlogic.gdx.physics.box2d.joints.MouseJointDef getJointDef()- Returns:
- the
jointDef
-
setJointDef
public void setJointDef(com.badlogic.gdx.physics.box2d.joints.MouseJointDef jointDef)- Parameters:
jointDef- thejointDefto set
-
getJoint
public com.badlogic.gdx.physics.box2d.joints.MouseJoint getJoint()- Returns:
- the
joint
-
setJoint
public void setJoint(com.badlogic.gdx.physics.box2d.joints.MouseJoint joint)- Parameters:
joint- thejointto set
-