Example usage for com.badlogic.gdx.graphics.g2d PolygonRegionLoader load

List of usage examples for com.badlogic.gdx.graphics.g2d PolygonRegionLoader load

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics.g2d PolygonRegionLoader load.

Prototype

public PolygonRegion load(TextureRegion textureRegion, FileHandle file) 

Source Link

Document

Loads a PolygonRegion from a PSH (Polygon SHape) file.

Usage

From source file:cmnworks.com.angrybee.Actor.java

License:Open Source License

public void ready() {
    Texture.TextureFilter linear = Texture.TextureFilter.Linear;
    Texture actor1 = new Texture(this.setFolder + "actor1.png");
    Texture actor2 = new Texture(this.setFolder + "actor2.png");
    Texture actor3 = new Texture(this.setFolder + "actor3.png");

    actor1.setFilter(linear, linear);//from  w w  w.ja v a2 s  . com
    actor2.setFilter(linear, linear);
    actor3.setFilter(linear, linear);
    actor = new Animation(this.setFlappingSpeed, new TextureRegion(actor1), new TextureRegion(actor2),
            new TextureRegion(actor3), new TextureRegion(actor2));
    actor.setPlayMode(Animation.PlayMode.LOOP);

    this.dimension[0] = actor1.getWidth();
    this.dimension[1] = actor1.getHeight();
    this.startingYPoint = (Gdx.graphics.getHeight() / 2) - actor1.getHeight();

    PolygonRegionLoader loader = new PolygonRegionLoader();
    PolygonRegion region = loader.load(new TextureRegion(actor1), Gdx.files.internal(this.setPsh));
    this.polygon = new Polygon(region.getVertices());
}

From source file:cmnworks.com.angrybee.Obstacles.java

License:Open Source License

public void ready() {
    this.target = new Texture(this.setTextureObstacles);
    PolygonRegionLoader loader = new PolygonRegionLoader();
    PolygonRegion region = loader.load(new TextureRegion(target), Gdx.files.internal(this.setPsh));
    this.polygon = new Polygon(region.getVertices());
}