APIdia Launch Partner
Top Fields Constructors Methods
com.badlogic.gdx.physics.box2d

public Class ChainShape

extends Shape
Class Inheritance
Imports
com.badlogic.gdx.math.Vector2

Field Summary

Modifier and TypeField and Description
pack-priv boolean
private static float[]
Inherited from com.badlogic.gdx.physics.box2d.Shape:
addr

Constructor Summary

AccessConstructor and Description
public
pack-priv
ChainShape(long addr)

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Clear all vertices in the chain and free the memory.

public void
createChain(float[]
an array of floats of alternating x, y coordinates.
vertices
)

Create a chain with isolated end vertices.

public void
createChain(float[]
an array of floats of alternating x, y coordinates.
vertices
,
int
into the vertices array
offset
,
int
after offset (in floats, not float-pairs, so even number)
length
)

Create a chain with isolated end vertices.

public void
createChain(Vector2[]
an array of vertices, these are copied
vertices
)

Create a chain with isolated end vertices.

public void
createLoop(float[]
an array of floats of alternating x, y coordinates.
vertices
)

Create a loop.

public void
createLoop(float[]
an array of floats of alternating x, y coordinates.
vertices
,
int
into the vertices array
offset
,
int
after offset (in floats, not float-pairs, so even number)
length
)

Create a loop.

public void
createLoop(Vector2[]
an array of vertices, these are copied
vertices
)

Create a loop.

public Shape.Type
getType()

Implements abstract com.badlogic.gdx.physics.box2d.Shape.getType.

Get the type of this shape.

public void
getVertex(int
the index of the vertex 0 <= index < getVertexCount( )
index
,
Vector2
vertex
vertex
)

Returns the vertex at the given position.

public int
getVertexCount()

Returns: the number of vertices

public boolean
private native void
jniClear(long addr)

private native void
jniCreateChain(long addr, float[] verts, int offset, int numVertices)

private native void
jniCreateLoop(long addr, float[] verts, int offset, int numVertices)

private native void
jniGetVertex(long addr, int index, float[] verts)

private native int
jniGetVertexCount(long addr)

private native void
jniSetNextVertex(long addr, float x, float y)

private native void
jniSetPrevVertex(long addr, float x, float y)

private native long
public void
setNextVertex(Vector2 nextVertex)

Establish connectivity to a vertex that follows the last vertex.

public void
setNextVertex(float nextVertexX, float nextVertexY)

Establish connectivity to a vertex that follows the last vertex.

public void
setPrevVertex(Vector2 prevVertex)

Establish connectivity to a vertex that precedes the first vertex.

public void
setPrevVertex(float prevVertexX, float prevVertexY)

Establish connectivity to a vertex that precedes the first vertex.

Inherited from com.badlogic.gdx.physics.box2d.Shape:
disposegetChildCountgetRadiusjniGetTypesetRadius

Field Detail

isLoopedback to summary
pack-priv boolean isLooped
vertsback to summary
private static float[] verts

Constructor Detail

ChainShapeback to summary
public ChainShape()
ChainShapeback to summary
pack-priv ChainShape(long addr)

Method Detail

clearback to summary
public void clear()

Clear all vertices in the chain and free the memory.

createChainback to summary
public void createChain(float[] vertices)

Create a chain with isolated end vertices.

Parameters
vertices:float[]

an array of floats of alternating x, y coordinates.

createChainback to summary
public void createChain(float[] vertices, int offset, int length)

Create a chain with isolated end vertices.

Parameters
vertices:float[]

an array of floats of alternating x, y coordinates.

offset:int

into the vertices array

length:int

after offset (in floats, not float-pairs, so even number)

createChainback to summary
public void createChain(Vector2[] vertices)

Create a chain with isolated end vertices.

Parameters
vertices:Vector2[]

an array of vertices, these are copied

createLoopback to summary
public void createLoop(float[] vertices)

Create a loop. This automatically adjusts connectivity.

Parameters
vertices:float[]

an array of floats of alternating x, y coordinates.

createLoopback to summary
public void createLoop(float[] vertices, int offset, int length)

Create a loop. This automatically adjusts connectivity.

Parameters
vertices:float[]

an array of floats of alternating x, y coordinates.

offset:int

into the vertices array

length:int

after offset (in floats, not float-pairs, so even number)

createLoopback to summary
public void createLoop(Vector2[] vertices)

Create a loop. This automatically adjusts connectivity.

Parameters
vertices:Vector2[]

an array of vertices, these are copied

getTypeback to summary
public Shape.Type getType()

Implements abstract com.badlogic.gdx.physics.box2d.Shape.getType.

Doc from com.badlogic.gdx.physics.box2d.Shape.getType.

Get the type of this shape. You can use this to down cast to the concrete shape.

Annotations
@Override
getVertexback to summary
public void getVertex(int index, Vector2 vertex)

Returns the vertex at the given position.

Parameters
index:int

the index of the vertex 0 <= index < getVertexCount( )

vertex:Vector2

vertex

getVertexCountback to summary
public int getVertexCount()
Returns:int

the number of vertices

isLoopedback to summary
public boolean isLooped()
jniClearback to summary
private native void jniClear(long addr)
jniCreateChainback to summary
private native void jniCreateChain(long addr, float[] verts, int offset, int numVertices)
jniCreateLoopback to summary
private native void jniCreateLoop(long addr, float[] verts, int offset, int numVertices)
jniGetVertexback to summary
private native void jniGetVertex(long addr, int index, float[] verts)
jniGetVertexCountback to summary
private native int jniGetVertexCount(long addr)
jniSetNextVertexback to summary
private native void jniSetNextVertex(long addr, float x, float y)
jniSetPrevVertexback to summary
private native void jniSetPrevVertex(long addr, float x, float y)
newChainShapeback to summary
private native long newChainShape()
setNextVertexback to summary
public void setNextVertex(Vector2 nextVertex)

Establish connectivity to a vertex that follows the last vertex. Don't call this for loops.

setNextVertexback to summary
public void setNextVertex(float nextVertexX, float nextVertexY)

Establish connectivity to a vertex that follows the last vertex. Don't call this for loops.

setPrevVertexback to summary
public void setPrevVertex(Vector2 prevVertex)

Establish connectivity to a vertex that precedes the first vertex. Don't call this for loops.

setPrevVertexback to summary
public void setPrevVertex(float prevVertexX, float prevVertexY)

Establish connectivity to a vertex that precedes the first vertex. Don't call this for loops.