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


Java Align.bottom方法代碼示例

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


在下文中一共展示了Align.bottom方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: layout

import com.badlogic.gdx.scenes.scene2d.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:basherone,項目名稱:libgdxcn,代碼行數:27,代碼來源:Image.java

示例2: resize

import com.badlogic.gdx.scenes.scene2d.utils.Align; //導入方法依賴的package包/類
@Override
public void resize(int width, int height) {
    super.resize(width, height);

    Image splashImage = new Image(new SpriteDrawable(new Sprite(splashTexture)), Scaling.stretch, Align.bottom | Align.left);
    splashImage.setWidth(width);
    splashImage.setHeight(height);
    splashImage.getColor().a = 0f;

    splashImage.addAction(sequence(fadeIn(0.5f), run(new Runnable() {
        public void run() {
            game.menuScreen = new MenuScreen(game);
        }
    }), delay(1f, fadeOut(0.5f)), run(new Runnable() {
        public void run() {
            game.setGameState(GameState.GAME_SHOW_MENU);
        }
    })));

    stage.addActor(splashImage);
}
 
開發者ID:Rubentxu,項目名稱:DreamsLibGdx,代碼行數:22,代碼來源:SplashScreen.java

示例3: drawBackground

import com.badlogic.gdx.scenes.scene2d.utils.Align; //導入方法依賴的package包/類
protected void drawBackground (Batch batch, float parentAlpha, float x, float y) {
	float width = getWidth(), height = getHeight();
	float padTop = getPadTop();

	super.drawBackground(batch, parentAlpha, x, y);

	// Draw button table.
	buttonTable.getColor().a = getColor().a;
	buttonTable.pack();
	buttonTable.setPosition(width - buttonTable.getWidth(), Math.min(height - padTop, height - buttonTable.getHeight()));
	buttonTable.draw(batch, parentAlpha);

	// Draw the title without the batch transformed or clipping applied.
	y += height;
	TextBounds bounds = titleCache.getBounds();
	if ((titleAlignment & Align.left) != 0)
		x += getPadLeft();
	else if ((titleAlignment & Align.right) != 0)
		x += width - bounds.width - getPadRight();
	else
		x += (width - bounds.width) / 2;
	if ((titleAlignment & Align.top) == 0) {
		if ((titleAlignment & Align.bottom) != 0)
			y -= padTop - bounds.height;
		else
			y -= (padTop - bounds.height) / 2;
	}
	titleCache.tint(Color.tmp.set(getColor()).mul(style.titleFontColor));
	titleCache.setPosition((int)x, (int)y);
	titleCache.draw(batch, parentAlpha);
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:32,代碼來源:Window.java

示例4: top

import com.badlogic.gdx.scenes.scene2d.utils.Align; //導入方法依賴的package包/類
/** Adds {@link Align#top} and clears {@link Align#bottom} for the alignment of the actor within the cell. */
public Cell<T> top () {
	if (align == null)
		align = topi;
	else
		align = (align | Align.top) & ~Align.bottom;
	return this;
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:9,代碼來源:Cell.java

示例5: bottom

import com.badlogic.gdx.scenes.scene2d.utils.Align; //導入方法依賴的package包/類
/** Adds {@link Align#bottom} and clears {@link Align#top} for the alignment of the actor within the cell. */
public Cell<T> bottom () {
	if (align == null)
		align = bottomi;
	else
		align = (align | Align.bottom) & ~Align.top;
	return this;
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:9,代碼來源:Cell.java

示例6: makeCityScape

import com.badlogic.gdx.scenes.scene2d.utils.Align; //導入方法依賴的package包/類
private void makeCityScape() {

		Group cityScape = new Group();

		Image cityScapeLeft = new Image(new TextureRegionDrawable(atlas2.findRegion("cityscape-left")), fit, Align.bottom);
		Image cityScapeRight = new Image(new TextureRegionDrawable(atlas2.findRegion("cityscape-right")), fit, Align.bottom);
		Image cityScapeMiddle = new Image(TowerAssetManager.drawable("backgrounds/cityscape-middle.png"), stretchX, Align.bottom);
		cityScapeLeft.setWidth((int) Math.min(getStage().getWidth() * 0.33f, cityScapeLeft.getImageWidth()));
		cityScapeLeft.setHeight((int) Math.min(getStage().getHeight() * 0.33f, cityScapeLeft.getImageHeight()));
		cityScapeLeft.pack();

		cityScapeRight.setWidth((int) Math.min(getStage().getWidth() * 0.33f, cityScapeRight.getImageWidth()));
		cityScapeRight.setHeight((int) Math.min(getStage().getHeight() * 0.33f, cityScapeRight.getImageHeight()));
		cityScapeRight.pack();

		cityScapeRight.setX(getStage().getWidth() - cityScapeRight.getWidth());

		cityScapeMiddle.setWidth((int) getStage().getWidth() * 0.33f);
		cityScapeMiddle.setHeight((int) getStage().getHeight() * 0.33f);
		cityScapeMiddle.setX((int) cityScapeLeft.getWidth());
		cityScapeMiddle.setWidth((int) getStage().getWidth() - cityScapeLeft.getWidth() - cityScapeRight.getWidth());

		cityScape.addActor(cityScapeLeft);
		cityScape.addActor(cityScapeMiddle);
		cityScape.addActor(cityScapeRight);

		container.addActor(cityScape);

		cityScape.setY(-getStage().getHeight());
		Tween.to(cityScape, WidgetAccessor.POSITION, CAMERA_PAN_DOWN_DURATION).delay(50).target(cityScape.getX(), 0)
				.ease(TweenEquations.easeInOutExpo).start(TweenSystem.manager());
	}
 
開發者ID:frigidplanet,項目名稱:droidtowers,代碼行數:33,代碼來源:SplashScene.java

示例7: layout

import com.badlogic.gdx.scenes.scene2d.utils.Align; //導入方法依賴的package包/類
public void layout () {
	if (actor == null) return;

	float padLeft = this.padLeft.get(this), padBottom = this.padBottom.get(this);
	float containerWidth = getWidth() - padLeft - padRight.get(this);
	float containerHeight = getHeight() - padBottom - padTop.get(this);
	float minWidth = this.minWidth.get(actor), minHeight = this.minHeight.get(actor);
	float prefWidth = this.prefWidth.get(actor), prefHeight = this.prefHeight.get(actor);
	float maxWidth = this.maxWidth.get(actor), maxHeight = this.maxHeight.get(actor);

	float width;
	if (fillX > 0)
		width = containerWidth * fillX;
	else
		width = Math.min(prefWidth, containerWidth);
	if (width < minWidth) width = minWidth;
	if (maxWidth > 0 && width > maxWidth) width = maxWidth;

	float height;
	if (fillY > 0)
		height = containerHeight * fillY;
	else
		height = Math.min(prefHeight, containerHeight);
	if (height < minHeight) height = minHeight;
	if (maxHeight > 0 && height > maxHeight) height = maxHeight;

	float x = padLeft;
	if ((align & Align.right) != 0)
		x += containerWidth - width;
	else if ((align & Align.left) == 0) // center
		x += (containerWidth - width) / 2;

	float y = padBottom;
	if ((align & Align.top) != 0)
		y += containerHeight - height;
	else if ((align & Align.bottom) == 0) // center
		y += (containerHeight - height) / 2;

	if (round) {
		x = Math.round(x);
		y = Math.round(y);
		width = Math.round(width);
		height = Math.round(height);
	}

	actor.setBounds(x, y, width, height);
	if (actor instanceof Layout) ((Layout)actor).validate();
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:49,代碼來源:Container.java

示例8: top

import com.badlogic.gdx.scenes.scene2d.utils.Align; //導入方法依賴的package包/類
/** Sets {@link Align#top} and clears {@link Align#bottom} for the alignment of the actor within the container. */
public Container<T> top () {
	align |= Align.top;
	align &= ~Align.bottom;
	return this;
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:7,代碼來源:Container.java

示例9: bottom

import com.badlogic.gdx.scenes.scene2d.utils.Align; //導入方法依賴的package包/類
/** Sets {@link Align#bottom} and clears {@link Align#top} for the alignment of the actor within the container. */
public Container<T> bottom () {
	align |= Align.bottom;
	align &= ~Align.top;
	return this;
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:7,代碼來源:Container.java

示例10: top

import com.badlogic.gdx.scenes.scene2d.utils.Align; //導入方法依賴的package包/類
/** Adds {@link Align#top} and clears {@link Align#bottom} for the alignment of the logical table within the table actor. */
public Table top () {
	align |= Align.top;
	align &= ~Align.bottom;
	return this;
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:7,代碼來源:Table.java

示例11: bottom

import com.badlogic.gdx.scenes.scene2d.utils.Align; //導入方法依賴的package包/類
/** Adds {@link Align#bottom} and clears {@link Align#top} for the alignment of the logical table within the table actor. */
public Table bottom () {
	align |= Align.bottom;
	align &= ~Align.top;
	return this;
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:7,代碼來源:Table.java

示例12: layout

import com.badlogic.gdx.scenes.scene2d.utils.Align; //導入方法依賴的package包/類
public void layout () {
	BitmapFont font = cache.getFont();
	float oldScaleX = font.getScaleX();
	float oldScaleY = font.getScaleY();
	if (fontScaleX != 1 || fontScaleY != 1) font.setScale(fontScaleX, fontScaleY);

	if (sizeInvalid) computeSize();

	if (wrap) {
		float prefHeight = getPrefHeight();
		if (prefHeight != lastPrefHeight) {
			lastPrefHeight = prefHeight;
			invalidateHierarchy();
		}
	}

	float width = getWidth(), height = getHeight();
	StringBuilder text;
	if (ellipsis && width < bounds.width) {
		float ellipseWidth = font.getBounds("...").width;
		text = tempText != null ? tempText : (tempText = new StringBuilder());
		text.setLength(0);
		if (width > ellipseWidth) {
			text.append(this.text, 0, font.computeVisibleGlyphs(this.text, 0, this.text.length, width - ellipseWidth));
			text.append("...");
		}
	} else
		text = this.text;

	Drawable background = style.background;
	float x = 0, y = 0;
	if (background != null) {
		x = background.getLeftWidth();
		y = background.getBottomHeight();
		width -= background.getLeftWidth() + background.getRightWidth();
		height -= background.getBottomHeight() + background.getTopHeight();
	}
	if ((labelAlign & Align.top) != 0) {
		y += cache.getFont().isFlipped() ? 0 : height - bounds.height;
		y += style.font.getDescent();
	} else if ((labelAlign & Align.bottom) != 0) {
		y += cache.getFont().isFlipped() ? height - bounds.height : 0;
		y -= style.font.getDescent();
	} else
		y += (int)((height - bounds.height) / 2);
	if (!cache.getFont().isFlipped()) y += bounds.height;

	if ((labelAlign & Align.left) == 0) {
		if ((labelAlign & Align.right) != 0)
			x += width - bounds.width;
		else
			x += (int)((width - bounds.width) / 2);
	}

	cache.setColor(Color.WHITE);
	if (wrap)
		cache.setWrappedText(text, x, y, bounds.width, lineAlign);
	else
		cache.setMultiLineText(text, x, y, bounds.width, lineAlign);

	if (fontScaleX != 1 || fontScaleY != 1) font.setScale(oldScaleX, oldScaleY);
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:63,代碼來源:Label.java

示例13: top

import com.badlogic.gdx.scenes.scene2d.utils.Align; //導入方法依賴的package包/類
/** Sets {@link Align#top} and clears {@link Align#bottom} for the alignment of widgets within the horizontal group. */
public HorizontalGroup top () {
	align |= Align.top;
	align &= ~Align.bottom;
	return this;
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:7,代碼來源:HorizontalGroup.java

示例14: bottom

import com.badlogic.gdx.scenes.scene2d.utils.Align; //導入方法依賴的package包/類
/** Sets {@link Align#bottom} and clears {@link Align#top} for the alignment of widgets within the horizontal group. */
public HorizontalGroup bottom () {
	align |= Align.bottom;
	align &= ~Align.top;
	return this;
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:7,代碼來源:HorizontalGroup.java


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