Back to project page gameengine.
The source code is released under:
Apache License
If you think the Android project gameengine listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.garrapeta.gameengine.actor; /*ww w . j a v a2 s . c o m*/ import android.graphics.PointF; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.physics.box2d.Body; import com.badlogic.gdx.physics.box2d.ChainShape; import com.garrapeta.gameengine.Box2DWorld; import com.garrapeta.gameengine.Viewport; public class Box2DLoopActor<T extends Box2DWorld> extends Box2DAtomicActor<T> { /** * @param world * @param worldPos * , posicin en el mundo, en unidades del mundo * @param vertexes * , vrtices, en unidades del mundo * @param dynamic */ public Box2DLoopActor(T world, PointF worldPos, PointF[] vertexes, boolean dynamic) { super(world); Body body = world.createBody(this, worldPos, dynamic); setEdges(body, Viewport.pointFToVector2(vertexes)); } private void setEdges(Body body, Vector2[] vertexes) { // Create Shape with Properties ChainShape chainShape = new ChainShape(); chainShape.createLoop(vertexes); body.createFixture(chainShape, 1.0f); chainShape.dispose(); } }