Java 类com.badlogic.gdx.math.Polyline 实例源码

项目:NoRiskNoFun    文件:GameObjectMap.java   
@Override
public void draw (Batch batch, float parentAlpha) {
    batch.end();

    Gdx.gl.glLineWidth(10);

    for (PolygonRegion region : polygonRegions) {

        this.batch.begin();
        this.batch.draw(region, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        this.batch.end();

        Polyline line = new Polyline(region.getVertices());
        line.setScale(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

        shapeRenderer.begin(ShapeRenderer.ShapeType.Line);
        shapeRenderer.setProjectionMatrix(batch.getProjectionMatrix());
        shapeRenderer.setColor(Color.BROWN);
        shapeRenderer.polyline(line.getTransformedVertices());
        shapeRenderer.end();
    }

    batch.begin();
}
项目:gdx-cclibs    文件:PolylineSerializer.java   
@Override
public void write (Kryo kryo, Output output, Polyline polyline) {
    output.writeInt(polyline.getVertices().length);
    output.writeFloats(polyline.getVertices());
    output.writeFloat(polyline.getX());
    output.writeFloat(polyline.getY());
    output.writeFloat(polyline.getOriginX());
    output.writeFloat(polyline.getOriginY());
    output.writeFloat(polyline.getRotation());
    output.writeFloat(polyline.getScaleX());
    output.writeFloat(polyline.getScaleY());
}
项目:gdx-cclibs    文件:PolylineSerializer.java   
@Override
public Polyline read (Kryo kryo, Input input, Class<Polyline> type) {
    int length = input.readInt();
    float[] vertices = input.readFloats(length);
    Polyline polyline = new Polyline(vertices);
    polyline.setPosition(input.readFloat(), input.readFloat());
    polyline.setOrigin(input.readFloat(), input.readFloat());
    polyline.setRotation(input.readFloat());
    polyline.setScale(input.readFloat(), input.readFloat());
    return polyline;
}
项目:joe    文件:TiledUtils.java   
private static Shape getPolylineShape(MapObject object) {
    Polyline polyline = ((PolylineMapObject)object).getPolyline();
    float[] vertices = polyline.getTransformedVertices();
    for (int i = 0; i < vertices.length; i++) {
        vertices[i] *= MainCamera.getInstance().getTileMapScale();
    }

    ChainShape shape = new ChainShape();
    shape.createChain(vertices);

    return shape;
}
项目:SupaBax    文件:BodyBuilder.java   
/**
 * 
 * @param world
 * @param polylineObject
 * @param density
 * @param friction
 * @param restitution
 */
private void createPolyline(World world, PolylineMapObject polylineObject, float density, float friction, float restitution){
    Polyline polyline = polylineObject.getPolyline();
    ChainShape shape = new ChainShape();
    float[] vertices = polyline.getTransformedVertices();
    float[] worldVertices = new float[vertices.length];

    for(int i = 0; i < vertices.length; i++){
        worldVertices[i] = vertices[i] / SupaBox.PPM;
    }

    shape.createChain(worldVertices);

    BodyDef bodyDef = new BodyDef();
    bodyDef.type = BodyType.StaticBody;

    Body body = world.createBody(bodyDef);

    FixtureDef fixtureDef = new FixtureDef();
    fixtureDef.shape = shape;
    fixtureDef.density = density;
    fixtureDef.friction = friction;
    fixtureDef.restitution = restitution;

    body.createFixture(fixtureDef);

    shape.dispose();
}
项目:fabulae    文件:FixtureUserData.java   
public FixtureUserData(UserDataType type, String id, Polyline polyline)  {
    this(type, id);
    this.polyline = polyline;
}
项目:Tilo-game-framework    文件:math.java   
public Polyline polyline(float[] vertices) {
    return new Polyline(vertices);
}
项目:Tilo-game-framework    文件:math.java   
public Polyline polyline(float[] vertices) {
    return new Polyline(vertices);
}
项目:libgdxcn    文件:PolylineMapObject.java   
/** @return polyline shape */
public Polyline getPolyline () {
    return polyline;
}
项目:libgdxcn    文件:PolylineMapObject.java   
/** @param polyline new object's polyline shape */
public void setPolyline (Polyline polyline) {
    this.polyline = polyline;
}
项目:libgdxcn    文件:PolylineMapObject.java   
/** @param vertices polyline defining vertices */
public PolylineMapObject (float[] vertices) {
    polyline = new Polyline(vertices);
}
项目:libgdxcn    文件:PolylineMapObject.java   
/** @param polyline the polyline */
public PolylineMapObject (Polyline polyline) {
    this.polyline = polyline;
}