本文整理了Java中com.badlogic.gdx.scenes.scene2d.ui.Table.setPosition()
方法的一些代码示例,展示了Table.setPosition()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.setPosition()
方法的具体详情如下:
包路径:com.badlogic.gdx.scenes.scene2d.ui.Table
类名称:Table
方法名:setPosition
暂无
代码示例来源: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
@Override
public void create () {
batch = new SpriteBatch();
skin = new Skin(Gdx.files.internal("data/uiskin.json"));
stage = new Stage();
Gdx.input.setInputProcessor(stage);
Table table = new Table();
stage.addActor(table);
table.setPosition(200, 65);
Label label1 = new Label("This text is scaled 2x.", skin);
label1.setFontScale(2);
Label label2 = new Label(
"This text is scaled. This text is scaled. This text is scaled. This text is scaled. This text is scaled. ", skin);
label2.setWrap(true);
label2.setFontScale(0.75f, 0.75f);
table.debug();
table.add(label1);
table.row();
table.add(label2).fill();
table.pack();
}
代码示例来源:origin: libgdx/libgdx
stage.addActor(table);
table.setSize(260, 195);
table.setPosition(190, 142);
代码示例来源:origin: libgdx/libgdx
bottomLeft.setPosition(x, y);
bottomLeft.setSize(contWidth, contHeight);
stage.addActor(bottomLeft);
bottomRight.setSize(contWidth, contHeight);
x = bottomLeft.getX() + bottomLeft.getWidth() + gap;
bottomRight.setPosition(x, y);
stage.addActor(bottomRight);
x = bottomLeft.getX();
y = bottomLeft.getY() + bottomLeft.getHeight() + gap;
topLeft.setPosition(x, y);
stage.addActor(topLeft);
x = bottomRight.getX();
y = topLeft.getY();
topRight.setPosition(x, y);
stage.addActor(topRight);
x = topRight.getX();
y = topRight.getY() + topRight.getHeight() + gap;
horizOnlyTop.setPosition(x, y);
stage.addActor(horizOnlyTop);
x = topLeft.getX();
y = topLeft.getY() + topLeft.getHeight() + gap;
horizOnlyBottom.setPosition(x, y);
stage.addActor(horizOnlyBottom);
代码示例来源:origin: libgdx/libgdx
table.add(label).minWidth(200 * scale).minHeight(110 * scale).fill().row();
table.setPosition(50, 40 + 25 * scale);
table.pack();
stage.addActor(table);
table.add(label).align(Align.left).width(150 * scale).row();
table.setPosition(50 + 250 * scale, 40 + 25 * scale);
table.pack();
stage.addActor(table);
代码示例来源:origin: libgdx/libgdx
table.setPosition(100, 100);
table.setOrigin(0, 0);
table.setRotation(45);
代码示例来源:origin: libgdx/libgdx
table.add(g);
table.pack();
table.setPosition(5, 100);
stage.addActor(table);
table.add(h);
table.pack();
table.setPosition(130, 100);
stage.addActor(table);
table.toFront();
代码示例来源:origin: kotcrab/vis-ui
private void updateToastsPositions () {
boolean bottom = (alignment & Align.bottom) != 0;
boolean left = (alignment & Align.left) != 0;
float y = bottom ? screenPaddingY : root.getHeight() - screenPaddingY;
for (Toast toast : toasts) {
Table table = toast.getMainTable();
table.setPosition(
left ? screenPaddingX : root.getWidth() - table.getWidth() - screenPaddingX,
bottom ? y : y - table.getHeight());
y += (table.getHeight() + messagePadding) * (bottom ? 1 : -1);
}
}
代码示例来源:origin: crashinvaders/gdx-texture-packer-gui
private void updateToastsPositions () {
boolean bottom = (alignment & Align.bottom) != 0;
boolean left = (alignment & Align.left) != 0;
float y = bottom ? screenPadding : root.getHeight() - screenPadding;
for (Toast toast : toasts) {
Table table = toast.getMainTable();
table.setPosition(
left ? screenPadding : root.getWidth() - table.getWidth() - screenPadding,
bottom ? y : y - table.getHeight());
y += (table.getHeight() + messagePadding) * (bottom ? 1 : -1);
}
}
代码示例来源: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: 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);
}
代码示例来源:origin: moribitotech/MTX
levelsTable1.setPosition(-999, 0);
levelsTable1.addAction(Actions.moveTo(0, 0, 0.7f));
levelsTable1.top().left().pad(30, 30, 30, 30);
代码示例来源:origin: moribitotech/MTX
tableButtons.setPosition(getStage().getWidth() / 2 - tableButtons.getWidth() / 2, 50);
getStage().addActor(tableButtons);
代码示例来源:origin: moribitotech/MTX
table.setPosition(getStage().getWidth() + 50, table.getY());
table.addAction(Actions.moveTo(getStage().getWidth() - 550, table.getY(), 0.9f));
table.row();
代码示例来源:origin: 121077313/cocostudio-ui-libgdx
table.setPosition(actor.getX(), actor.getY());
代码示例来源:origin: moribitotech/MTX
tableButtons.setPosition(getStage().getWidth() / 2 - tableButtons.getWidth() /2, 50);
getStage().addActor(tableButtons);
代码示例来源:origin: dsaltares/libgdx-cookbook
table.setPosition(600, 85);
table.debug();
内容来源于网络,如有侵权,请联系作者删除!