Java Code Examples for com.badlogic.gdx.graphics.g2d.NinePatch#setColor()

The following examples show how to use com.badlogic.gdx.graphics.g2d.NinePatch#setColor() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CocoStudioUIEditor.java    From cocos-ui-libgdx with Apache License 2.0 6 votes vote down vote up
public Drawable findDrawable(ObjectData option, String name) {

        if (option.isScale9Enable()) {// 九宫格支持
            TextureRegion textureRegion = findTextureRegion(option, name);
            NinePatch np = new NinePatch(textureRegion,
                option.getScale9OriginX(),
                textureRegion.getRegionWidth() - option.getScale9Width() - option.getScale9OriginX(),
                option.getScale9OriginY(),
                textureRegion.getRegionHeight() - option.getScale9Height() - option.getScale9OriginY());

            np.setColor(getColor(option.getCColor(), option.getAlpha()));
            return new NinePatchDrawable(np);
        }

        TextureRegion tr = findTextureRegion(option, name);

        if (tr == null) {
            return null;
        }

        return new TextureRegionDrawable(tr);
    }
 
Example 2
Source File: StatusUI.java    From Norii with Apache License 2.0 5 votes vote down vote up
private void createDynamicXpBar() {
	final TextureAtlas skinAtlas = Utility.getUITextureAtlas();
	final NinePatch xpBarBackgroundPatch = new NinePatch(skinAtlas.findRegion("default-round"), 5, 5, 4, 4);
	final NinePatch xpBarPatch = new NinePatch(skinAtlas.findRegion("default-round-down"), 5, 5, 4, 4);
	xpBarPatch.setColor(Color.BLACK);
	xpBar = new Image(xpBarPatch);
	xpBarBackground = new Image(xpBarBackgroundPatch);
}