Package net.dermetfan.gdx.physics.box2d
Class Chain.DefShapeBuilder
java.lang.Object
net.dermetfan.gdx.physics.box2d.Chain.DefShapeBuilder
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
,Chain.Builder
- Enclosing class:
- Chain
public static class Chain.DefShapeBuilder extends java.lang.Object implements Chain.Builder, com.badlogic.gdx.utils.Disposable
A
Chain.Builder
that builds using a BodyDef
, JointDef
and Shape
. Should be dispose
if no longer used.-
Field Summary
Fields Modifier and Type Field Description protected com.badlogic.gdx.physics.box2d.BodyDef
bodyDef
theBodyDef
to use increateSegment(int, int, Chain)
protected float
density
the density to use inBody.createFixture(Shape, float)
protected com.badlogic.gdx.physics.box2d.JointDef
jointDef
theJointDef
to use increateSegment(int, int, Chain)
protected com.badlogic.gdx.physics.box2d.Shape
shape
theShape
to use increateSegment(int, int, Chain)
protected com.badlogic.gdx.physics.box2d.World
world
theWorld
to create things in -
Constructor Summary
Constructors Constructor Description DefShapeBuilder(com.badlogic.gdx.physics.box2d.World world, com.badlogic.gdx.physics.box2d.BodyDef bodyDef, com.badlogic.gdx.physics.box2d.Shape shape, float density, com.badlogic.gdx.physics.box2d.JointDef jointDef)
-
Method Summary
Modifier and Type Method Description Chain.Connection
createConnection(com.badlogic.gdx.physics.box2d.Body seg1, int seg1index, com.badlogic.gdx.physics.box2d.Body seg2, int seg2index)
connects two segments with each other using aChain.Connection
com.badlogic.gdx.physics.box2d.Body
createSegment(int index, int length, Chain chain)
void
dispose()
disposes
theshape
com.badlogic.gdx.physics.box2d.BodyDef
getBodyDef()
float
getDensity()
com.badlogic.gdx.physics.box2d.JointDef
getJointDef()
com.badlogic.gdx.physics.box2d.Shape
getShape()
com.badlogic.gdx.physics.box2d.World
getWorld()
void
setBodyDef(com.badlogic.gdx.physics.box2d.BodyDef bodyDef)
void
setDensity(float density)
void
setJointDef(com.badlogic.gdx.physics.box2d.JointDef jointDef)
void
setWorld(com.badlogic.gdx.physics.box2d.World world)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
world
protected com.badlogic.gdx.physics.box2d.World worldtheWorld
to create things in -
bodyDef
protected com.badlogic.gdx.physics.box2d.BodyDef bodyDeftheBodyDef
to use increateSegment(int, int, Chain)
-
shape
protected com.badlogic.gdx.physics.box2d.Shape shapetheShape
to use increateSegment(int, int, Chain)
-
density
protected float densitythe density to use inBody.createFixture(Shape, float)
-
jointDef
protected com.badlogic.gdx.physics.box2d.JointDef jointDeftheJointDef
to use increateSegment(int, int, Chain)
-
-
Constructor Details
-
DefShapeBuilder
public DefShapeBuilder(com.badlogic.gdx.physics.box2d.World world, com.badlogic.gdx.physics.box2d.BodyDef bodyDef, com.badlogic.gdx.physics.box2d.Shape shape, float density, com.badlogic.gdx.physics.box2d.JointDef jointDef)
-
-
Method Details
-
createSegment
- Specified by:
createSegment
in interfaceChain.Builder
- Parameters:
index
- the index of the segment to createlength
- the desired length of theChain
that is being buildchain
- theChain
this segment will be added to- Returns:
- the created segment
- See Also:
Body.createFixture(Shape, float)
-
createConnection
public Chain.Connection createConnection(com.badlogic.gdx.physics.box2d.Body seg1, int seg1index, com.badlogic.gdx.physics.box2d.Body seg2, int seg2index)Description copied from interface:Chain.Builder
connects two segments with each other using aChain.Connection
- Specified by:
createConnection
in interfaceChain.Builder
- Parameters:
seg1
- the first segmentseg1index
- the index of the first segmentseg2
- the second segmentseg2index
- the index of the second segment- Returns:
- a new
Joint
created withjointDef
-
dispose
public void dispose()disposes
theshape
- Specified by:
dispose
in interfacecom.badlogic.gdx.utils.Disposable
-
getWorld
public com.badlogic.gdx.physics.box2d.World getWorld()- Returns:
- the
world
-
setWorld
public void setWorld(com.badlogic.gdx.physics.box2d.World world)- Parameters:
world
- theworld
to set
-
getBodyDef
public com.badlogic.gdx.physics.box2d.BodyDef getBodyDef()- Returns:
- the
bodyDef
-
setBodyDef
public void setBodyDef(com.badlogic.gdx.physics.box2d.BodyDef bodyDef)- Parameters:
bodyDef
- thebodyDef
to set
-
getDensity
public float getDensity()- Returns:
- the
density
-
setDensity
public void setDensity(float density)- Parameters:
density
- thedensity
to set
-
getJointDef
public com.badlogic.gdx.physics.box2d.JointDef getJointDef()- Returns:
- the
jointDef
-
setJointDef
public void setJointDef(com.badlogic.gdx.physics.box2d.JointDef jointDef)- Parameters:
jointDef
- thejointDef
to set
-
getShape
public com.badlogic.gdx.physics.box2d.Shape getShape()- Returns:
- the
shape
-