本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.Actor.getHeight方法的典型用法代码示例。如果您正苦于以下问题:Java Actor.getHeight方法的具体用法?Java Actor.getHeight怎么用?Java Actor.getHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.scenes.scene2d.Actor
的用法示例。
在下文中一共展示了Actor.getHeight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initLayout
import com.badlogic.gdx.scenes.scene2d.Actor; //导入方法依赖的package包/类
public void initLayout(){
if (selection.size()<=0){
setVisible(false);
}else {
setVisible(true);
Array<Actor> actors = getAllActor();
Actor parentWindow = SelectGroup.this.getParent();
float x1=0,x2 = 0,y1=0,y2=0;
for (int i = 0; i <actors.size; i++) {
Actor actor = actors.get(i);
if (actor instanceof MainWindow){
x1 = 0;
x2 = actor.getWidth();
y1 = 0;
y2 = actor.getHeight();
break;
}
Vector2 posV = new Vector2(0,0);
Vector2 posV2 = new Vector2(actor.getWidth(),actor.getHeight());
posV = actor.localToStageCoordinates(posV);
posV2 = actor.localToStageCoordinates(posV2);
posV = parentWindow.stageToLocalCoordinates(posV);
posV2 = parentWindow.stageToLocalCoordinates(posV2);
float minX = Math.min(posV.x,posV2.x);
float maxX = Math.max(posV.x,posV2.x);
float minY = Math.min(posV.y,posV2.y);
float maxY = Math.max(posV.y,posV2.y);
if (i == 0){
x1 = minX;
x2 = maxX;
y1 = minY;
y2 = maxY;
}else {
if (minX<x1) x1 = minX;
if (maxX>x2) x2 = maxX;
if (minY<y1) y1 = minY;
if (maxY>y2) y2 = maxY;
}
}
SelectGroup.this.setBounds(x1,y1,x2 - x1,y2 - y1);
}
}