Class Chain.DefBuilder

java.lang.Object
net.dermetfan.gdx.physics.box2d.Chain.DefBuilder
All Implemented Interfaces:
Chain.Builder
Enclosing class:
Chain

public static class Chain.DefBuilder extends Object implements Chain.Builder
a Chain.Builder that builds using a BodyDef, FixtureDef and Joint
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected com.badlogic.gdx.physics.box2d.BodyDef
    the BodyDef to use in createSegment(int, int, Chain)
    protected com.badlogic.gdx.physics.box2d.FixtureDef
    the FixtureDef to use in createSegment(int, int, Chain)
    protected com.badlogic.gdx.physics.box2d.JointDef
    protected com.badlogic.gdx.physics.box2d.World
    the World in which to create segments and joints
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefBuilder(com.badlogic.gdx.physics.box2d.World world, com.badlogic.gdx.physics.box2d.BodyDef bodyDef, com.badlogic.gdx.physics.box2d.FixtureDef fixtureDef, com.badlogic.gdx.physics.box2d.JointDef jointDef)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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 a Chain.Connection
    com.badlogic.gdx.physics.box2d.Body
    createSegment(int index, int length, Chain chain)
    creates a segment that is going to be added to Chain.segments
    com.badlogic.gdx.physics.box2d.BodyDef
     
    com.badlogic.gdx.physics.box2d.FixtureDef
     
    com.badlogic.gdx.physics.box2d.JointDef
     
    com.badlogic.gdx.physics.box2d.World
     
    void
    setBodyDef(com.badlogic.gdx.physics.box2d.BodyDef bodyDef)
     
    void
    setFixtureDef(com.badlogic.gdx.physics.box2d.FixtureDef fixtureDef)
     
    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 world
      the World in which to create segments and joints
    • bodyDef

      protected com.badlogic.gdx.physics.box2d.BodyDef bodyDef
      the BodyDef to use in createSegment(int, int, Chain)
    • fixtureDef

      protected com.badlogic.gdx.physics.box2d.FixtureDef fixtureDef
      the FixtureDef to use in createSegment(int, int, Chain)
    • jointDef

      protected com.badlogic.gdx.physics.box2d.JointDef jointDef
  • Constructor Details

    • DefBuilder

      public DefBuilder(com.badlogic.gdx.physics.box2d.World world, com.badlogic.gdx.physics.box2d.BodyDef bodyDef, com.badlogic.gdx.physics.box2d.FixtureDef fixtureDef, com.badlogic.gdx.physics.box2d.JointDef jointDef)
      Parameters:
      world - the world
      bodyDef - the bodyDef
      fixtureDef - the fixtureDef
      jointDef - the jointDef
  • Method Details

    • createSegment

      public com.badlogic.gdx.physics.box2d.Body createSegment(int index, int length, Chain chain)
      Description copied from interface: Chain.Builder
      creates a segment that is going to be added to Chain.segments
      Specified by:
      createSegment in interface Chain.Builder
      Parameters:
      index - the index of the segment to create
      length - the desired length of the Chain that is being build
      chain - the Chain this segment will be added to
      Returns:
      a new segment created withbodyDef and fixtureDef
    • 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 a Chain.Connection
      Specified by:
      createConnection in interface Chain.Builder
      Parameters:
      seg1 - the first segment
      seg1index - the index of the first segment
      seg2 - the second segment
      seg2index - the index of the second segment
      Returns:
      a new JointDef created with jointDef
    • 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 - the world 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 - the bodyDef to set
    • getFixtureDef

      public com.badlogic.gdx.physics.box2d.FixtureDef getFixtureDef()
      Returns:
      the fixtureDef
    • setFixtureDef

      public void setFixtureDef(com.badlogic.gdx.physics.box2d.FixtureDef fixtureDef)
      Parameters:
      fixtureDef - the fixtureDef 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 - the jointDef to set