本文整理匯總了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);
}
}