本文整理匯總了Java中com.badlogic.gdx.scenes.scene2d.utils.Drawable.getMinWidth方法的典型用法代碼示例。如果您正苦於以下問題:Java Drawable.getMinWidth方法的具體用法?Java Drawable.getMinWidth怎麽用?Java Drawable.getMinWidth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.scenes.scene2d.utils.Drawable
的用法示例。
在下文中一共展示了Drawable.getMinWidth方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: drawStageBackground
import com.badlogic.gdx.scenes.scene2d.utils.Drawable; //導入方法依賴的package包/類
@Override
protected void drawStageBackground(Batch batch, float parentAlpha, float x,
float y, float width, float height) {
Drawable background = getStyle().stageBackground;
float drawableWidth = background.getMinWidth();
float drawableHeight = background.getMinHeight();
if (drawableWidth < width || drawableHeight < height) {
Vector2 tempVector = MathUtil.getVector2();
Stage stage = getStage();
x = stage.getWidth()/2 - drawableWidth/2;
y = stage.getHeight()/2 - drawableHeight/2;
//stageToLocalCoordinates(tempVector.set(x, y));
//x = tempVector.x;
//y = tempVector.y;
MathUtil.freeVector2(tempVector);
width = background.getMinWidth();
height = background.getMinHeight();
}
super.drawStageBackground(batch, parentAlpha, x, y, width, height);
}
示例2: setDrawable
import com.badlogic.gdx.scenes.scene2d.utils.Drawable; //導入方法依賴的package包/類
/** @param drawable May be null. */
public void setDrawable (Drawable drawable) {
if (this.drawable == drawable) return;
if (drawable != null) {
if (getPrefWidth() != drawable.getMinWidth() || getPrefHeight() != drawable.getMinHeight()) invalidateHierarchy();
} else
invalidateHierarchy();
this.drawable = drawable;
}
示例3: EmptyDrawable
import com.badlogic.gdx.scenes.scene2d.utils.Drawable; //導入方法依賴的package包/類
/** Creates a new empty drawable with the same sizing information as the specified drawable. */
public EmptyDrawable(Drawable drawable) {
leftWidth = drawable.getLeftWidth();
rightWidth = drawable.getRightWidth();
topHeight = drawable.getTopHeight();
bottomHeight = drawable.getBottomHeight();
minWidth = drawable.getMinWidth();
minHeight = drawable.getMinHeight();
}
示例4: layout
import com.badlogic.gdx.scenes.scene2d.utils.Drawable; //導入方法依賴的package包/類
@Override
public void layout() {
super.layout();
Drawable imageDrawable = image.getDrawable();
if (imageDrawable != null) {
float x = this.getWidth() - (imageDrawable.getMinWidth() + CB.scaledSizes.MARGINx2 + style.selectIcon.getMinWidth());
float y = (this.getHeight() - imageDrawable.getMinHeight()) / 2;
image.setBounds(x, y, imageDrawable.getMinWidth(), imageDrawable.getMinHeight());
}
selectIcon.setBounds(this.getWidth() - (style.selectIcon.getMinWidth() + CB.scaledSizes.MARGIN),
(this.getHeight() - style.selectIcon.getMinHeight()) / 2,
style.selectIcon.getMinWidth(),
style.selectIcon.getMinHeight());
}
示例5: getDrawableMinWidth
import com.badlogic.gdx.scenes.scene2d.utils.Drawable; //導入方法依賴的package包/類
private float getDrawableMinWidth(Drawable drawable) {
if (drawable instanceof SvgNinePatchDrawable) {
return ((SvgNinePatchDrawable) drawable).getPatch().getTotalWidth();
}
return drawable.getMinWidth();
}