本文整理了Java中com.badlogic.gdx.scenes.scene2d.utils.Drawable.getMinWidth()
方法的一些代码示例,展示了Drawable.getMinWidth()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Drawable.getMinWidth()
方法的具体详情如下:
包路径:com.badlogic.gdx.scenes.scene2d.utils.Drawable
类名称:Drawable
方法名:getMinWidth
暂无
代码示例来源:origin: libgdx/libgdx
public float getScrollBarWidth () {
if (!scrollY) return 0;
float width = 0;
if (style.vScrollKnob != null) width = style.vScrollKnob.getMinWidth();
if (style.vScroll != null) width = Math.max(width, style.vScroll.getMinWidth());
return width;
}
代码示例来源:origin: libgdx/libgdx
public float getPrefWidth () {
float width = super.getPrefWidth();
if (style.up != null) width = Math.max(width, style.up.getMinWidth());
if (style.down != null) width = Math.max(width, style.down.getMinWidth());
if (style.checked != null) width = Math.max(width, style.checked.getMinWidth());
return width;
}
代码示例来源:origin: libgdx/libgdx
public float getPrefWidth () {
if (vertical) {
final Drawable knob = getKnobDrawable();
final Drawable bg = (disabled && style.disabledBackground != null) ? style.disabledBackground : style.background;
return Math.max(knob == null ? 0 : knob.getMinWidth(), bg == null ? 0 : bg.getMinWidth());
} else
return 140;
}
代码示例来源:origin: libgdx/libgdx
public float getPrefWidth () {
if (vertical) {
final Drawable knob = getKnobDrawable();
final Drawable bg = (disabled && style.disabledBackground != null) ? style.disabledBackground : style.background;
return Math.max(knob == null ? 0 : knob.getMinWidth(), bg == null ? 0 : bg.getMinWidth());
} else
return 140;
}
代码示例来源:origin: libgdx/libgdx
public void layout () {
if (sizeInvalid) computeSize();
float plusMinusWidth = Math.max(style.plus.getMinWidth(), style.minus.getMinWidth());
layout(rootNodes, padding, getHeight() - ySpacing / 2, plusMinusWidth);
}
代码示例来源:origin: libgdx/libgdx
public void layout () {
if (sizeInvalid) computeSize();
float plusMinusWidth = Math.max(style.plus.getMinWidth(), style.minus.getMinWidth());
layout(rootNodes, padding, getHeight() - ySpacing / 2, plusMinusWidth);
}
代码示例来源:origin: libgdx/libgdx
public float getMinWidth () {
float first = firstWidget instanceof Layout ? ((Layout)firstWidget).getMinWidth() : 0;
float second = secondWidget instanceof Layout ? ((Layout)secondWidget).getMinWidth() : 0;
if (vertical) return Math.max(first, second);
return first + style.handle.getMinWidth() + second;
}
代码示例来源:origin: libgdx/libgdx
public float getMinWidth () {
float first = firstWidget instanceof Layout ? ((Layout)firstWidget).getMinWidth() : 0;
float second = secondWidget instanceof Layout ? ((Layout)secondWidget).getMinWidth() : 0;
if (vertical) return Math.max(first, second);
return first + style.handle.getMinWidth() + second;
}
代码示例来源:origin: libgdx/libgdx
public void draw (Batch batch, float parentAlpha) {
drawBackground(batch, parentAlpha);
Color color = getColor();
batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
float plusMinusWidth = Math.max(style.plus.getMinWidth(), style.minus.getMinWidth());
draw(batch, rootNodes, padding, plusMinusWidth);
super.draw(batch, parentAlpha); // Draw actors.
}
代码示例来源:origin: libgdx/libgdx
private void calculateHorizBoundsAndPositions () {
Drawable handle = style.handle;
float height = getHeight();
float availWidth = getWidth() - handle.getMinWidth();
float leftAreaWidth = (int)(availWidth * splitAmount);
float rightAreaWidth = availWidth - leftAreaWidth;
float handleWidth = handle.getMinWidth();
firstWidgetBounds.set(0, 0, leftAreaWidth, height);
secondWidgetBounds.set(leftAreaWidth + handleWidth, 0, rightAreaWidth, height);
handleBounds.set(leftAreaWidth, 0, handleWidth, height);
}
代码示例来源:origin: libgdx/libgdx
public float getPrefWidth () {
float v = prefWidth.get(actor);
if (background != null) v = Math.max(v, background.getMinWidth());
return Math.max(getMinWidth(), v + padLeft.get(this) + padRight.get(this));
}
代码示例来源:origin: libgdx/libgdx
private void calculateHorizBoundsAndPositions () {
Drawable handle = style.handle;
float height = getHeight();
float availWidth = getWidth() - handle.getMinWidth();
float leftAreaWidth = (int)(availWidth * splitAmount);
float rightAreaWidth = availWidth - leftAreaWidth;
float handleWidth = handle.getMinWidth();
firstWidgetBounds.set(0, 0, leftAreaWidth, height);
secondWidgetBounds.set(leftAreaWidth + handleWidth, 0, rightAreaWidth, height);
handleBounds.set(leftAreaWidth, 0, handleWidth, height);
}
代码示例来源:origin: libgdx/libgdx
public float getPrefWidth () {
float v = prefWidth.get(actor);
if (background != null) v = Math.max(v, background.getMinWidth());
return Math.max(getMinWidth(), v + padLeft.get(this) + padRight.get(this));
}
代码示例来源:origin: libgdx/libgdx
@Override
public float getPrefWidth () {
float first = firstWidget == null ? 0
: (firstWidget instanceof Layout ? ((Layout)firstWidget).getPrefWidth() : firstWidget.getWidth());
float second = secondWidget == null ? 0
: (secondWidget instanceof Layout ? ((Layout)secondWidget).getPrefWidth() : secondWidget.getWidth());
if (vertical) return Math.max(first, second);
return first + style.handle.getMinWidth() + second;
}
代码示例来源:origin: libgdx/libgdx
@Override
public float getPrefWidth () {
float first = firstWidget == null ? 0
: (firstWidget instanceof Layout ? ((Layout)firstWidget).getPrefWidth() : firstWidget.getWidth());
float second = secondWidget == null ? 0
: (secondWidget instanceof Layout ? ((Layout)secondWidget).getPrefWidth() : secondWidget.getWidth());
if (vertical) return Math.max(first, second);
return first + style.handle.getMinWidth() + second;
}
代码示例来源:origin: libgdx/libgdx
protected void drawCursor (Drawable cursorPatch, Batch batch, BitmapFont font, float x, float y) {
cursorPatch.draw(batch,
x + textOffset + glyphPositions.get(cursor) - glyphPositions.get(visibleTextStart) + fontOffset + font.getData().cursorX,
y - textHeight - font.getDescent(), cursorPatch.getMinWidth(), textHeight);
}
代码示例来源:origin: libgdx/libgdx
/** Sets a new drawable for the image. The image's pref size is the drawable's min size. If using the image actor's size rather
* than the pref size, {@link #pack()} can be used to size the image to its pref size.
* @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;
}
代码示例来源:origin: libgdx/libgdx
/** Sets a new drawable for the image. The image's pref size is the drawable's min size. If using the image actor's size rather
* than the pref size, {@link #pack()} can be used to size the image to its pref size.
* @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;
}
代码示例来源:origin: libgdx/libgdx
@Override
protected void drawCursor (Drawable cursorPatch, Batch batch, BitmapFont font, float x, float y) {
float textOffset = cursor >= glyphPositions.size || cursorLine * 2 >= linesBreak.size ? 0
: glyphPositions.get(cursor) - glyphPositions.get(linesBreak.items[cursorLine * 2]);
cursorPatch.draw(batch, x + textOffset + fontOffset + font.getData().cursorX,
y - font.getDescent() / 2 - (cursorLine - firstLineShowing + 1) * font.getLineHeight(), cursorPatch.getMinWidth(),
font.getLineHeight());
}
代码示例来源:origin: libgdx/libgdx
@Override
protected void drawCursor (Drawable cursorPatch, Batch batch, BitmapFont font, float x, float y) {
float textOffset = cursor >= glyphPositions.size || cursorLine * 2 >= linesBreak.size ? 0
: glyphPositions.get(cursor) - glyphPositions.get(linesBreak.items[cursorLine * 2]);
cursorPatch.draw(batch, x + textOffset + fontOffset + font.getData().cursorX,
y - font.getDescent() / 2 - (cursorLine - firstLineShowing + 1) * font.getLineHeight(), cursorPatch.getMinWidth(),
font.getLineHeight());
}
内容来源于网络,如有侵权,请联系作者删除!