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

x33g5p2x  于2022-01-17 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(128)

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

Button.getWidth介绍

暂无

代码示例

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

if(x < distance + buttons[0].getWidth() / 2 + margin)
  this.x = distance + buttons[0].getWidth() / 2 + margin;
else if(x > viewportWidth - distance - buttons[0].getWidth() / 2 - margin)
  this.x = viewportWidth - distance - buttons[0].getWidth() / 2 - margin;
  endPositions[i].y = (float)(Math.sin(Math.toRadians(angle))) * distance + this.y;
  buttons[i].setPosition(this.x - buttons[i].getWidth() / 2, this.y - buttons[i].getHeight() / 2);
  buttons[i].addAction(Actions
      .moveTo(endPositions[i].x - buttons[i].getWidth() / 2, endPositions[i].y - buttons[i].getWidth() / 2, .1f));

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

if (x < lookatButton.getWidth() + margin)
  this.x = lookatButton.getWidth() + margin;
else if (x > viewportWidth - lookatButton.getWidth() - margin)
  this.x = viewportWidth - lookatButton.getWidth() - margin;
lookatButton.setPosition(this.x - lookatButton.getWidth() / 2, this.y - lookatButton.getHeight() / 2);
lookatButton.addAction(Actions.moveTo(this.x - lookatButton.getWidth() - margin / 2, this.y + margin, .1f));
rightButton.setPosition(this.x - lookatButton.getWidth() / 2, this.y - lookatButton.getHeight() / 2);
rightButton.addAction(Actions.moveTo(this.x + margin / 2, this.y + margin, .1f));

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

@Override
public void resize(int width, int height) {
  final World world = ui.getWorld();
  if (!world.isDisposed()) {
    screenViewport.setWorldSize(world.getWidth(), world.getHeight());
    screenViewport.update(width, height, true);
    worldViewport.setScreenBounds(screenViewport.getScreenX(), screenViewport.getScreenY(),
        screenViewport.getScreenWidth(), screenViewport.getScreenHeight());
    world.resize(screenViewport.getWorldWidth(), screenViewport.getWorldHeight());
  }
  pointer.resize();
  verbUI.setSize(screenViewport.getScreenWidth(), screenViewport.getScreenHeight() * UI_SCREEN_PERCENT);
  float size = DPIUtils.getPrefButtonSize();
  float margin = DPIUtils.getMarginSize();
  menuButton.setSize(size, size);
  menuButton.setPosition(stage.getViewport().getScreenWidth() - menuButton.getWidth() - margin,
      stage.getViewport().getScreenHeight() - menuButton.getHeight() - margin);
}

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

@Override
public void resize(int width, int height) {
  final World world = ui.getWorld();
  if (!world.isDisposed()) {
    viewport.setWorldSize(world.getWidth(), world.getHeight());
    viewport.update(width, height, true);
    world.resize(viewport.getWorldWidth(), viewport.getWorldHeight());
  } else {
    viewport.setWorldSize(width, height);
    viewport.update(width, height, true);
  }
  updateUI();
  pie.resize(viewport.getScreenWidth(), viewport.getScreenHeight());
  inventoryUI.resize(viewport.getScreenWidth(), viewport.getScreenHeight());
  inventoryButton.resize(width, height);
  pointer.resize(width, height);
  float size = DPIUtils.getPrefButtonSize();
  float margin = DPIUtils.getMarginSize();
  menuButton.setSize(size, size);
  menuButton.setPosition(stage.getViewport().getScreenWidth() - menuButton.getWidth() - margin,
      stage.getViewport().getScreenHeight() - menuButton.getHeight() - margin);
}

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

if (b.getWidth() > maxw)
  maxw = b.getWidth();

代码示例来源:origin: xietansheng/Game2048ForGDX

againStyle.down = new TextureRegionDrawable(getMainGame().getAtlas().findRegion(Res.AtlasNames.BTN_AGAIN, 2));
againButton = new Button(againStyle);
againButton.setX(getWidth() - againButton.getWidth() - 40);
againButton.setY(140);
againButton.addListener(new ClickListener() {

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

menuButton.setPosition(getWidth() - menuButton.getWidth() / 2, (getHeight() - menuButton.getHeight()) / 2);
float iconSize = DPIUtils.getPrefButtonSize();

代码示例来源:origin: xietansheng/Game2048ForGDX

okBtnStyle.down = new TextureRegionDrawable(getMainGame().getAtlas().findRegion(Res.AtlasNames.DIALOG_BTN_OK, 2));
okButton = new Button(okBtnStyle);
okButton.setPosition(getWidth() - okButton.getWidth() - 10, 10);
okButton.getColor().a = btnAlpha;
addActor(okButton);

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

landAt.addListener(new TextTooltip(txt("gui.focusinfo.landat"), skin));
bw = Math.max(landOn.getWidth(), landAt.getWidth());
bw += 2 * GlobalConf.SCALE_FACTOR;

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

tbs.up = new TextureRegionDrawable(new TextureRegion(actor));
textButton = new TextButton("TextButton", tbs);
textButton.setPosition(button.getX() + button.getWidth() + 10, firstRowY-textButton.getHeight());
textButton.addListener( new ClickListener() {             
  @Override

相关文章