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

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

本文整理了Java中com.badlogic.gdx.scenes.scene2d.ui.Table.pack()方法的一些代码示例,展示了Table.pack()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.pack()方法的具体详情如下:
包路径:com.badlogic.gdx.scenes.scene2d.ui.Table
类名称:Table
方法名:pack

Table.pack介绍

暂无

代码示例

代码示例来源: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

table.pack();
stage.addActor(table);
table.pack();
stage.addActor(table);

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

table.add(label);
table.add(new TextButton("Text Button", skin));
table.pack();

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

Table table = new Table().debug();
table.add(g);
table.pack();
table.setPosition(5, 100);
stage.addActor(table);
table = new Table().debug();
table.add(h);
table.pack();
table.setPosition(130, 100);
stage.addActor(table);

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

private <T extends Table> T prepareBuiltTable (final T table) {
  table.pack();
  return table;
}

代码示例来源:origin: narfman0/GDXWorld

@Override public void clicked(InputEvent event, float x, float y) {
    contents.removeActor(parentTable);
    tables.remove(table);
    contents.pack();
  }
});

代码示例来源:origin: langurmonkey/gaiasky

public void initialize(IStarFocus st) {
  this.st = st;
  table.clear();
  requestData(new GaiaDataListener(st));
  table.pack();
  //scroll.setWidth(Math.max(table.getWidth() + scroll.getStyle().vScroll.getMinWidth(), 500 * GlobalConf.SCALE_FACTOR));
  pack();
  me.setPosition(Math.round(stage.getWidth() / 2f - me.getWidth() / 2f), Math.round(stage.getHeight() / 2f - me.getHeight() / 2f));
}

代码示例来源:origin: langurmonkey/gaiasky

private void finish() {
  table.pack();
  scroll.setWidth(table.getWidth() + scroll.getStyle().vScroll.getMinWidth());
  pack();
  me.setPosition(Math.round(stage.getWidth() / 2f - me.getWidth() / 2f), Math.round(stage.getHeight() / 2f - me.getHeight() / 2f));
}

代码示例来源:origin: langurmonkey/gaiasky

public void ko(String error) {
  // Error
  Gdx.app.postRunnable(() -> {
    String msg = error;
    table.add(new OwnLabel(msg, skin, "ui-15"));
    table.pack();
    scroll.setHeight(table.getHeight() + pad);
    finish();
  });
}

代码示例来源:origin: langurmonkey/gaiasky

public void ko() {
  // Error getting data
  Gdx.app.postRunnable(() -> {
    String msg = I18n.bundle.format("error.gaiacatalog.data", st.getName());
    table.add(new OwnLabel(msg, skin, "ui-15"));
    table.pack();
    scroll.setHeight((float) Math.min(table.getHeight(), Gdx.graphics.getHeight() * 0.6) + pad);
    finish();
  });
}

代码示例来源:origin: langurmonkey/gaiasky

public void notFound() {
  // Not found
  String msg = I18n.bundle.format("error.gaiacatalog.notfound", st.getName());
  table.add(new OwnLabel(msg, skin, "ui-15"));
  table.pack();
  scroll.setHeight(table.getHeight() + pad);
  finish();
}

代码示例来源:origin: langurmonkey/gaiasky

public void recalculateSize() {
  // Save position
  float topy = getY() + getHeight();
  // Calculate new size
  guiLayout.pack();
  if (windowScroll != null) {
    windowScroll.setHeight(Math.min(guiLayout.getHeight() + 30, Gdx.graphics.getHeight() - 120));
    windowScroll.pack();
    mainVertical.setHeight(windowScroll.getHeight() + 30);
    mainVertical.pack();
    setHeight(windowScroll.getHeight() + 40);
  }
  pack();
  validate();
  // Restore position
  setY(topy - getHeight());
}

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

/** Displays toast. Toast will be displayed for given amount of seconds. */
public void show (final Toast toast, float timeSec) {
  Table toastMainTable = toast.getMainTable();
  if (toastMainTable.getStage() != null) {
    remove(toast);
  }
  toasts.add(toast);
  toast.setToastManager(this);
  toast.fadeIn();
  toastMainTable.pack();
  root.addActor(toastMainTable);
  updateToastsPositions();
  if (timeSec > 0) {
    Timer.Task fadeOutTask = new Timer.Task() {
      @Override
      public void run () {
        toast.fadeOut();
        timersTasks.remove(toast);
      }
    };
    timersTasks.put(toast, fadeOutTask);
    Timer.schedule(fadeOutTask, timeSec);
  }
}

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

/** Displays toast. Toast will be displayed for given amount of seconds. */
public Toast show (final Toast toast, float timeSec) {
  Table toastMainTable = toast.getMainTable();
  if (toastMainTable.getStage() != null) {
    remove(toast);
  }
  toasts.add(toast);
  toast.setToastManager(this);
  toast.fadeIn();
  toastMainTable.pack();
  root.addActor(toastMainTable);
  updateToastsPositions();
  if (timeSec > 0) {
    Timer.Task fadeOutTask = new Timer.Task() {
      @Override
      public void run () {
        toast.fadeOut();
        timersTasks.remove(toast);
      }
    };
    timersTasks.put(toast, fadeOutTask);
    Timer.schedule(fadeOutTask, timeSec);
  }
  return toast;
}

代码示例来源:origin: bladecoder/bladecoder-adventure-engine

panel.pack();
setWidth(getStage().getViewport().getScreenWidth());
setHeight(Math.min(panel.getHeight(), getStage().getViewport().getScreenHeight() / 2));

代码示例来源: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: bladecoder/bladecoder-adventure-engine

table.pack();
setActor(table);

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

table.pack();

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

table.pack();

代码示例来源:origin: rafaskb/typing-label

table.add(buttonPause, buttonResume, buttonRestart, buttonSkip);
table.pack();
Table.debugCellColor.set(Color.DARK_GRAY);

相关文章

微信公众号

最新文章

更多