com.badlogic.gdx.scenes.scene2d.ui.Table.setPosition()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(316)

本文整理了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

Table.setPosition介绍

暂无

代码示例

代码示例来源:origin: libgdx/libgdx

  1. protected void drawBackground (Batch batch, float parentAlpha, float x, float y) {
  2. super.drawBackground(batch, parentAlpha, x, y);
  3. // Manually draw the title table before clipping is done.
  4. titleTable.getColor().a = getColor().a;
  5. float padTop = getPadTop(), padLeft = getPadLeft();
  6. titleTable.setSize(getWidth() - padLeft - getPadRight(), padTop);
  7. titleTable.setPosition(padLeft, getHeight() - padTop);
  8. drawTitleTable = true;
  9. titleTable.draw(batch, parentAlpha);
  10. drawTitleTable = false; // Avoid drawing the title table again in drawChildren.
  11. }

代码示例来源:origin: libgdx/libgdx

  1. protected void drawBackground (Batch batch, float parentAlpha, float x, float y) {
  2. super.drawBackground(batch, parentAlpha, x, y);
  3. // Manually draw the title table before clipping is done.
  4. titleTable.getColor().a = getColor().a;
  5. float padTop = getPadTop(), padLeft = getPadLeft();
  6. titleTable.setSize(getWidth() - padLeft - getPadRight(), padTop);
  7. titleTable.setPosition(padLeft, getHeight() - padTop);
  8. drawTitleTable = true;
  9. titleTable.draw(batch, parentAlpha);
  10. drawTitleTable = false; // Avoid drawing the title table again in drawChildren.
  11. }

代码示例来源:origin: libgdx/libgdx

  1. @Override
  2. public void create () {
  3. batch = new SpriteBatch();
  4. skin = new Skin(Gdx.files.internal("data/uiskin.json"));
  5. stage = new Stage();
  6. Gdx.input.setInputProcessor(stage);
  7. Table table = new Table();
  8. stage.addActor(table);
  9. table.setPosition(200, 65);
  10. Label label1 = new Label("This text is scaled 2x.", skin);
  11. label1.setFontScale(2);
  12. Label label2 = new Label(
  13. "This text is scaled. This text is scaled. This text is scaled. This text is scaled. This text is scaled. ", skin);
  14. label2.setWrap(true);
  15. label2.setFontScale(0.75f, 0.75f);
  16. table.debug();
  17. table.add(label1);
  18. table.row();
  19. table.add(label2).fill();
  20. table.pack();
  21. }

代码示例来源:origin: libgdx/libgdx

  1. stage.addActor(table);
  2. table.setSize(260, 195);
  3. table.setPosition(190, 142);

代码示例来源:origin: libgdx/libgdx

  1. bottomLeft.setPosition(x, y);
  2. bottomLeft.setSize(contWidth, contHeight);
  3. stage.addActor(bottomLeft);
  4. bottomRight.setSize(contWidth, contHeight);
  5. x = bottomLeft.getX() + bottomLeft.getWidth() + gap;
  6. bottomRight.setPosition(x, y);
  7. stage.addActor(bottomRight);
  8. x = bottomLeft.getX();
  9. y = bottomLeft.getY() + bottomLeft.getHeight() + gap;
  10. topLeft.setPosition(x, y);
  11. stage.addActor(topLeft);
  12. x = bottomRight.getX();
  13. y = topLeft.getY();
  14. topRight.setPosition(x, y);
  15. stage.addActor(topRight);
  16. x = topRight.getX();
  17. y = topRight.getY() + topRight.getHeight() + gap;
  18. horizOnlyTop.setPosition(x, y);
  19. stage.addActor(horizOnlyTop);
  20. x = topLeft.getX();
  21. y = topLeft.getY() + topLeft.getHeight() + gap;
  22. horizOnlyBottom.setPosition(x, y);
  23. stage.addActor(horizOnlyBottom);

代码示例来源:origin: libgdx/libgdx

  1. table.add(label).minWidth(200 * scale).minHeight(110 * scale).fill().row();
  2. table.setPosition(50, 40 + 25 * scale);
  3. table.pack();
  4. stage.addActor(table);
  5. table.add(label).align(Align.left).width(150 * scale).row();
  6. table.setPosition(50 + 250 * scale, 40 + 25 * scale);
  7. table.pack();
  8. stage.addActor(table);

代码示例来源:origin: libgdx/libgdx

  1. table.setPosition(100, 100);
  2. table.setOrigin(0, 0);
  3. table.setRotation(45);

代码示例来源:origin: libgdx/libgdx

  1. table.add(g);
  2. table.pack();
  3. table.setPosition(5, 100);
  4. stage.addActor(table);
  5. table.add(h);
  6. table.pack();
  7. table.setPosition(130, 100);
  8. stage.addActor(table);
  9. table.toFront();

代码示例来源:origin: kotcrab/vis-ui

  1. private void updateToastsPositions () {
  2. boolean bottom = (alignment & Align.bottom) != 0;
  3. boolean left = (alignment & Align.left) != 0;
  4. float y = bottom ? screenPaddingY : root.getHeight() - screenPaddingY;
  5. for (Toast toast : toasts) {
  6. Table table = toast.getMainTable();
  7. table.setPosition(
  8. left ? screenPaddingX : root.getWidth() - table.getWidth() - screenPaddingX,
  9. bottom ? y : y - table.getHeight());
  10. y += (table.getHeight() + messagePadding) * (bottom ? 1 : -1);
  11. }
  12. }

