本文整理汇总了Java中com.badlogic.gdx.graphics.g2d.PolygonRegionLoader.load方法的典型用法代码示例。如果您正苦于以下问题:Java PolygonRegionLoader.load方法的具体用法?Java PolygonRegionLoader.load怎么用?Java PolygonRegionLoader.load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.graphics.g2d.PolygonRegionLoader
的用法示例。
在下文中一共展示了PolygonRegionLoader.load方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import com.badlogic.gdx.graphics.g2d.PolygonRegionLoader; //导入方法依赖的package包/类
@Override
public void create () {
texture = new Texture(Gdx.files.internal("data/tree.png"));
PolygonRegionLoader loader = new PolygonRegionLoader();
region = loader.load(new TextureRegion(texture), Gdx.files.internal("data/tree.psh"));
// create a region from an arbitrary set of vertices (a triangle in this case)
region2 = new PolygonRegion(new TextureRegion(texture), new float[] {0, 0, 100, 100, 0, 100}, new short[] {0, 1, 2});
camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera.position.x = 0;
camera.position.y = 0;
batch = new PolygonSpriteBatch();
debugRenderer = new PolygonRegionDebugRenderer();
Gdx.input.setInputProcessor(this);
}
示例2: create
import com.badlogic.gdx.graphics.g2d.PolygonRegionLoader; //导入方法依赖的package包/类
@Override
public void create () {
texture = new Texture(Gdx.files.internal("data/tree.png"));
PolygonRegionLoader loader = new PolygonRegionLoader();
region = loader.load(new TextureRegion(texture), Gdx.files.internal("data/tree.psh"));
renderer = new ShapeRenderer();
camera = new OrthographicCamera(480, 320);
camera.position.x = 240;
camera.position.y = 160;
camera.update();
batch = new PolygonSpriteBatch();
for (int i = 0; i < 50; i++) {
PolygonSprite sprite = new PolygonSprite(region);
sprite.setPosition(MathUtils.random(-30, 440), MathUtils.random(-30, 290));
sprite.setColor(MathUtils.random(), MathUtils.random(), MathUtils.random(), 1.0f);
sprite.setScale(MathUtils.random(0.5f, 1.5f), MathUtils.random(0.5f, 1.5f));
sprites.add(sprite);
}
}