/** Returns a tinted copy of a drawable found in the skin via {@link #getDrawable(String)}. */ public Drawable newDrawable (Drawable drawable, Color tint) { Drawable newDrawable; if (drawable instanceof TextureRegionDrawable) newDrawable = ((TextureRegionDrawable)drawable).tint(tint); else if (drawable instanceof NinePatchDrawable) newDrawable = ((NinePatchDrawable)drawable).tint(tint); else if (drawable instanceof SpriteDrawable) newDrawable = ((SpriteDrawable)drawable).tint(tint); else throw new GdxRuntimeException("Unable to copy, unknown drawable type: " + drawable.getClass()); if (newDrawable instanceof BaseDrawable) { BaseDrawable named = (BaseDrawable)newDrawable; if (drawable instanceof BaseDrawable) named.setName(((BaseDrawable)drawable).getName() + " (" + tint + ")"); else named.setName(" (" + tint + ")"); } return newDrawable; }
public Object read (Json json, JsonValue jsonData, Class type) { String name = json.readValue("name", String.class, jsonData); Color color = json.readValue("color", Color.class, jsonData); Drawable drawable = newDrawable(name, color); if (drawable instanceof BaseDrawable) { BaseDrawable named = (BaseDrawable)drawable; named.setName(jsonData.name + " (" + name + ", " + color + ")"); } return drawable; } });
/** Creates a new empty drawable with the same sizing information as the specified drawable. */ public BaseDrawable (Drawable drawable) { if (drawable instanceof BaseDrawable) name = ((BaseDrawable)drawable).getName(); leftWidth = drawable.getLeftWidth(); rightWidth = drawable.getRightWidth(); topHeight = drawable.getTopHeight(); bottomHeight = drawable.getBottomHeight(); minWidth = drawable.getMinWidth(); minHeight = drawable.getMinHeight(); }
@Override public Actor build(BaseModel model, Group parent) { ButtonModel buttonModel = (ButtonModel) model; setTextures(buttonModel); Button button = new Button(up, down); if (buttonModel.getFrameDisabled() != null) { button.getStyle().disabled = disabled; } if ( buttonModel.getFrameChecked() != null){ button.getStyle().checked = checked; } normalizeModelSize(buttonModel, parent, up.getMinWidth(), up.getMinHeight()); setBasicProperties(model, button); return button; }
public Object read (Json json, JsonValue jsonData, Class type) { String name = json.readValue("name", String.class, jsonData); Color color = json.readValue("color", Color.class, jsonData); Drawable drawable = newDrawable(name, color); if (drawable instanceof BaseDrawable) { BaseDrawable named = (BaseDrawable)drawable; named.setName(jsonData.name + " (" + name + ", " + color + ")"); } return drawable; } });
/** Creates a new empty drawable with the same sizing information as the specified drawable. */ public BaseDrawable (Drawable drawable) { if (drawable instanceof BaseDrawable) name = ((BaseDrawable)drawable).getName(); leftWidth = drawable.getLeftWidth(); rightWidth = drawable.getRightWidth(); topHeight = drawable.getTopHeight(); bottomHeight = drawable.getBottomHeight(); minWidth = drawable.getMinWidth(); minHeight = drawable.getMinHeight(); }
@Override public Actor build(BaseModel model, Group parent) { TextButtonModel textButtonModel = (TextButtonModel) model; setTextures(textButtonModel); BitmapFont font = assets.getFont(textButtonModel.getFontName()); TextButton.TextButtonStyle style = new TextButton.TextButtonStyle(up, down, up, font); if (textButtonModel.getFontColor() != null) { style.fontColor = Color.valueOf(textButtonModel.getFontColor()); } if (textButtonModel.getDisabledFontColor() != null) { style.disabledFontColor = Color.valueOf(textButtonModel.getDisabledFontColor()); } if (textButtonModel.getFrameDisabled() != null) { style.disabled = disabled; } if ( textButtonModel.getFrameChecked() != null){ style.checked = checked; } TextButton textButton = new TextButton(getLocalizedString(textButtonModel.getText()).replace("\\n", String.format("%n")), style); normalizeModelSize(textButtonModel, parent, up.getMinWidth(), up.getMinHeight()); setBasicProperties(textButtonModel, textButton); setTextButtonProperties(textButtonModel, font, textButton); return textButton; }
/** Returns a tinted copy of a drawable found in the skin via {@link #getDrawable(String)}. */ public Drawable newDrawable (Drawable drawable, Color tint) { Drawable newDrawable; if (drawable instanceof TextureRegionDrawable) newDrawable = ((TextureRegionDrawable)drawable).tint(tint); else if (drawable instanceof NinePatchDrawable) newDrawable = ((NinePatchDrawable)drawable).tint(tint); else if (drawable instanceof SpriteDrawable) newDrawable = ((SpriteDrawable)drawable).tint(tint); else throw new GdxRuntimeException("Unable to copy, unknown drawable type: " + drawable.getClass()); if (newDrawable instanceof BaseDrawable) { BaseDrawable named = (BaseDrawable)newDrawable; if (drawable instanceof BaseDrawable) named.setName(((BaseDrawable)drawable).getName() + " (" + tint + ")"); else named.setName(" (" + tint + ")"); } return newDrawable; }
if (drawable instanceof BaseDrawable) ((BaseDrawable)drawable).setName(name);
/** Creates a new empty drawable with the same sizing information as the specified drawable. */ public BaseDrawable (Drawable drawable) { if (drawable instanceof BaseDrawable) name = ((BaseDrawable)drawable).getName(); leftWidth = drawable.getLeftWidth(); rightWidth = drawable.getRightWidth(); topHeight = drawable.getTopHeight(); bottomHeight = drawable.getBottomHeight(); minWidth = drawable.getMinWidth(); minHeight = drawable.getMinHeight(); }
/** Returns a tinted copy of a drawable found in the skin via {@link #getDrawable(String)}. */ public Drawable newDrawable (Drawable drawable, Color tint) { Drawable newDrawable; if (drawable instanceof TextureRegionDrawable) newDrawable = ((TextureRegionDrawable)drawable).tint(tint); else if (drawable instanceof NinePatchDrawable) newDrawable = ((NinePatchDrawable)drawable).tint(tint); else if (drawable instanceof SpriteDrawable) newDrawable = ((SpriteDrawable)drawable).tint(tint); else throw new GdxRuntimeException("Unable to copy, unknown drawable type: " + drawable.getClass()); if (newDrawable instanceof BaseDrawable) { BaseDrawable named = (BaseDrawable)newDrawable; if (drawable instanceof BaseDrawable) named.setName(((BaseDrawable)drawable).getName() + " (" + tint + ")"); else named.setName(" (" + tint + ")"); } return newDrawable; }
if (drawable instanceof BaseDrawable) ((BaseDrawable)drawable).setName(name);
public Object read (Json json, JsonValue jsonData, Class type) { String name = json.readValue("name", String.class, jsonData); Color color = json.readValue("color", Color.class, jsonData); Drawable drawable = newDrawable(name, color); if (drawable instanceof BaseDrawable) { BaseDrawable named = (BaseDrawable)drawable; named.setName(jsonData.name + " (" + name + ", " + color + ")"); } return drawable; } });
if (drawable instanceof BaseDrawable) ((BaseDrawable)drawable).setName(name);