代码示例来源:origin: crashinvaders/gdx-texture-packer-gui

  1. private void updateToastsPositions () {
  2. boolean bottom = (alignment & Align.bottom) != 0;
  3. boolean left = (alignment & Align.left) != 0;
  4. float y = bottom ? screenPadding : root.getHeight() - screenPadding;
  5. for (Toast toast : toasts) {
  6. Table table = toast.getMainTable();
  7. table.setPosition(
  8. left ? screenPadding : root.getWidth() - table.getWidth() - screenPadding,
  9. bottom ? y : y - table.getHeight());
  10. y += (table.getHeight() + messagePadding) * (bottom ? 1 : -1);
  11. }
  12. }

代码示例来源:origin: com.github.xaguzman/gamedevlib-libgdx

  1. protected void drawBackground (Batch batch, float parentAlpha, float x, float y) {
  2. super.drawBackground(batch, parentAlpha, x, y);
  3. // Manually draw the title table before clipping is done.
  4. titleTable.getColor().a = getColor().a;
  5. float padTop = getPadTop(), padLeft = getPadLeft();
  6. titleTable.setSize(getWidth() - padLeft - getPadRight(), padTop);
  7. titleTable.setPosition(padLeft, getHeight() - padTop);
  8. drawTitleTable = true;
  9. titleTable.draw(batch, parentAlpha);
  10. drawTitleTable = false; // Avoid drawing the title table again in drawChildren.
  11. }

代码示例来源:origin: com.badlogicgames.gdx/gdx

  1. protected void drawBackground (Batch batch, float parentAlpha, float x, float y) {
  2. super.drawBackground(batch, parentAlpha, x, y);
  3. // Manually draw the title table before clipping is done.
  4. titleTable.getColor().a = getColor().a;
  5. float padTop = getPadTop(), padLeft = getPadLeft();
  6. titleTable.setSize(getWidth() - padLeft - getPadRight(), padTop);
  7. titleTable.setPosition(padLeft, getHeight() - padTop);
  8. drawTitleTable = true;
  9. titleTable.draw(batch, parentAlpha);
  10. drawTitleTable = false; // Avoid drawing the title table again in drawChildren.
  11. }

代码示例来源:origin: manuelbua/uracer-kotd

  1. @Override
  2. protected void drawBackground (Batch batch, float parentAlpha, float x, float y) {
  3. float width = getWidth(), height = getHeight();
  4. float padTop = getPadTop();
  5. super.drawBackground(batch, parentAlpha, x, y);
  6. // Draw button table.
  7. buttonTable.getColor().a = getColor().a;
  8. buttonTable.pack();
  9. buttonTable.setPosition(width - buttonTable.getWidth(), Math.min(height - padTop, height - buttonTable.getHeight()));
  10. buttonTable.draw(batch, parentAlpha);
  11. // Draw the title without the batch transformed or clipping applied.
  12. y += height;
  13. TextBounds bounds = titleCache.getBounds();
  14. if ((titleAlignment & Align.left) != 0)
  15. x += getPadLeft();
  16. else if ((titleAlignment & Align.right) != 0)
  17. x += width - bounds.width - getPadRight();
  18. else
  19. x += (width - bounds.width) / 2;
  20. if ((titleAlignment & Align.top) == 0) {
  21. if ((titleAlignment & Align.bottom) != 0)
  22. y -= padTop - bounds.height;
  23. else
  24. y -= (padTop - bounds.height) / 2;
  25. }
  26. titleCache.setColors(tmpColor.set(getColor()).mul(style.titleFontColor));
  27. titleCache.setPosition((int)x, (int)y - 15); // HACK for Kenney's skin only!!
  28. titleCache.draw(batch, parentAlpha);
  29. }

代码示例来源:origin: moribitotech/MTX

  1. levelsTable1.setPosition(-999, 0);
  2. levelsTable1.addAction(Actions.moveTo(0, 0, 0.7f));
  3. levelsTable1.top().left().pad(30, 30, 30, 30);

代码示例来源:origin: moribitotech/MTX

  1. tableButtons.setPosition(getStage().getWidth() / 2 - tableButtons.getWidth() / 2, 50);
  2. getStage().addActor(tableButtons);

代码示例来源:origin: moribitotech/MTX

  1. table.setPosition(getStage().getWidth() + 50, table.getY());
  2. table.addAction(Actions.moveTo(getStage().getWidth() - 550, table.getY(), 0.9f));
  3. table.row();

代码示例来源:origin: 121077313/cocostudio-ui-libgdx

  1. table.setPosition(actor.getX(), actor.getY());

代码示例来源:origin: moribitotech/MTX

  1. tableButtons.setPosition(getStage().getWidth() / 2 - tableButtons.getWidth() /2, 50);
  2. getStage().addActor(tableButtons);

代码示例来源:origin: dsaltares/libgdx-cookbook

  1. table.setPosition(600, 85);
  2. table.debug();

相关文章