本文整理汇总了Java中com.badlogic.gdx.utils.Align.bottom方法的典型用法代码示例。如果您正苦于以下问题:Java Align.bottom方法的具体用法?Java Align.bottom怎么用?Java Align.bottom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.utils.Align
的用法示例。
在下文中一共展示了Align.bottom方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: layout
import com.badlogic.gdx.utils.Align; //导入方法依赖的package包/类
public void layout () {
if (drawable == null) return;
float regionWidth = drawable.getMinWidth();
float regionHeight = drawable.getMinHeight();
float width = getWidth();
float height = getHeight();
Vector2 size = scaling.apply(regionWidth, regionHeight, width, height);
imageWidth = size.x;
imageHeight = size.y;
if ((align & Align.left) != 0)
imageX = 0;
else if ((align & Align.right) != 0)
imageX = (int)(width - imageWidth);
else
imageX = (int)(width / 2 - imageWidth / 2);
if ((align & Align.top) != 0)
imageY = (int)(height - imageHeight);
else if ((align & Align.bottom) != 0)
imageY = 0;
else
imageY = (int)(height / 2 - imageHeight / 2);
}
示例2: align
import com.badlogic.gdx.utils.Align; //导入方法依赖的package包/类
@Override
public void align(AlignEvent alignEvent) {
if (selectedGroup.getAllActor().size > 1) {
Actor tmp = selectedGroup.getAllActor().first();
Vector2 tmpVec = new Vector2();
tmp.localToStageCoordinates(tmpVec);
for (Actor actor : selectedGroup.getAllActor()) {
if (actor.equals(tmp)) continue;
Vector2 vector2 = new Vector2(tmpVec);
actor.getParent().stageToLocalCoordinates(vector2);
switch (alignEvent.align) {
case Align.left:
actor.setPosition(vector2.x, actor.getY());
break;
case Align.right:
actor.setPosition(vector2.x + tmp.getWidth(), actor.getY() + actor.getHeight() / 2, Align.right);
break;
case Align.center:
actor.setPosition(vector2.x + tmp.getWidth() / 2, actor.getY(Align.center), Align.center);
break;
case Config.centerH:
actor.setPosition(actor.getX(Align.center), vector2.y + tmp.getHeight() / 2, Align.center);
break;
case Align.bottom:
actor.setPosition(actor.getX(), vector2.y);
break;
case Align.top:
actor.setPosition(actor.getX(), vector2.y + tmp.getHeight(), Align.topLeft);
break;
}
}
}
}