Example usage for com.badlogic.gdx.rube RubeScene getFixtures

List of usage examples for com.badlogic.gdx.rube RubeScene getFixtures

Introduction

In this page you can find the example usage for com.badlogic.gdx.rube RubeScene getFixtures.

Prototype

public Array<Fixture> getFixtures() 

Source Link

Usage

From source file:com.badlogic.gdx.rube.test.SpriteRenderer.java

public void addFixtures(RubeScene _scene) {
    Array<Fixture> fixtures = _scene.getFixtures();

    for (int i = 0; i < fixtures.size; ++i) {
        Fixture fixture = fixtures.get(i);
        RubeCustomProperty property = _scene.getProperty(fixture);
        if (property != null) {
            String textureName = property.getString("TextureMask", null);
            if (textureName != null) {
                // We create a texture if needed
                textureName = "data/" + textureName;
                Texture texture = textureMap.get(textureName);

                if (texture == null) {
                    texture = new Texture(textureName);
                    texture.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
                    textureMap.put(textureName, texture);
                }// ww  w  . j  a va  2 s  .c o  m

                // And use that texture plus fixture infos to create a polygon sprite
                RubePolygonSprite sprite = RubePolygonSprite.createRubePolygonSprite(texture, fixture);
                if (sprite != null) {
                    polygonSprites.add(sprite);
                }

            }
        }
    }
}