本文整理匯總了Java中com.badlogic.gdx.utils.Align.left方法的典型用法代碼示例。如果您正苦於以下問題:Java Align.left方法的具體用法?Java Align.left怎麽用?Java Align.left使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.utils.Align
的用法示例。
在下文中一共展示了Align.left方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: TextActor
import com.badlogic.gdx.utils.Align; //導入方法依賴的package包/類
public TextActor(String string,Color color,float targetwidth,TextAlign align,float scaleXY ,float x ,float y) {
// TODO Auto-generated constructor stub
font = book.base_font;
text_string = string ;
xpos = x;
ypos = y;
width = targetwidth ;
text_color = (color==null?Color.BLACK:color) ;
this.align = align;
scale = scaleXY;
font.getData().setScale(scaleXY);
//font.setColor(Color.BLUE);
best_score_text_layout = new GlyphLayout(
font,
text_string,
text_color,
width,
this.align == TextAlign.align_cinter?Align.center:(this.align==TextAlign.align_right?Align.right:Align.left),
true);
}
示例3: 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;
}
}
}
}
示例4: update_text
import com.badlogic.gdx.utils.Align; //導入方法依賴的package包/類
public void update_text (String text){
text_string = text;/*
font.getData().setScale(scale);*/
best_score_text_layout = new GlyphLayout(
font,
text_string,
text_color,
width,
this.align == TextAlign.align_left?Align.left:(this.align==TextAlign.align_right?Align.right:Align.center),
true);
}