com.badlogic.gdx.physics.box2d
Class ChainShape

java.lang.Object
  extended by com.badlogic.gdx.physics.box2d.Shape
      extended by com.badlogic.gdx.physics.box2d.ChainShape

public class ChainShape
extends Shape


Nested Class Summary
 
Nested classes/interfaces inherited from class com.badlogic.gdx.physics.box2d.Shape
Shape.Type
 
Constructor Summary
ChainShape()
           
 
Method Summary
 void createChain(float[] vertices)
          Create a chain with isolated end vertices.
 void createChain(Vector2[] vertices)
          Create a chain with isolated end vertices.
 void createLoop(Vector2[] vertices)
          Create a loop.
 Shape.Type getType()
          Get the type of this shape.
 void getVertex(int index, Vector2 vertex)
          Returns the vertex at the given position.
 int getVertexCount()
           
 boolean isLooped()
           
 void setNextVertex(float nextVertexX, float nextVertexY)
          Establish connectivity to a vertex that follows the last vertex.
 void setNextVertex(Vector2 nextVertex)
          Establish connectivity to a vertex that follows the last vertex.
 void setPrevVertex(float prevVertexX, float prevVertexY)
          Establish connectivity to a vertex that precedes the first vertex.
 void setPrevVertex(Vector2 prevVertex)
          Establish connectivity to a vertex that precedes the first vertex.
 
Methods inherited from class com.badlogic.gdx.physics.box2d.Shape
dispose, getChildCount, getRadius, setRadius
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChainShape

public ChainShape()
Method Detail

getType

public Shape.Type getType()
Description copied from class: Shape
Get the type of this shape. You can use this to down cast to the concrete shape.

Specified by:
getType in class Shape
Returns:
the shape type.

createLoop

public void createLoop(Vector2[] vertices)
Create a loop. This automatically adjusts connectivity.

Parameters:
vertices - an array of vertices, these are copied

createChain

public void createChain(float[] vertices)
Create a chain with isolated end vertices.

Parameters:
vertices - an array of floats of alternating x, y coordinates.

createChain

public void createChain(Vector2[] vertices)
Create a chain with isolated end vertices.

Parameters:
vertices - an array of vertices, these are copied

setPrevVertex

public void setPrevVertex(Vector2 prevVertex)
Establish connectivity to a vertex that precedes the first vertex. Don't call this for loops.


setPrevVertex

public void setPrevVertex(float prevVertexX,
                          float prevVertexY)
Establish connectivity to a vertex that precedes the first vertex. Don't call this for loops.


setNextVertex

public void setNextVertex(Vector2 nextVertex)
Establish connectivity to a vertex that follows the last vertex. Don't call this for loops.


setNextVertex

public void setNextVertex(float nextVertexX,
                          float nextVertexY)
Establish connectivity to a vertex that follows the last vertex. Don't call this for loops.


getVertexCount

public int getVertexCount()
Returns:
the number of vertices

getVertex

public void getVertex(int index,
                      Vector2 vertex)
Returns the vertex at the given position.

Parameters:
index - the index of the vertex 0 <= index < getVertexCount( )
vertex - vertex

isLooped

public boolean isLooped()


Copyright © 2013. All Rights Reserved.