当前位置: 首页>>代码示例>>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;未经允许,请勿转载。