本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.utils.Layout.getPrefHeight方法的典型用法代码示例。如果您正苦于以下问题:Java Layout.getPrefHeight方法的具体用法?Java Layout.getPrefHeight怎么用?Java Layout.getPrefHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.scenes.scene2d.utils.Layout
的用法示例。
在下文中一共展示了Layout.getPrefHeight方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
}
}
示例2: 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);
}
}
示例3: 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);
}
}
示例4: getPrefHeight
import com.badlogic.gdx.scenes.scene2d.utils.Layout; //导入方法依赖的package包/类
@Override
public float getPrefHeight() {
if (actor == null) return 0f;
if (actor instanceof Layout) {
Layout layout = (Layout) actor;
return layout.getPrefHeight() * getScaleY();
} else {
return origHeight * getScaleY();
}
}
示例5: getPrefHeight
import com.badlogic.gdx.scenes.scene2d.utils.Layout; //导入方法依赖的package包/类
@Override
public float getPrefHeight() {
if (actor == null) return 0f;
if (actor instanceof Layout) {
Layout layout = (Layout) actor;
return layout.getPrefHeight() * scaleY;
} else {
return origHeight * scaleY;
}
}
示例6: computeSize
import com.badlogic.gdx.scenes.scene2d.utils.Layout; //导入方法依赖的package包/类
private void computeSize()
{
prefWidth = 0;
prefHeight = 0;
sizeInvalid = false;
SnapshotArray<Actor> children = getChildren();
float groupHeight = getHeight();
float y = 0;
float maxWidth = 0;
for (int i = 0, n = children.size; i < n; i++)
{
Actor child = children.get(i);
float width = child.getWidth();
float height = child.getHeight();
if (child instanceof Layout)
{
Layout layout = (Layout) child;
width = layout.getPrefWidth();
height = layout.getPrefHeight();
}
if (y + height <= groupHeight)
{
prefHeight += height + spacing;
y += height + spacing;
maxWidth = Math.max(width, maxWidth);
} else
{
prefWidth += maxWidth + spacing;
maxWidth = width;
y = height + spacing;
}
}
prefWidth += maxWidth;
}
示例7: computeSize
import com.badlogic.gdx.scenes.scene2d.utils.Layout; //导入方法依赖的package包/类
private void computeSize()
{
prefWidth = 0;
prefHeight = 0;
sizeInvalid = false;
SnapshotArray<Actor> children = getChildren();
float groupWidth = getWidth();
float x = 0;
float maxHeight = 0;
for (int i = 0, n = children.size; i < n; i++)
{
Actor child = children.get(i);
float width = child.getWidth();
float height = child.getHeight();
if (child instanceof Layout)
{
Layout layout = (Layout) child;
width = layout.getPrefWidth();
height = layout.getPrefHeight();
}
if (x + width <= groupWidth)
{
prefWidth += width + spacing;
x += width + spacing;
maxHeight = Math.max(height, maxHeight);
} else
{
prefHeight += maxHeight + spacing;
maxHeight = height;
x = width + spacing;
}
}
prefHeight += maxHeight;
}
示例8: computeSize
import com.badlogic.gdx.scenes.scene2d.utils.Layout; //导入方法依赖的package包/类
private void computeSize () {
prefWidth = 0;
prefHeight = getHeight();
sizeInvalid = false;
SnapshotArray<Actor> children = getChildren();
float y = 0;
float columnWidth = 0;
for (int i = 0; i < children.size; i++) {
Actor child = children.get(i);
float width = child.getWidth();
float height = child.getHeight();
if (child instanceof Layout) {
Layout layout = (Layout) child;
width = layout.getPrefWidth();
height = layout.getPrefHeight();
}
if (y + height > getHeight()) {
y = 0;
prefWidth += columnWidth + spacing;
columnWidth = width;
} else {
columnWidth = Math.max(width, columnWidth);
}
y += height + spacing;
}
//handle last column width
prefWidth += columnWidth + spacing;
}
示例9: computeSize
import com.badlogic.gdx.scenes.scene2d.utils.Layout; //导入方法依赖的package包/类
private void computeSize () {
prefWidth = getWidth();
prefHeight = 0;
sizeInvalid = false;
SnapshotArray<Actor> children = getChildren();
float x = 0;
float rowHeight = 0;
for (int i = 0; i < children.size; i++) {
Actor child = children.get(i);
float width = child.getWidth();
float height = child.getHeight();
if (child instanceof Layout) {
Layout layout = (Layout) child;
width = layout.getPrefWidth();
height = layout.getPrefHeight();
}
if (x + width > getWidth()) {
x = 0;
prefHeight += rowHeight + spacing;
rowHeight = height;
} else {
rowHeight = Math.max(height, rowHeight);
}
x += width + spacing;
}
//handle last row height
prefHeight += rowHeight + spacing;
}