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

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

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

Table.getPrefWidth介绍

暂无

代码示例

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

public float getPrefWidth () {
  return Math.max(super.getPrefWidth(), titleTable.getPrefWidth() + getPadLeft() + getPadRight());
}

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

public float getPrefWidth () {
  return Math.max(super.getPrefWidth(), titleTable.getPrefWidth() + getPadLeft() + getPadRight());
}

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

public float getPrefWidth () {
  float width = super.getPrefWidth();
  if (style.up != null) width = Math.max(width, style.up.getMinWidth());
  if (style.down != null) width = Math.max(width, style.down.getMinWidth());
  if (style.checked != null) width = Math.max(width, style.checked.getMinWidth());
  return width;
}

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

public float getPrefWidth () {
  float width = super.getPrefWidth();
  if (style.up != null) width = Math.max(width, style.up.getMinWidth());
  if (style.down != null) width = Math.max(width, style.down.getMinWidth());
  if (style.checked != null) width = Math.max(width, style.checked.getMinWidth());
  return width;
}

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

table2.setTransform(true);
table2.setScaleX(1.5f);
table2.setOrigin(table2.getPrefWidth() / 2, table2.getPrefHeight() / 2);

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

@Override
public float getPrefWidth () {
  if (table == null) return 0;
  if (actionRunning == false) {
    if (collapsed)
      return 0;
    else
      return table.getPrefWidth();
  }
  return currentWidth;
}

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

@Override
public float getPrefWidth () {
  return table == null ? 0 : table.getPrefWidth();
}

代码示例来源:origin: mbrlabs/Mundus

@Override
public float getPrefWidth() {
  return table == null ? 0 : table.getPrefWidth();
}

代码示例来源:origin: jsjolund/GdxDemo3D

public float getPrefWidth() {
  return super.getPrefWidth() * scale;
}

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

@Override
  public boolean act (float delta) {
    if (collapsed) {
      currentWidth -= delta * 1000;
      if (currentWidth <= 0) {
        currentWidth = 0;
        collapsed = true;
        actionRunning = false;
      }
    } else {
      currentWidth += delta * 1000;
      if (currentWidth > table.getPrefWidth()) {
        currentWidth = table.getPrefWidth();
        collapsed = false;
        actionRunning = false;
      }
    }
    invalidateHierarchy();
    return !actionRunning;
  }
}

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

@Override
public void layout () {
  if (table == null) return;
  table.setBounds(0, 0, table.getPrefWidth(), table.getPrefHeight());
  if (actionRunning == false) {
    if (collapsed)
      currentWidth = 0;
    else
      currentWidth = table.getPrefWidth();
  }
}

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

public float getPrefWidth () {
  float width = super.getPrefWidth();
  if (style.background != null) width = Math.max(width, style.background.getMinWidth());
  return width;
}

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

public float getPrefWidth () {
  return Math.max(super.getPrefWidth(), titleTable.getPrefWidth() + getPadLeft() + getPadRight());
}

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

public float getPrefWidth () {
  float width = super.getPrefWidth();
  if (style.up != null) width = Math.max(width, style.up.getMinWidth());
  if (style.down != null) width = Math.max(width, style.down.getMinWidth());
  if (style.checked != null) width = Math.max(width, style.checked.getMinWidth());
  return width;
}

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

@Override
  public float get (Actor actor) {
    if (actor instanceof Widget) {
      Widget widget = (Widget) actor;
      return widget.isVisible() ? widget.getPrefWidth() : 0;
    }

    if (actor instanceof Table) {
      Table table = (Table) actor;
      return table.isVisible() ? table.getPrefWidth() : 0;
    }

    throw new IllegalStateException("Unsupported actor type for PrefWidthIfVisibleValue: " + actor.getClass());
  }
}

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

public float getPrefWidth () {
  return Math.max(super.getPrefWidth(), titleLabel.getPrefWidth() + getPadLeft() + getPadRight());
}

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

@Override
public float getPrefWidth () {
  return Math.max(super.getPrefWidth(), getTitleWidth() + getPadLeft() + getPadRight());
}

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

@Override
public void layout () {
  if (table == null) return;
  table.setBounds(0, 0, table.getPrefWidth(), table.getPrefHeight());
  if (actionRunning == false) {
    if (collapsed)
      currentHeight = 0;
    else
      currentHeight = table.getPrefHeight();
  }
}

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

public void setCollapsed (boolean collapse, boolean withAnimation) {
  this.collapsed = collapse;
  updateTouchable();
  if (table == null) return;
  actionRunning = true;
  if (withAnimation) {
    addAction(collapseAction);
  } else {
    if (collapse) {
      currentWidth = 0;
      collapsed = true;
    } else {
      currentWidth = table.getPrefWidth();
      collapsed = false;
    }
    actionRunning = false;
    invalidateHierarchy();
  }
}

代码示例来源:origin: jsjolund/GdxDemo3D

@Override
      protected void sizeChanged () {
        super.sizeChanged();
        
        float scaleX = 1;
        float scaleY = 1;
        float scaleTolerance = 0.001f;
        if (getPrefWidth() > getWidth())
          scaleX -= (rootTable.getPrefWidth() - getWidth()) / (float) getPrefWidth();
//                if (getPrefHeight() > getHeight())
//                    scaleY -= (getPrefHeight() - getHeight()) / (float)getPrefHeight();

        if (MathUtils.isEqual(scaleX, 1, scaleTolerance) && MathUtils.isEqual(scaleY, 1, scaleTolerance)) {
          Gdx.app.log(TAG, "No need to scale rootTable: scaleX = " + scaleX + "  scaleY = " + scaleY);
          setTransform(false);
          setOrigin(0, 0);
          setScale(1);
        } else {
          Gdx.app.log(TAG, "Scaling rootTable: scaleX = " + scaleX + "  scaleY = " + scaleY);
          setTransform(true);
          setOrigin(0, 0);
          setScale(scaleX, scaleY);
        }
      }
    };

相关文章

微信公众号

最新文章

更多