本文整理汇总了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();
}
示例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());
}
示例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;
}
示例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;
}
示例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();
}
示例6: FixtureUserData
import com.badlogic.gdx.math.Polyline; //导入依赖的package包/类
public FixtureUserData(UserDataType type, String id, Polyline polyline) {
this(type, id);
this.polyline = polyline;
}
示例7: polyline
import com.badlogic.gdx.math.Polyline; //导入依赖的package包/类
public Polyline polyline(float[] vertices) {
return new Polyline(vertices);
}
示例8: getPolyline
import com.badlogic.gdx.math.Polyline; //导入依赖的package包/类
/** @return polyline shape */
public Polyline getPolyline () {
return polyline;
}
示例9: setPolyline
import com.badlogic.gdx.math.Polyline; //导入依赖的package包/类
/** @param polyline new object's polyline shape */
public void setPolyline (Polyline polyline) {
this.polyline = polyline;
}
示例10: PolylineMapObject
import com.badlogic.gdx.math.Polyline; //导入依赖的package包/类
/** @param vertices polyline defining vertices */
public PolylineMapObject (float[] vertices) {
polyline = new Polyline(vertices);
}