本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.utils.Layout类的典型用法代码示例。如果您正苦于以下问题:Java Layout类的具体用法?Java Layout怎么用?Java Layout使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Layout类属于com.badlogic.gdx.scenes.scene2d.utils包,在下文中一共展示了Layout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPrefWidth
import com.badlogic.gdx.scenes.scene2d.utils.Layout; //导入依赖的package包/类
@Override public float getPrefWidth() {
if (selectedIndex == -1)
return 0;
validate();
float headersWidth = 0;
float maxWidth = 0f;
for (Actor header : headers) {
maxWidth = Math.max(header instanceof Layout ? ((Layout) header).getPrefWidth() : header.getWidth(), maxWidth);
}
headersWidth += maxWidth * headers.size;
headersWidth += headersLeftOffset;
headersWidth += headersRightOffset;
headersWidth += headersBetweenOffset * (headers.size - 1);
float contentsWidth = 0;
for (Actor content : contents) {
contentsWidth = Math.max(contentsWidth, content instanceof Layout ? ((Layout) content).getPrefWidth() : content.getWidth());
}
return Math.max(contentsWidth, headersWidth);
}
示例2: layout
import com.badlogic.gdx.scenes.scene2d.utils.Layout; //导入依赖的package包/类
@Override
public void layout() {
if (!vertical)
calculateHorizBoundsAndPositions();
else
calculateVertBoundsAndPositions();
Actor firstWidget = this.firstWidget;
if (firstWidget != null) {
Rectangle firstWidgetBounds = this.firstWidgetBounds;
firstWidget.setBounds(firstWidgetBounds.x, firstWidgetBounds.y, firstWidgetBounds.width,
firstWidgetBounds.height);
if (firstWidget instanceof Layout) ((Layout) firstWidget).validate();
}
Actor secondWidget = this.secondWidget;
if (secondWidget != null) {
Rectangle secondWidgetBounds = this.secondWidgetBounds;
secondWidget.setBounds(secondWidgetBounds.x, secondWidgetBounds.y, secondWidgetBounds.width,
secondWidgetBounds.height);
if (secondWidget instanceof Layout) ((Layout) secondWidget).validate();
}
}
示例3: computeSize
import com.badlogic.gdx.scenes.scene2d.utils.Layout; //导入依赖的package包/类
private void computeSize() {
sizeInvalid = false;
maxWidth = minWidth = prefWidth = getStage().getWidth() - 5;
maxHeight = minHeight = prefHeight = 0;
SnapshotArray<Actor> children = getChildren();
for (int i = 0, n = children.size; i < n; i++) {
Actor child = children.get(i);
if (!child.isVisible()) {
continue;
}
if (child instanceof Layout) {
Layout layout = (Layout) child;
prefHeight += layout.getPrefHeight();
minHeight += layout.getMinHeight();
} else {
prefHeight += child.getHeight();
minHeight += child.getHeight();
}
}
}
示例4: computeSize
import com.badlogic.gdx.scenes.scene2d.utils.Layout; //导入依赖的package包/类
private void computeSize () {
sizeInvalid = false;
SnapshotArray<Actor> children = getChildren();
int n = children.size;
prefWidth = 0;
prefHeight = padTop + padBottom + spacing * (n - 1);
for (int i = 0; i < n; i++) {
Actor child = children.get(i);
if (child instanceof Layout) {
Layout layout = (Layout)child;
prefWidth = Math.max(prefWidth, layout.getPrefWidth());
prefHeight += layout.getPrefHeight();
} else {
prefWidth = Math.max(prefWidth, child.getWidth());
prefHeight += child.getHeight();
}
}
prefWidth += padLeft + padRight;
if (round) {
prefWidth = Math.round(prefWidth);
prefHeight = Math.round(prefHeight);
}
}
示例5: computeSize
import com.badlogic.gdx.scenes.scene2d.utils.Layout; //导入依赖的package包/类
private void computeSize (Array<Node> nodes, float indent) {
float ySpacing = this.ySpacing;
float spacing = iconSpacingLeft + iconSpacingRight;
for (int i = 0, n = nodes.size; i < n; i++) {
Node node = nodes.get(i);
float rowWidth = indent + iconSpacingRight;
Actor actor = node.actor;
if (actor instanceof Layout) {
Layout layout = (Layout)actor;
rowWidth += layout.getPrefWidth();
node.height = layout.getPrefHeight();
layout.pack();
} else {
rowWidth += actor.getWidth();
node.height = actor.getHeight();
}
if (node.icon != null) {
rowWidth += spacing + node.icon.getMinWidth();
node.height = Math.max(node.height, node.icon.getMinHeight());
}
prefWidth = Math.max(prefWidth, rowWidth);
prefHeight -= node.height + ySpacing;
if (node.expanded) computeSize(node.children, indent + indentSpacing);
}
}
示例6: layout
import com.badlogic.gdx.scenes.scene2d.utils.Layout; //导入依赖的package包/类
@Override
public void layout () {
if (!vertical)
calculateHorizBoundsAndPositions();
else
calculateVertBoundsAndPositions();
Actor firstWidget = this.firstWidget;
if (firstWidget != null) {
Rectangle firstWidgetBounds = this.firstWidgetBounds;
firstWidget.setBounds(firstWidgetBounds.x, firstWidgetBounds.y, firstWidgetBounds.width, firstWidgetBounds.height);
if (firstWidget instanceof Layout) ((Layout)firstWidget).validate();
}
Actor secondWidget = this.secondWidget;
if (secondWidget != null) {
Rectangle secondWidgetBounds = this.secondWidgetBounds;
secondWidget.setBounds(secondWidgetBounds.x, secondWidgetBounds.y, secondWidgetBounds.width, secondWidgetBounds.height);
if (secondWidget instanceof Layout) ((Layout)secondWidget).validate();
}
}
示例7: computeSize
import com.badlogic.gdx.scenes.scene2d.utils.Layout; //导入依赖的package包/类
private void computeSize () {
sizeInvalid = false;
SnapshotArray<Actor> children = getChildren();
int n = children.size;
prefWidth = padLeft + padRight + spacing * (n - 1);
prefHeight = 0;
for (int i = 0; i < n; i++) {
Actor child = children.get(i);
if (child instanceof Layout) {
Layout layout = (Layout)child;
prefWidth += layout.getPrefWidth();
prefHeight = Math.max(prefHeight, layout.getPrefHeight());
} else {
prefWidth += child.getWidth();
prefHeight = Math.max(prefHeight, child.getHeight());
}
}
prefHeight += padTop + padBottom;
if (round) {
prefWidth = Math.round(prefWidth);
prefHeight = Math.round(prefHeight);
}
}
示例8: layout
import com.badlogic.gdx.scenes.scene2d.utils.Layout; //导入依赖的package包/类
@Override
public void layout () {
if (!vertical)
calculateHorizBoundsAndPositions();
else
calculateVertBoundsAndPositions();
Actor firstWidget = this.firstWidget;
if (firstWidget != null) {
Rectangle firstWidgetBounds = this.firstWidgetBounds;
firstWidget.setBounds(firstWidgetBounds.x, firstWidgetBounds.y, firstWidgetBounds.width, firstWidgetBounds.height);
if (firstWidget instanceof Layout) ((Layout) firstWidget).validate();
}
Actor secondWidget = this.secondWidget;
if (secondWidget != null) {
Rectangle secondWidgetBounds = this.secondWidgetBounds;
secondWidget.setBounds(secondWidgetBounds.x, secondWidgetBounds.y, secondWidgetBounds.width, secondWidgetBounds.height);
if (secondWidget instanceof Layout) ((Layout) secondWidget).validate();
}
}
示例9: getMinHeight
import com.badlogic.gdx.scenes.scene2d.utils.Layout; //导入依赖的package包/类
public float getMinHeight()
{
SnapshotArray localSnapshotArray = getChildren();
int i = localSnapshotArray.size;
float f1 = 0.0F;
int j = 0;
if (j < i)
{
Actor localActor = (Actor)localSnapshotArray.get(j);
if ((localActor instanceof Layout));
for (float f2 = ((Layout)localActor).getMinHeight(); ; f2 = localActor.getHeight())
{
f1 = Math.max(f1, f2);
j++;
break;
}
}
return f1 * getScaleY();
}
示例10: getMinWidth
import com.badlogic.gdx.scenes.scene2d.utils.Layout; //导入依赖的package包/类
public float getMinWidth()
{
SnapshotArray localSnapshotArray = getChildren();
int i = localSnapshotArray.size;
float f1 = 0.0F;
int j = 0;
if (j < i)
{
Actor localActor = (Actor)localSnapshotArray.get(j);
if ((localActor instanceof Layout));
for (float f2 = ((Layout)localActor).getMinWidth(); ; f2 = localActor.getWidth())
{
f1 = Math.max(f1, f2);
j++;
break;
}
}
return f1 * getScaleX();
}
示例11: getPrefHeight
import com.badlogic.gdx.scenes.scene2d.utils.Layout; //导入依赖的package包/类
public float getPrefHeight()
{
SnapshotArray localSnapshotArray = getChildren();
int i = localSnapshotArray.size;
float f1 = 0.0F;
int j = 0;
if (j < i)
{
Actor localActor = (Actor)localSnapshotArray.get(j);
if ((localActor instanceof Layout));
for (float f2 = ((Layout)localActor).getPrefHeight(); ; f2 = localActor.getHeight())
{
f1 = Math.max(f1, f2);
j++;
break;
}
}
return f1 * getScaleY();
}
示例12: getPrefWidth
import com.badlogic.gdx.scenes.scene2d.utils.Layout; //导入依赖的package包/类
public float getPrefWidth()
{
SnapshotArray localSnapshotArray = getChildren();
int i = localSnapshotArray.size;
float f1 = 0.0F;
int j = 0;
if (j < i)
{
Actor localActor = (Actor)localSnapshotArray.get(j);
if ((localActor instanceof Layout));
for (float f2 = ((Layout)localActor).getPrefWidth(); ; f2 = localActor.getWidth())
{
f1 = Math.max(f1, f2);
j++;
break;
}
}
return f1 * getScaleX();
}
示例13: layout
import com.badlogic.gdx.scenes.scene2d.utils.Layout; //导入依赖的package包/类
public void layout()
{
SnapshotArray localSnapshotArray = getChildren();
int i = localSnapshotArray.size;
for (int j = 0; j < i; j++)
{
Actor localActor = (Actor)localSnapshotArray.get(j);
localActor.setBounds(0.0F, 0.0F, getWidth(), getHeight());
if ((localActor instanceof Layout))
{
Layout localLayout = (Layout)localActor;
localLayout.invalidate();
localLayout.validate();
}
}
}
示例14: getPrefHeight
import com.badlogic.gdx.scenes.scene2d.utils.Layout; //导入依赖的package包/类
public float getPrefHeight()
{
float f1;
if ((this.firstWidget instanceof Layout))
{
f1 = ((Layout)this.firstWidget).getPrefHeight();
if (!(this.secondWidget instanceof Layout))
break label85;
}
label85: for (float f2 = ((Layout)this.secondWidget).getPrefHeight(); ; f2 = this.secondWidget.getHeight())
{
float f3 = f2 + f1;
if (this.vertical)
f3 += this.style.handle.getMinHeight();
return f3;
f1 = this.firstWidget.getHeight();
break;
}
}
示例15: getPrefWidth
import com.badlogic.gdx.scenes.scene2d.utils.Layout; //导入依赖的package包/类
public float getPrefWidth()
{
float f1;
if ((this.firstWidget instanceof Layout))
{
f1 = ((Layout)this.firstWidget).getPrefWidth();
if (!(this.secondWidget instanceof Layout))
break label85;
}
label85: for (float f2 = ((Layout)this.secondWidget).getPrefWidth(); ; f2 = this.secondWidget.getWidth())
{
float f3 = f2 + f1;
if (!this.vertical)
f3 += this.style.handle.getMinWidth();
return f3;
f1 = this.firstWidget.getWidth();
break;
}
}