/** Creates a new drawable that renders the same as this drawable tinted the specified color. */ public Drawable tint (Color tint) { Sprite sprite; if (region instanceof AtlasRegion) sprite = new AtlasSprite((AtlasRegion)region); else sprite = new Sprite(region); sprite.setColor(tint); sprite.setSize(getMinWidth(), getMinHeight()); SpriteDrawable drawable = new SpriteDrawable(sprite); drawable.setLeftWidth(getLeftWidth()); drawable.setRightWidth(getRightWidth()); drawable.setTopHeight(getTopHeight()); drawable.setBottomHeight(getBottomHeight()); return drawable; } }
/** Creates a new drawable that renders the same as this drawable tinted the specified color. */ public Drawable tint (Color tint) { Sprite sprite; if (region instanceof AtlasRegion) sprite = new AtlasSprite((AtlasRegion)region); else sprite = new Sprite(region); sprite.setColor(tint); sprite.setSize(getMinWidth(), getMinHeight()); SpriteDrawable drawable = new SpriteDrawable(sprite); drawable.setLeftWidth(getLeftWidth()); drawable.setRightWidth(getRightWidth()); drawable.setTopHeight(getTopHeight()); drawable.setBottomHeight(getBottomHeight()); return drawable; } }
protected void updateDrawableSize( TextureRegionDrawable textureRegionDrawable){ float sizeMultiplier = resolutionHelper.getSizeMultiplier(); textureRegionDrawable.setMinWidth( textureRegionDrawable.getMinWidth() * sizeMultiplier); textureRegionDrawable.setMinHeight( textureRegionDrawable.getMinHeight() * sizeMultiplier); } }
protected void updateDrawableSize( TextureRegionDrawable textureRegionDrawable){ float sizeMultiplier = resolutionHelper.getSizeMultiplier(); textureRegionDrawable.setMinWidth( textureRegionDrawable.getMinWidth() * sizeMultiplier); textureRegionDrawable.setMinHeight( textureRegionDrawable.getMinHeight() * sizeMultiplier); }
@Override public Actor build(BaseModel model, Group parent) { CheckBoxModel checkBoxModel = (CheckBoxModel) model; setTextures( checkBoxModel); String text = ( checkBoxModel.getText() == null) ? "" : getLocalizedString( checkBoxModel.getText()).replace("\\n", String.format("%n")); BitmapFont font = assets.getFont( checkBoxModel.getFontName()); Color fontColor = Color.valueOf( checkBoxModel.getFontColor()); CheckBox.CheckBoxStyle style = new CheckBox.CheckBoxStyle( checkBoxOff, checkBoxOn, font, fontColor); if ( this.checkBoxOver != null){ style.checkboxOver = checkBoxOver; } CheckBox checkBox = new CheckBox( text, style); normalizeModelSize( checkBoxModel, parent, checkBoxOff.getMinWidth(), checkBoxOff.getMinHeight()); setBasicProperties( checkBoxModel, checkBox); setTextButtonProperties( checkBoxModel, font, checkBox); applyTableAlignment(checkBoxModel.getAlignment(), checkBox); return checkBox; }
@Override public Actor build(BaseModel model, Group parent) { SliderModel sliderModel = (SliderModel) model; setTextures(sliderModel); Slider slider = new Slider( sliderModel.getMinValue(), sliderModel.getMaxValue(), sliderModel.getStepSize(), sliderModel.isVertical(), new Slider.SliderStyle( background, knob)); updateDrawableSize( knob); normalizeModelSize( sliderModel, parent, background.getMinWidth(), background.getMinHeight()); updateDrawableSize( background); setBasicProperties( model, slider); return slider; }
/** Creates a new drawable that renders the same as this drawable tinted the specified color. */ public Drawable tint (Color tint) { Sprite sprite; if (region instanceof AtlasRegion) sprite = new AtlasSprite((AtlasRegion)region); else sprite = new Sprite(region); sprite.setColor(tint); sprite.setSize(getMinWidth(), getMinHeight()); SpriteDrawable drawable = new SpriteDrawable(sprite); drawable.setLeftWidth(getLeftWidth()); drawable.setRightWidth(getRightWidth()); drawable.setTopHeight(getTopHeight()); drawable.setBottomHeight(getBottomHeight()); return drawable; } }