当前位置: 首页>>代码示例>>Java>>正文


Java Polyline类代码示例

本文整理汇总了Java中com.badlogic.gdx.math.Polyline的典型用法代码示例。如果您正苦于以下问题:Java Polyline类的具体用法?Java Polyline怎么用?Java Polyline使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Polyline类属于com.badlogic.gdx.math包,在下文中一共展示了Polyline类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: draw

import com.badlogic.gdx.math.Polyline; //导入依赖的package包/类
@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();
}
 
开发者ID:cpppwner,项目名称:NoRiskNoFun,代码行数:25,代码来源:GameObjectMap.java

示例2: write

import com.badlogic.gdx.math.Polyline; //导入依赖的package包/类
@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());
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:13,代码来源:PolylineSerializer.java

示例3: read

import com.badlogic.gdx.math.Polyline; //导入依赖的package包/类
@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;
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:12,代码来源:PolylineSerializer.java

示例4: getPolylineShape

import com.badlogic.gdx.math.Polyline; //导入依赖的package包/类
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;
}
 
开发者ID:alexschimpf,项目名称:joe,代码行数:13,代码来源:TiledUtils.java

示例5: createPolyline

import com.badlogic.gdx.math.Polyline; //导入依赖的package包/类
/**
 * 
 * @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();
}
 
开发者ID:ryanshappell,项目名称:SupaBax,代码行数:36,代码来源:BodyBuilder.java

示例6: FixtureUserData

import com.badlogic.gdx.math.Polyline; //导入依赖的package包/类
public FixtureUserData(UserDataType type, String id, Polyline polyline)  {
	this(type, id);
	this.polyline = polyline;
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:5,代码来源:FixtureUserData.java

示例7: polyline

import com.badlogic.gdx.math.Polyline; //导入依赖的package包/类
public Polyline polyline(float[] vertices) {
    return new Polyline(vertices);
}
 
开发者ID:Murii,项目名称:Tilo-game-framework,代码行数:4,代码来源:math.java

示例8: getPolyline

import com.badlogic.gdx.math.Polyline; //导入依赖的package包/类
/** @return polyline shape */
public Polyline getPolyline () {
	return polyline;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:5,代码来源:PolylineMapObject.java

示例9: setPolyline

import com.badlogic.gdx.math.Polyline; //导入依赖的package包/类
/** @param polyline new object's polyline shape */
public void setPolyline (Polyline polyline) {
	this.polyline = polyline;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:5,代码来源:PolylineMapObject.java

示例10: PolylineMapObject

import com.badlogic.gdx.math.Polyline; //导入依赖的package包/类
/** @param vertices polyline defining vertices */
public PolylineMapObject (float[] vertices) {
	polyline = new Polyline(vertices);
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:5,代码来源:PolylineMapObject.java


注:本文中的com.badlogic.gdx.math.Polyline类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。