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 interface
MouseJointAdapter.Listener
class
MouseJointAdapter.Manager
ManagesMouseJointAdapters
by 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 aMouseJointAdapter
with 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 aMouseJointAdapter
using the givenMouseJointDef
MouseJointAdapter(com.badlogic.gdx.physics.box2d.joints.MouseJointDef jointDef, boolean adaptMaxForceToBodyMass, com.badlogic.gdx.graphics.Camera camera, MouseJointAdapter.Listener listener)
MouseJointAdapter(MouseJointAdapter other)
constructs a newMouseJointAdapter
that equals the given other one -
Method Summary
Modifier and Type Method Description com.badlogic.gdx.graphics.Camera
getCamera()
com.badlogic.gdx.physics.box2d.joints.MouseJoint
getJoint()
com.badlogic.gdx.physics.box2d.joints.MouseJointDef
getJointDef()
MouseJointAdapter.Listener
getListener()
byte
getPointer()
boolean
isAdaptMaxForceToBodyMass()
boolean
isMouseMoved()
boolean
mouseMoved(int screenX, int screenY)
boolean
reactsToPointer(int pointer)
void
setAdaptMaxForceToBodyMass(boolean adaptMaxForceToBodyMass)
void
setCamera(com.badlogic.gdx.graphics.Camera camera)
void
setJoint(com.badlogic.gdx.physics.box2d.joints.MouseJoint joint)
void
setJointDef(com.badlogic.gdx.physics.box2d.joints.MouseJointDef jointDef)
void
setListener(MouseJointAdapter.Listener listener)
void
setMouseMoved(boolean mouseMoved)
void
setPointer(byte pointer)
boolean
touchDown(int screenX, int screenY, int pointer, int button)
usesqueryCallback
to createjoint
ifjoint
isnull
boolean
touchDragged(int screenX, int screenY, int pointer)
boolean
touchUp(int screenX, int screenY, int pointer, int button)
Methods inherited from class com.badlogic.gdx.InputAdapter
keyDown, keyTyped, keyUp, scrolled
Methods 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 aMouseJointAdapter
with 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 aMouseJointAdapter
using the givenMouseJointDef
- Parameters:
jointDef
- TheMouseJointDef
to use. Note that itsbodyB
will be changed by theMouseJointAdapter
so it can be null butbodyA
has to be set!adaptMaxForceToBodyMass
- theadaptMaxForceToBodyMass
camera
- thecamera
pointer
- thepointer
listener
- thelistener
-
MouseJointAdapter
constructs a newMouseJointAdapter
that equals the given other one
-
-
Method Details
-
touchDown
public boolean touchDown(int screenX, int screenY, int pointer, int button)usesqueryCallback
to createjoint
ifjoint
isnull
- Specified by:
touchDown
in interfacecom.badlogic.gdx.InputProcessor
- Overrides:
touchDown
in classcom.badlogic.gdx.InputAdapter
-
touchDragged
public boolean touchDragged(int screenX, int screenY, int pointer)- Specified by:
touchDragged
in interfacecom.badlogic.gdx.InputProcessor
- Overrides:
touchDragged
in classcom.badlogic.gdx.InputAdapter
-
mouseMoved
public boolean mouseMoved(int screenX, int screenY)- Specified by:
mouseMoved
in interfacecom.badlogic.gdx.InputProcessor
- Overrides:
mouseMoved
in classcom.badlogic.gdx.InputAdapter
-
touchUp
public boolean touchUp(int screenX, int screenY, int pointer, int button)- Specified by:
touchUp
in interfacecom.badlogic.gdx.InputProcessor
- Overrides:
touchUp
in 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
- thepointer
to set
-
getListener
- Returns:
- the
listener
-
setListener
- Parameters:
listener
- thelistener
to set
-
getCamera
public com.badlogic.gdx.graphics.Camera getCamera()- Returns:
- the
camera
-
setCamera
public void setCamera(com.badlogic.gdx.graphics.Camera camera)- Parameters:
camera
- thecamera
to set
-
isAdaptMaxForceToBodyMass
public boolean isAdaptMaxForceToBodyMass()- Returns:
- the
adaptMaxForceToBodyMass
-
setAdaptMaxForceToBodyMass
public void setAdaptMaxForceToBodyMass(boolean adaptMaxForceToBodyMass)- Parameters:
adaptMaxForceToBodyMass
- theadaptMaxForceToBodyMass
to set
-
isMouseMoved
public boolean isMouseMoved()- Returns:
- the
mouseMoved
-
setMouseMoved
public void setMouseMoved(boolean mouseMoved)- Parameters:
mouseMoved
- themouseMoved
to 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
- thejointDef
to 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
- thejoint
to set
-