本文整理汇总了Java中com.badlogic.gdx.math.Polygon.setScale方法的典型用法代码示例。如果您正苦于以下问题:Java Polygon.setScale方法的具体用法?Java Polygon.setScale怎么用?Java Polygon.setScale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.math.Polygon
的用法示例。
在下文中一共展示了Polygon.setScale方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Horse
import com.badlogic.gdx.math.Polygon; //导入方法依赖的package包/类
public Horse(TextureRegion horse, int width, int height, float weight,
float posX, float posY) {
super(horse, width, height, weight, posX, posY, AssetLoader.polyHorse);
this.polyMap = new HashMap<TextureRegion, Polygon>();
this.polyMap.put(AssetLoader.horse, AssetLoader.polyHorse);
this.polyMap.put(AssetLoader.horse2, AssetLoader.polyHorse2);
this.polyMap.put(AssetLoader.horse3, AssetLoader.polyHorse3);
this.polyMap.put(AssetLoader.horseJump, AssetLoader.polyHorseJump);
this.polyMap.put(AssetLoader.horseSlide, AssetLoader.polyHorseSlide);
for (Polygon polygon : this.polyMap.values()) {
polygon.setScale(0.15f, 0.16f);
polygon.setPosition(posX, posY + 50);
}
this.polyMap.get(AssetLoader.horseSlide).setScale(0.15f, 0.12f);
}
示例2: read
import com.badlogic.gdx.math.Polygon; //导入方法依赖的package包/类
@Override
public Polygon read (Kryo kryo, Input input, Class<Polygon> type) {
int length = input.readInt();
float[] vertices = input.readFloats(length);
Polygon polygon = new Polygon(vertices);
polygon.setPosition(input.readFloat(), input.readFloat());
polygon.setOrigin(input.readFloat(), input.readFloat());
polygon.setRotation(input.readFloat());
polygon.setScale(input.readFloat(), input.readFloat());
return polygon;
}
示例3: polygonGround
import com.badlogic.gdx.math.Polygon; //导入方法依赖的package包/类
private static void polygonGround(MapObject object, Map map, Box2DWorld world, Matrix4 transformMat4) {
PolygonMapObject polyObject = (PolygonMapObject)object;
Polygon polygon = new Polygon(polyObject.getPolygon().getTransformedVertices());
polygon.setScale(world.WORLD_TO_BOX, world.WORLD_TO_BOX);
Vector3 tempVec3 = new Vector3();
// Transform each vertex by transformation matrix
for(int ix = 0, iy = 1; iy < polygon.getVertices().length; ix += 2, iy += 2) {
tempVec3.set(polygon.getVertices()[ix], polygon.getVertices()[iy], 0);
tempVec3.mul(transformMat4);
polygon.getVertices()[ix] = tempVec3.x;// - body.getPosition().x;
polygon.getVertices()[iy] = tempVec3.y;// - body.getPosition().y;
}
Polygon[] convexPolygons = GeometryUtils.decompose(polygon);
BodyDef bd = new BodyDef();
bd.type = BodyDef.BodyType.StaticBody;
bd.fixedRotation = true;
Body body = world.getWorld().createBody(bd);
for(Polygon convexPolygon : convexPolygons) {
FixtureDef fixtureDef = new FixtureDef();
fixtureDef.density = 1f;
fixtureDef.friction = 0.0f;
fixtureDef.restitution = 0.0f;
PolygonShape shape = new PolygonShape();
shape.set(convexPolygon.getTransformedVertices());
fixtureDef.shape = shape;
body.createFixture(fixtureDef);
}
body.setUserData(map);
}
示例4: getPolygon
import com.badlogic.gdx.math.Polygon; //导入方法依赖的package包/类
/**
* WARNING: EXPENSIVE OPERATION USE ONLY IN INITIALISATION STEPS
* This method is used to create a new rectangular polygon
*
* @param x the x coordinate of the polygon
* @param y the y coordinate of the polygon
* @param width the width of the polygon
* @param height the height of the polygon
* @return the created polygon
*/
public static Polygon getPolygon(float x, float y, float width, float height) {
float vals[] = {0, 0, width, 0, width, height, 0, height};
Polygon p = new Polygon();
p.setOrigin(width / 2, height / 2);
p.setScale(1, 1);
p.setVertices(vals);
p.setPosition(x, y);
return p;
}