本文整理了Java中com.badlogic.gdx.scenes.scene2d.utils.Drawable.getTopHeight()
方法的一些代码示例,展示了Drawable.getTopHeight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Drawable.getTopHeight()
方法的具体详情如下:
包路径:com.badlogic.gdx.scenes.scene2d.utils.Drawable
类名称:Drawable
方法名:getTopHeight
暂无
代码示例来源:origin: libgdx/libgdx
public float get (Actor context) {
Drawable background = ((Table)context).background;
return background == null ? 0 : background.getTopHeight();
}
};
代码示例来源:origin: libgdx/libgdx
public float get (Actor context) {
Drawable background = ((Table)context).background;
return background == null ? 0 : background.getTopHeight();
}
};
代码示例来源:origin: libgdx/libgdx
@Override
protected float getTextY (BitmapFont font, Drawable background) {
float textY = getHeight();
if (background != null) {
textY = (int)(textY - background.getTopHeight());
}
return textY;
}
代码示例来源:origin: libgdx/libgdx
@Override
protected float getTextY (BitmapFont font, Drawable background) {
float textY = getHeight();
if (background != null) {
textY = (int)(textY - background.getTopHeight());
}
return textY;
}
代码示例来源:origin: libgdx/libgdx
@Override
protected void sizeChanged () {
lastText = null; // Cause calculateOffsets to recalculate the line breaks.
// The number of lines showed must be updated whenever the height is updated
BitmapFont font = style.font;
Drawable background = style.background;
float availableHeight = getHeight() - (background == null ? 0 : background.getBottomHeight() + background.getTopHeight());
linesShowing = (int)Math.floor(availableHeight / font.getLineHeight());
}
代码示例来源:origin: libgdx/libgdx
@Override
protected void sizeChanged () {
lastText = null; // Cause calculateOffsets to recalculate the line breaks.
// The number of lines showed must be updated whenever the height is updated
BitmapFont font = style.font;
Drawable background = style.background;
float availableHeight = getHeight() - (background == null ? 0 : background.getBottomHeight() + background.getTopHeight());
linesShowing = (int)Math.floor(availableHeight / font.getLineHeight());
}
代码示例来源:origin: libgdx/libgdx
@Override
public float getPrefHeight () {
if (prefRows <= 0) {
return super.getPrefHeight();
} else {
float prefHeight = textHeight * prefRows;
if (style.background != null) {
prefHeight = Math.max(prefHeight + style.background.getBottomHeight() + style.background.getTopHeight(),
style.background.getMinHeight());
}
return prefHeight;
}
}
代码示例来源:origin: libgdx/libgdx
@Override
public float getPrefHeight () {
if (prefRows <= 0) {
return super.getPrefHeight();
} else {
float prefHeight = textHeight * prefRows;
if (style.background != null) {
prefHeight = Math.max(prefHeight + style.background.getBottomHeight() + style.background.getTopHeight(),
style.background.getMinHeight());
}
return prefHeight;
}
}
代码示例来源:origin: libgdx/libgdx
/** @return -1 if not over an item. */
public int getItemIndexAt (float y) {
float height = getHeight();
Drawable background = List.this.style.background;
if (background != null) {
height -= background.getTopHeight() + background.getBottomHeight();
y -= background.getBottomHeight();
}
int index = (int)((height - y) / itemHeight);
if (index < 0 || index >= items.size) return -1;
return index;
}
代码示例来源:origin: libgdx/libgdx
/** @return -1 if not over an item. */
public int getItemIndexAt (float y) {
float height = getHeight();
Drawable background = List.this.style.background;
if (background != null) {
height -= background.getTopHeight() + background.getBottomHeight();
y -= background.getBottomHeight();
}
int index = (int)((height - y) / itemHeight);
if (index < 0 || index >= items.size) return -1;
return index;
}
代码示例来源:origin: libgdx/libgdx
public float getPrefHeight () {
if (widget instanceof Layout) {
float height = ((Layout)widget).getPrefHeight();
if (style.background != null) height += style.background.getTopHeight() + style.background.getBottomHeight();
if (forceScrollX) {
float scrollbarHeight = 0;
if (style.hScrollKnob != null) scrollbarHeight = style.hScrollKnob.getMinHeight();
if (style.hScroll != null) scrollbarHeight = Math.max(scrollbarHeight, style.hScroll.getMinHeight());
height += scrollbarHeight;
}
return height;
}
return 150;
}
代码示例来源:origin: libgdx/libgdx
public float getPrefHeight () {
if (widget instanceof Layout) {
float height = ((Layout)widget).getPrefHeight();
if (style.background != null) height += style.background.getTopHeight() + style.background.getBottomHeight();
if (forceScrollX) {
float scrollbarHeight = 0;
if (style.hScrollKnob != null) scrollbarHeight = style.hScrollKnob.getMinHeight();
if (style.hScroll != null) scrollbarHeight = Math.max(scrollbarHeight, style.hScroll.getMinHeight());
height += scrollbarHeight;
}
return height;
}
return 150;
}
代码示例来源:origin: libgdx/libgdx
protected float getTextY (BitmapFont font, Drawable background) {
float height = getHeight();
float textY = textHeight / 2 + font.getDescent();
if (background != null) {
float bottom = background.getBottomHeight();
textY = textY + (height - background.getTopHeight() - bottom) / 2 + bottom;
} else {
textY = textY + height / 2;
}
if (font.usesIntegerPositions()) textY = (int)textY;
return textY;
}
代码示例来源:origin: libgdx/libgdx
public float getPrefHeight () {
if (prefSizeInvalid) scaleAndComputePrefSize();
float descentScaleCorrection = 1;
if (fontScaleChanged) descentScaleCorrection = fontScaleY / style.font.getScaleY();
float height = prefSize.y - style.font.getDescent() * descentScaleCorrection * 2;
Drawable background = style.background;
if (background != null) height += background.getTopHeight() + background.getBottomHeight();
return height;
}
代码示例来源:origin: libgdx/libgdx
protected float getTextY (BitmapFont font, Drawable background) {
float height = getHeight();
float textY = textHeight / 2 + font.getDescent();
if (background != null) {
float bottom = background.getBottomHeight();
textY = textY + (height - background.getTopHeight() - bottom) / 2 + bottom;
} else {
textY = textY + height / 2;
}
if (font.usesIntegerPositions()) textY = (int)textY;
return textY;
}
代码示例来源:origin: libgdx/libgdx
public float getPrefHeight () {
if (prefSizeInvalid) scaleAndComputePrefSize();
float descentScaleCorrection = 1;
if (fontScaleChanged) descentScaleCorrection = fontScaleY / style.font.getScaleY();
float height = prefSize.y - style.font.getDescent() * descentScaleCorrection * 2;
Drawable background = style.background;
if (background != null) height += background.getTopHeight() + background.getBottomHeight();
return height;
}
代码示例来源:origin: libgdx/libgdx
/** 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();
}
代码示例来源:origin: libgdx/libgdx
/** 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();
}
代码示例来源:origin: libgdx/libgdx
/** Sets the background drawable and, if adjustPadding is true, sets the container's padding to
* {@link Drawable#getBottomHeight()} , {@link Drawable#getTopHeight()}, {@link Drawable#getLeftWidth()}, and
* {@link Drawable#getRightWidth()}.
* @param background If null, the background will be cleared and padding removed. */
public void setBackground (Drawable background, boolean adjustPadding) {
if (this.background == background) return;
this.background = background;
if (adjustPadding) {
if (background == null)
pad(Value.zero);
else
pad(background.getTopHeight(), background.getLeftWidth(), background.getBottomHeight(), background.getRightWidth());
invalidate();
}
}
代码示例来源:origin: libgdx/libgdx
/** Sets the background drawable and, if adjustPadding is true, sets the container's padding to
* {@link Drawable#getBottomHeight()} , {@link Drawable#getTopHeight()}, {@link Drawable#getLeftWidth()}, and
* {@link Drawable#getRightWidth()}.
* @param background If null, the background will be cleared and padding removed. */
public void setBackground (Drawable background, boolean adjustPadding) {
if (this.background == background) return;
this.background = background;
if (adjustPadding) {
if (background == null)
pad(Value.zero);
else
pad(background.getTopHeight(), background.getLeftWidth(), background.getBottomHeight(), background.getRightWidth());
invalidate();
}
}
内容来源于网络,如有侵权,请联系作者删除!