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


Java Polygon.setScale方法代码示例

本文整理汇总了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);
}
 
开发者ID:HorsesInSpace,项目名称:Horses-in-Space,代码行数:17,代码来源:Horse.java

示例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;
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:12,代码来源:PolygonSerializer.java

示例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);
}
 
开发者ID:lukz,项目名称:Simple-Isometric-Game,代码行数:39,代码来源:MapProcessor.java

示例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;
}
 
开发者ID:Benjozork,项目名称:Onyx,代码行数:20,代码来源:PolygonHelper.java


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