當前位置: 首頁>>代碼示例>>Java>>正文


Java Align.right方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.utils.Align.right方法的典型用法代碼示例。如果您正苦於以下問題:Java Align.right方法的具體用法?Java Align.right怎麽用?Java Align.right使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.utils.Align的用法示例。


在下文中一共展示了Align.right方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
}
 
開發者ID:raeleus,項目名稱:bobbybird,代碼行數:27,代碼來源:BouncingImage.java

示例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);
	
}
 
開發者ID:omar6597,項目名稱:alquran-alkarem,代碼行數:22,代碼來源:TextActor.java

示例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;
            }
        }
    }
}
 
開發者ID:whitecostume,項目名稱:libgdx_ui_editor,代碼行數:34,代碼來源:MainWindow.java

示例4: activate

import com.badlogic.gdx.utils.Align; //導入方法依賴的package包/類
public static void activate(Entity boss) {
	central = boss;
	final Transform cTransform = central.GetComponent(Transform.class);
	final BossHP bossHP = central.GetComponent(BossHP.class);
	
	spellName = Entity.Create();
	spellName.AddComponent(new Transform(new Vector2(546, 700)));
	final TextRenderer nameRenderer = new TextRenderer(bossHP.spellNames[bossHP.current]);
	nameRenderer.labelAlign = Align.topRight;
	nameRenderer.lineAlign = Align.right;
	spellName.AddComponent(nameRenderer);
	spellName.AddComponent(new LambdaComponent(() -> {
		nameRenderer.setText(bossHP.spellNames[bossHP.current] == null ? "" : bossHP.spellNames[bossHP.current]);
	}, 0, 4));
	
	lifeGauge = Entity.Create();
	lifeGauge.AddComponent(new Transform(cTransform.position));
	final CircularProgressRenderer circularProgressRenderer = new CircularProgressRenderer();
	final ImageRenderer outerCircle = new ImageRenderer(ResourceManager.textures.get("bloodGaugeOuter"), -1);
	lifeGauge.AddComponent(outerCircle);
	lifeGauge.AddComponent(circularProgressRenderer);
	lifeGauge.AddComponent(new LambdaComponent(() -> {
		circularProgressRenderer.progress.toBack();
		outerCircle.image.toBack();
		circularProgressRenderer.progress.setPercent(bossHP.hp / (float) bossHP.maxhp);
	}, 1));
	
	timeleft = Entity.Create();
	timeleft.AddComponent(new Transform(new Vector2(285, 660)));
	final TextRenderer timeRenderer = new TextRenderer(bossHP.spellNames[bossHP.current]);
	timeRenderer.labelAlign = Align.center;
	timeRenderer.lineAlign = Align.center;
	timeleft.AddComponent(timeRenderer);
	timeleft.AddComponent(new LambdaComponent(() -> {
		timeRenderer.setText(String.format("%.2f", (bossHP.time[bossHP.current] - bossHP.timer) / 60f));
	}, 1));
	mIsActive = true;
}
 
開發者ID:cn-s3bit,項目名稱:TH902,代碼行數:39,代碼來源:EnemySpellInfoSystem.java

示例5: 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);
}
 
開發者ID:omar6597,項目名稱:alquran-alkarem,代碼行數:12,代碼來源:TextActor.java


注:本文中的com.badlogic.gdx.utils.Align.right方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。