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

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

Introduction

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

Prototype

public RubeCustomProperty getProperty(Object object) 

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);
                }/*from  w w  w.ja va  2s.c om*/

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

            }
        }
    }
}