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

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

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

  1. public void resize (int width, int height) {
  2. ui.getViewport().update(width, height, true);
  3. container.setSize(width, height);
  4. if (test != null) {
  5. test.resize(width, height);
  6. }
  7. }

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

  1. @Override
  2. public void resize (int width, int height) {
  3. ui.setSize(width, height);
  4. ui.invalidate();
  5. stage.getViewport().update(width, height, true);
  6. }

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

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

  1. private void setupUi () {
  2. // setup a tiny ui with a console and a clear button.
  3. skin = new Skin(Gdx.files.internal("data/uiskin.json"));
  4. stage = new Stage();
  5. ui = new Table();
  6. ui.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
  7. console = new List(skin);
  8. scrollPane = new ScrollPane(console);
  9. scrollPane.setScrollbarsOnTop(true);
  10. TextButton clear = new TextButton("Clear", skin);
  11. ui.add(scrollPane).expand(true, true).fill();
  12. ui.row();
  13. ui.add(clear).expand(true, false).fill();
  14. stage.addActor(ui);
  15. clear.addListener(new ClickListener() {
  16. @Override
  17. public void clicked (InputEvent event, float x, float y) {
  18. clear();
  19. }
  20. });
  21. Gdx.input.setInputProcessor(stage);
  22. }

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

  1. private void createUI () {
  2. skin = new Skin(Gdx.files.internal("data/uiskin.json"));
  3. ui = new Stage();
  4. String[] filters = new String[TextureFilter.values().length];
  5. int idx = 0;
  6. for (TextureFilter filter : TextureFilter.values()) {
  7. filters[idx++] = filter.toString();
  8. }
  9. hwMipMap = new CheckBox("Hardware Mips", skin);
  10. minFilter = new SelectBox(skin);
  11. minFilter.setItems(filters);
  12. magFilter = new SelectBox(skin.get(SelectBoxStyle.class));
  13. magFilter.setItems("Nearest", "Linear");
  14. Table table = new Table();
  15. table.setSize(ui.getWidth(), 30);
  16. table.setY(ui.getHeight() - 30);
  17. table.add(hwMipMap).spaceRight(5);
  18. table.add(new Label("Min Filter", skin)).spaceRight(5);
  19. table.add(minFilter).spaceRight(5);
  20. table.add(new Label("Mag Filter", skin)).spaceRight(5);
  21. table.add(magFilter);
  22. ui.addActor(table);
  23. }

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

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

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

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

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

  1. import org.eclipse.swt.SWT;
  2. import org.eclipse.swt.widgets.Display;
  3. import org.eclipse.swt.widgets.Shell;
  4. import org.eclipse.swt.widgets.Table;
  5. import org.eclipse.swt.widgets.TableItem;
  6. public class TableCheckBoxCell {
  7. public static void main(String[] args) {
  8. Display display = new Display();
  9. Shell shell = new Shell(display);
  10. Table table = new Table(shell, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
  11. for (int i = 0; i < 12; i++) {
  12. TableItem item = new TableItem(table, SWT.NONE);
  13. item.setText("Item " + i);
  14. }
  15. table.setSize(100, 100);
  16. shell.setSize(200, 200);
  17. shell.open();
  18. while (!shell.isDisposed()) {
  19. if (!display.readAndDispatch())
  20. display.sleep();
  21. }
  22. display.dispose();
  23. }
  24. }

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

  1. @Override
  2. public Group groupChildrenParse(CocoCreatorUIEditor editor,
  3. ObjectData widget, Group parent, Actor actor) {
  4. ScrollPane scrollPane = (ScrollPane) actor;
  5. Table table = new Table();
  6. for (ObjectData childrenWidget : widget.getChildren()) {
  7. Actor childrenActor = editor.parseWidget(table, childrenWidget);
  8. if (childrenActor == null) {
  9. continue;
  10. }
  11. table.setSize(Math.max(table.getWidth(), childrenActor.getRight()),
  12. Math.max(table.getHeight(), childrenActor.getTop()));
  13. table.addActor(childrenActor);
  14. }
  15. sort(widget, table);
  16. //
  17. scrollPane.setWidget(table);
  18. return scrollPane;
  19. }

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

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

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

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

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

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

相关文章