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.BodyDefbodyDeftheBodyDefto use increateSegment(int, int, Chain)protected floatdensitythe density to use inBody.createFixture(Shape, float)protected com.badlogic.gdx.physics.box2d.JointDefjointDeftheJointDefto use increateSegment(int, int, Chain)protected com.badlogic.gdx.physics.box2d.ShapeshapetheShapeto use increateSegment(int, int, Chain)protected com.badlogic.gdx.physics.box2d.WorldworldtheWorldto 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.ConnectioncreateConnection(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.Connectioncom.badlogic.gdx.physics.box2d.BodycreateSegment(int index, int length, Chain chain)voiddispose()disposestheshapecom.badlogic.gdx.physics.box2d.BodyDefgetBodyDef()floatgetDensity()com.badlogic.gdx.physics.box2d.JointDefgetJointDef()com.badlogic.gdx.physics.box2d.ShapegetShape()com.badlogic.gdx.physics.box2d.WorldgetWorld()voidsetBodyDef(com.badlogic.gdx.physics.box2d.BodyDef bodyDef)voidsetDensity(float density)voidsetJointDef(com.badlogic.gdx.physics.box2d.JointDef jointDef)voidsetWorld(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 worldtheWorldto create things in -
bodyDef
protected com.badlogic.gdx.physics.box2d.BodyDef bodyDeftheBodyDefto use increateSegment(int, int, Chain) -
shape
protected com.badlogic.gdx.physics.box2d.Shape shapetheShapeto use increateSegment(int, int, Chain) -
density
protected float densitythe density to use inBody.createFixture(Shape, float) -
jointDef
protected com.badlogic.gdx.physics.box2d.JointDef jointDeftheJointDefto 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:
createSegmentin interfaceChain.Builder- Parameters:
index- the index of the segment to createlength- the desired length of theChainthat is being buildchain- theChainthis 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.Builderconnects two segments with each other using aChain.Connection- Specified by:
createConnectionin 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
Jointcreated withjointDef
-
dispose
public void dispose()disposestheshape- Specified by:
disposein 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- theworldto 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- thebodyDefto set
-
getDensity
public float getDensity()- Returns:
- the
density
-
setDensity
public void setDensity(float density)- Parameters:
density- thedensityto 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- thejointDefto set
-
getShape
public com.badlogic.gdx.physics.box2d.Shape getShape()- Returns:
- the
shape
-