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

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

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

Table.setSize介绍

暂无

代码示例

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

public void resize (int width, int height) {
  ui.getViewport().update(width, height, true);
  container.setSize(width, height);
  if (test != null) {
    test.resize(width, height);
  }
}

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

@Override
public void resize (int width, int height) {
  ui.setSize(width, height);
  ui.invalidate();
  stage.getViewport().update(width, height, true);
}

代码示例来源: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 () {
  skin = new Skin(Gdx.files.internal("data/uiskin.json"));
  image2 = new TextureRegion(new Texture(Gdx.files.internal("data/badlogic.jpg")));
  ui = new Stage();
  Gdx.input.setInputProcessor(ui);
  root = new Table();
  root.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
  ui.addActor(root);
  root.debug();
  Image image = new Image(image2);
  image.setScaling(Scaling.fill);
  root.add(image).width(image2.getRegionWidth()).height(image2.getRegionHeight());
}

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

private void setupUi () {
  // setup a tiny ui with a console and a clear button.
  skin = new Skin(Gdx.files.internal("data/uiskin.json"));
  stage = new Stage();
  ui = new Table();
  ui.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
  console = new List(skin);
  scrollPane = new ScrollPane(console);
  scrollPane.setScrollbarsOnTop(true);
  TextButton clear = new TextButton("Clear", skin);
  ui.add(scrollPane).expand(true, true).fill();
  ui.row();
  ui.add(clear).expand(true, false).fill();
  stage.addActor(ui);
  clear.addListener(new ClickListener() {
    @Override
    public void clicked (InputEvent event, float x, float y) {
      clear();
    }
  });
  Gdx.input.setInputProcessor(stage);
}

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

private void createUI () {
  skin = new Skin(Gdx.files.internal("data/uiskin.json"));
  ui = new Stage();
  String[] filters = new String[TextureFilter.values().length];
  int idx = 0;
  for (TextureFilter filter : TextureFilter.values()) {
    filters[idx++] = filter.toString();
  }
  hwMipMap = new CheckBox("Hardware Mips", skin);
  minFilter = new SelectBox(skin);
  minFilter.setItems(filters);
  magFilter = new SelectBox(skin.get(SelectBoxStyle.class));
  magFilter.setItems("Nearest", "Linear");
  Table table = new Table();
  table.setSize(ui.getWidth(), 30);
  table.setY(ui.getHeight() - 30);
  table.add(hwMipMap).spaceRight(5);
  table.add(new Label("Min Filter", skin)).spaceRight(5);
  table.add(minFilter).spaceRight(5);
  table.add(new Label("Mag Filter", skin)).spaceRight(5);
  table.add(magFilter);
  ui.addActor(table);
}

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

table.setSize(260, 195);
table.setPosition(190, 142);

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

bottomLeft.setSize(contWidth, contHeight);
stage.addActor(bottomLeft);
bottomRight.setSize(contWidth, contHeight);
x = bottomLeft.getX() + bottomLeft.getWidth() + gap;
bottomRight.setPosition(x, y);
topLeft.setSize(contWidth, contHeight);
x = bottomLeft.getX();
y = bottomLeft.getY() + bottomLeft.getHeight() + gap;
topRight.setSize(contWidth, contHeight);
x = bottomRight.getX();
y = topLeft.getY();
horizOnlyTop.setSize(contWidth, contHeight);
x = topRight.getX();
y = topRight.getY() + topRight.getHeight() + gap;
horizOnlyBottom.setSize(contWidth, contHeight);
x = topLeft.getX();
y = topLeft.getY() + topLeft.getHeight() + gap;
vertOnlyLeft.setSize(contWidth, contHeight);
x = horizOnlyBottom.getX();
y = horizOnlyBottom.getY() + horizOnlyBottom.getHeight() + gap;
vertOnlyRight.setSize(contWidth, contHeight);
x = horizOnlyTop.getX();

代码示例来源:origin: stackoverflow.com

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;

public class TableCheckBoxCell {

 public static void main(String[] args) {
  Display display = new Display();
  Shell shell = new Shell(display);
  Table table = new Table(shell, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
  for (int i = 0; i < 12; i++) {
   TableItem item = new TableItem(table, SWT.NONE);
   item.setText("Item " + i);
  }
  table.setSize(100, 100);

  shell.setSize(200, 200);
  shell.open();
  while (!shell.isDisposed()) {
   if (!display.readAndDispatch())
    display.sleep();
  }
  display.dispose();
 }
}

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

@Override
public Group groupChildrenParse(CocoCreatorUIEditor editor,
    ObjectData widget, Group parent, Actor actor) {
  ScrollPane scrollPane = (ScrollPane) actor;
  Table table = new Table();
  for (ObjectData childrenWidget : widget.getChildren()) {
    Actor childrenActor = editor.parseWidget(table, childrenWidget);
    if (childrenActor == null) {
      continue;
    }
    table.setSize(Math.max(table.getWidth(), childrenActor.getRight()),
        Math.max(table.getHeight(), childrenActor.getTop()));
    table.addActor(childrenActor);
  }
  sort(widget, table);
  //
  scrollPane.setWidget(table);
  return scrollPane;
}

代码示例来源: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.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: jsjolund/GdxDemo3D

public void resize(int width, int height) {
  getViewport().update(width, height, false);
  cameraUI.viewportWidth = viewport.getScreenWidth();
  cameraUI.viewportHeight = viewport.getScreenHeight();
  cameraUI.position.set(viewport.getScreenWidth() / 2, viewport.getScreenHeight() / 2, 0);
  cameraUI.update();
  batch.setProjectionMatrix(cameraUI.combined);
  shapeRenderer.setProjectionMatrix(cameraUI.combined);
  // Resize the root table that will auto-scale if needed
  rootTable.setSize(viewport.getScreenWidth(), viewport.getScreenHeight());
}

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

table.setSize(widget.getInnerNodeSize().getWidth(), widget
    .getInnerNodeSize().getHeight());

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

table.setSize(actor.getWidth(), actor.getHeight());
table.setPosition(actor.getX(), actor.getY());

相关文章

微信公众号

最新文章

更多