本文整理了Java中com.badlogic.gdx.scenes.scene2d.Actor.getWidth()
方法的一些代码示例,展示了Actor.getWidth()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Actor.getWidth()
方法的具体详情如下:
包路径:com.badlogic.gdx.scenes.scene2d.Actor
类名称:Actor
方法名:getWidth
暂无
代码示例来源:origin: libgdx/libgdx
public float get (Actor actor) {
return actor.getWidth() * percent;
}
};
代码示例来源:origin: libgdx/libgdx
public float get (Actor actor) {
return actor.getWidth() * percent;
}
};
代码示例来源:origin: libgdx/libgdx
public float get (Actor context) {
return actor.getWidth() * percent;
}
};
代码示例来源:origin: libgdx/libgdx
public float get (Actor context) {
return actor.getWidth() * percent;
}
};
代码示例来源:origin: libgdx/libgdx
public float get (Actor context) {
if (context instanceof Layout) return ((Layout)context).getPrefWidth();
return context == null ? 0 : context.getWidth();
}
};
代码示例来源:origin: libgdx/libgdx
public float get (Actor context) {
if (context instanceof Layout) return ((Layout)context).getMaxWidth();
return context == null ? 0 : context.getWidth();
}
};
代码示例来源:origin: libgdx/libgdx
public float get (Actor context) {
if (context instanceof Layout) return ((Layout)context).getMinWidth();
return context == null ? 0 : context.getWidth();
}
};
代码示例来源:origin: libgdx/libgdx
public float get (Actor context) {
if (context instanceof Layout) return ((Layout)context).getPrefWidth();
return context == null ? 0 : context.getWidth();
}
};
代码示例来源:origin: libgdx/libgdx
public float get (Actor context) {
if (context instanceof Layout) return ((Layout)context).getMaxWidth();
return context == null ? 0 : context.getWidth();
}
};
代码示例来源:origin: libgdx/libgdx
public float get (Actor context) {
if (context instanceof Layout) return ((Layout)context).getMinWidth();
return context == null ? 0 : context.getWidth();
}
};
代码示例来源:origin: libgdx/libgdx
protected void begin () {
startWidth = target.getWidth();
startHeight = target.getHeight();
}
代码示例来源:origin: libgdx/libgdx
protected void begin () {
startWidth = target.getWidth();
startHeight = target.getHeight();
}
代码示例来源:origin: libgdx/libgdx
@Override
public float getPrefWidth () {
float first = firstWidget == null ? 0
: (firstWidget instanceof Layout ? ((Layout)firstWidget).getPrefWidth() : firstWidget.getWidth());
float second = secondWidget == null ? 0
: (secondWidget instanceof Layout ? ((Layout)secondWidget).getPrefWidth() : secondWidget.getWidth());
if (vertical) return Math.max(first, second);
return first + style.handle.getMinWidth() + second;
}
代码示例来源:origin: libgdx/libgdx
@Override
public float getPrefWidth () {
float first = firstWidget == null ? 0
: (firstWidget instanceof Layout ? ((Layout)firstWidget).getPrefWidth() : firstWidget.getWidth());
float second = secondWidget == null ? 0
: (secondWidget instanceof Layout ? ((Layout)secondWidget).getPrefWidth() : secondWidget.getWidth());
if (vertical) return Math.max(first, second);
return first + style.handle.getMinWidth() + second;
}
代码示例来源:origin: libgdx/libgdx
childMaxHeight = layout.getMaxHeight();
} else {
prefWidth = Math.max(prefWidth, child.getWidth());
prefHeight = Math.max(prefHeight, child.getHeight());
minWidth = Math.max(minWidth, child.getWidth());
minHeight = Math.max(minHeight, child.getHeight());
childMaxWidth = 0;
代码示例来源:origin: libgdx/libgdx
childMaxHeight = layout.getMaxHeight();
} else {
prefWidth = Math.max(prefWidth, child.getWidth());
prefHeight = Math.max(prefHeight, child.getHeight());
minWidth = Math.max(minWidth, child.getWidth());
minHeight = Math.max(minHeight, child.getHeight());
childMaxWidth = 0;
代码示例来源:origin: libgdx/libgdx
private void computeSize (Array<Node> nodes, float indent, float plusMinusWidth) {
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 + plusMinusWidth;
Actor actor = node.actor;
if (actor instanceof Layout) {
Layout layout = (Layout)actor;
rowWidth += layout.getPrefWidth();
node.height = layout.getPrefHeight();
} 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, plusMinusWidth);
}
}
代码示例来源:origin: libgdx/libgdx
private void computeSize (Array<Node> nodes, float indent, float plusMinusWidth) {
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 + plusMinusWidth;
Actor actor = node.actor;
if (actor instanceof Layout) {
Layout layout = (Layout)actor;
rowWidth += layout.getPrefWidth();
node.height = layout.getPrefHeight();
} 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, plusMinusWidth);
}
}
代码示例来源:origin: libgdx/libgdx
private void setContainerPosition (Actor actor, float x, float y) {
this.targetActor = actor;
Stage stage = actor.getStage();
if (stage == null) return;
container.pack();
float offsetX = manager.offsetX, offsetY = manager.offsetY, dist = manager.edgeDistance;
Vector2 point = actor.localToStageCoordinates(tmp.set(x + offsetX, y - offsetY - container.getHeight()));
if (point.y < dist) point = actor.localToStageCoordinates(tmp.set(x + offsetX, y + offsetY));
if (point.x < dist) point.x = dist;
if (point.x + container.getWidth() > stage.getWidth() - dist) point.x = stage.getWidth() - dist - container.getWidth();
if (point.y + container.getHeight() > stage.getHeight() - dist) point.y = stage.getHeight() - dist - container.getHeight();
container.setPosition(point.x, point.y);
point = actor.localToStageCoordinates(tmp.set(actor.getWidth() / 2, actor.getHeight() / 2));
point.sub(container.getX(), container.getY());
container.setOrigin(point.x, point.y);
}
代码示例来源:origin: libgdx/libgdx
private void setContainerPosition (Actor actor, float x, float y) {
this.targetActor = actor;
Stage stage = actor.getStage();
if (stage == null) return;
container.pack();
float offsetX = manager.offsetX, offsetY = manager.offsetY, dist = manager.edgeDistance;
Vector2 point = actor.localToStageCoordinates(tmp.set(x + offsetX, y - offsetY - container.getHeight()));
if (point.y < dist) point = actor.localToStageCoordinates(tmp.set(x + offsetX, y + offsetY));
if (point.x < dist) point.x = dist;
if (point.x + container.getWidth() > stage.getWidth() - dist) point.x = stage.getWidth() - dist - container.getWidth();
if (point.y + container.getHeight() > stage.getHeight() - dist) point.y = stage.getHeight() - dist - container.getHeight();
container.setPosition(point.x, point.y);
point = actor.localToStageCoordinates(tmp.set(actor.getWidth() / 2, actor.getHeight() / 2));
point.sub(container.getX(), container.getY());
container.setOrigin(point.x, point.y);
}
内容来源于网络,如有侵权,请联系作者删除!