本文整理了Java中com.badlogic.gdx.scenes.scene2d.ui.Table.drawBackground()
方法的一些代码示例,展示了Table.drawBackground()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.drawBackground()
方法的具体详情如下:
包路径:com.badlogic.gdx.scenes.scene2d.ui.Table
类名称:Table
方法名:drawBackground
[英]Called to draw the background, before clipping is applied (if enabled). Default implementation draws the background drawable.
[中]
代码示例来源:origin: libgdx/libgdx
protected void drawBackground (Batch batch, float parentAlpha, float x, float y) {
super.drawBackground(batch, parentAlpha, x, y);
// Manually draw the title table before clipping is done.
titleTable.getColor().a = getColor().a;
float padTop = getPadTop(), padLeft = getPadLeft();
titleTable.setSize(getWidth() - padLeft - getPadRight(), padTop);
titleTable.setPosition(padLeft, getHeight() - padTop);
drawTitleTable = true;
titleTable.draw(batch, parentAlpha);
drawTitleTable = false; // Avoid drawing the title table again in drawChildren.
}
代码示例来源:origin: libgdx/libgdx
protected void drawBackground (Batch batch, float parentAlpha, float x, float y) {
super.drawBackground(batch, parentAlpha, x, y);
// Manually draw the title table before clipping is done.
titleTable.getColor().a = getColor().a;
float padTop = getPadTop(), padLeft = getPadLeft();
titleTable.setSize(getWidth() - padLeft - getPadRight(), padTop);
titleTable.setPosition(padLeft, getHeight() - padTop);
drawTitleTable = true;
titleTable.draw(batch, parentAlpha);
drawTitleTable = false; // Avoid drawing the title table again in drawChildren.
}
代码示例来源:origin: libgdx/libgdx
public void draw (Batch batch, float parentAlpha) {
validate();
if (isTransform()) {
applyTransform(batch, computeTransform());
drawBackground(batch, parentAlpha, 0, 0);
if (clip) {
batch.flush();
float padLeft = this.padLeft.get(this), padBottom = this.padBottom.get(this);
if (clipBegin(padLeft, padBottom, getWidth() - padLeft - padRight.get(this),
getHeight() - padBottom - padTop.get(this))) {
drawChildren(batch, parentAlpha);
batch.flush();
clipEnd();
}
} else
drawChildren(batch, parentAlpha);
resetTransform(batch);
} else {
drawBackground(batch, parentAlpha, getX(), getY());
super.draw(batch, parentAlpha);
}
}
代码示例来源:origin: libgdx/libgdx
public void draw (Batch batch, float parentAlpha) {
validate();
if (isTransform()) {
applyTransform(batch, computeTransform());
drawBackground(batch, parentAlpha, 0, 0);
if (clip) {
batch.flush();
float padLeft = this.padLeft.get(this), padBottom = this.padBottom.get(this);
if (clipBegin(padLeft, padBottom, getWidth() - padLeft - padRight.get(this),
getHeight() - padBottom - padTop.get(this))) {
drawChildren(batch, parentAlpha);
batch.flush();
clipEnd();
}
} else
drawChildren(batch, parentAlpha);
resetTransform(batch);
} else {
drawBackground(batch, parentAlpha, getX(), getY());
super.draw(batch, parentAlpha);
}
}
代码示例来源:origin: com.github.xaguzman/gamedevlib-libgdx
protected void drawBackground (Batch batch, float parentAlpha, float x, float y) {
super.drawBackground(batch, parentAlpha, x, y);
// Manually draw the title table before clipping is done.
titleTable.getColor().a = getColor().a;
float padTop = getPadTop(), padLeft = getPadLeft();
titleTable.setSize(getWidth() - padLeft - getPadRight(), padTop);
titleTable.setPosition(padLeft, getHeight() - padTop);
drawTitleTable = true;
titleTable.draw(batch, parentAlpha);
drawTitleTable = false; // Avoid drawing the title table again in drawChildren.
}
代码示例来源:origin: com.badlogicgames.gdx/gdx
protected void drawBackground (Batch batch, float parentAlpha, float x, float y) {
super.drawBackground(batch, parentAlpha, x, y);
// Manually draw the title table before clipping is done.
titleTable.getColor().a = getColor().a;
float padTop = getPadTop(), padLeft = getPadLeft();
titleTable.setSize(getWidth() - padLeft - getPadRight(), padTop);
titleTable.setPosition(padLeft, getHeight() - padTop);
drawTitleTable = true;
titleTable.draw(batch, parentAlpha);
drawTitleTable = false; // Avoid drawing the title table again in drawChildren.
}
代码示例来源:origin: com.badlogicgames.gdx/gdx
public void draw (Batch batch, float parentAlpha) {
validate();
if (isTransform()) {
applyTransform(batch, computeTransform());
drawBackground(batch, parentAlpha, 0, 0);
if (clip) {
batch.flush();
float padLeft = this.padLeft.get(this), padBottom = this.padBottom.get(this);
if (clipBegin(padLeft, padBottom, getWidth() - padLeft - padRight.get(this),
getHeight() - padBottom - padTop.get(this))) {
drawChildren(batch, parentAlpha);
batch.flush();
clipEnd();
}
} else
drawChildren(batch, parentAlpha);
resetTransform(batch);
} else {
drawBackground(batch, parentAlpha, getX(), getY());
super.draw(batch, parentAlpha);
}
}
代码示例来源:origin: manuelbua/uracer-kotd
@Override
protected void drawBackground (Batch batch, float parentAlpha, float x, float y) {
float width = getWidth(), height = getHeight();
float padTop = getPadTop();
super.drawBackground(batch, parentAlpha, x, y);
// Draw button table.
buttonTable.getColor().a = getColor().a;
buttonTable.pack();
buttonTable.setPosition(width - buttonTable.getWidth(), Math.min(height - padTop, height - buttonTable.getHeight()));
buttonTable.draw(batch, parentAlpha);
// Draw the title without the batch transformed or clipping applied.
y += height;
TextBounds bounds = titleCache.getBounds();
if ((titleAlignment & Align.left) != 0)
x += getPadLeft();
else if ((titleAlignment & Align.right) != 0)
x += width - bounds.width - getPadRight();
else
x += (width - bounds.width) / 2;
if ((titleAlignment & Align.top) == 0) {
if ((titleAlignment & Align.bottom) != 0)
y -= padTop - bounds.height;
else
y -= (padTop - bounds.height) / 2;
}
titleCache.setColors(tmpColor.set(getColor()).mul(style.titleFontColor));
titleCache.setPosition((int)x, (int)y - 15); // HACK for Kenney's skin only!!
titleCache.draw(batch, parentAlpha);
}
内容来源于网络,如有侵权,请联系作者删除!