本文整理匯總了Java中com.badlogic.gdx.scenes.scene2d.utils.Align.left方法的典型用法代碼示例。如果您正苦於以下問題:Java Align.left方法的具體用法?Java Align.left怎麽用?Java Align.left使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.scenes.scene2d.utils.Align
的用法示例。
在下文中一共展示了Align.left方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
}
示例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);
}
示例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);
}
示例4: left
import com.badlogic.gdx.scenes.scene2d.utils.Align; //導入方法依賴的package包/類
/** Adds {@link Align#left} and clears {@link Align#right} for the alignment of the actor within the cell. */
public Cell<T> left () {
if (align == null)
align = lefti;
else
align = (align | Align.left) & ~Align.right;
return this;
}
示例5: right
import com.badlogic.gdx.scenes.scene2d.utils.Align; //導入方法依賴的package包/類
/** Adds {@link Align#right} and clears {@link Align#left} for the alignment of the actor within the cell. */
public Cell<T> right () {
if (align == null)
align = righti;
else
align = (align | Align.right) & ~Align.left;
return this;
}
示例6: setAlignment
import com.badlogic.gdx.scenes.scene2d.utils.Align; //導入方法依賴的package包/類
/** @param labelAlign Aligns all the text with the label widget.
* @param lineAlign Aligns each line of text (left, right, or center).
* @see Align */
public void setAlignment (int labelAlign, int lineAlign) {
this.labelAlign = labelAlign;
if ((lineAlign & Align.left) != 0)
this.lineAlign = HAlignment.LEFT;
else if ((lineAlign & Align.right) != 0)
this.lineAlign = HAlignment.RIGHT;
else
this.lineAlign = HAlignment.CENTER;
invalidate();
}
示例7: show
import com.badlogic.gdx.scenes.scene2d.utils.Align; //導入方法依賴的package包/類
public void show()
{
Gdx.app.log(XesEffects.LOG, "Showing SplashScreen");
super.show();
// preparing actors
// - background:
this.bgTexture = new Texture("data/splash_screen.png");
this.bgTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
TextureRegion bgTextureRegion = new TextureRegion(bgTexture, 0, 0, 512, 512);
TextureRegionDrawable drawableBg = new TextureRegionDrawable(bgTextureRegion);
this.bgImage = new Image(drawableBg, Scaling.fillX, Align.left | Align.top);
this.bgImage.setFillParent(true);
// building stage
this.stage.clear();
this.stage.addActor(this.bgImage);
// show animation
this.stage.addAction(
sequence(
fadeOut(0),
moveTo(0, Gdx.graphics.getHeight() / 2),
parallel(
fadeIn(1.5f),
moveTo(0, 0, 1.5f)
)
)
);
}
示例8: left
import com.badlogic.gdx.scenes.scene2d.utils.Align; //導入方法依賴的package包/類
/** Sets {@link Align#left} and clears {@link Align#right} for the alignment of widgets within the vertical group. */
public VerticalGroup left () {
align |= Align.left;
align &= ~Align.right;
return this;
}
示例9: right
import com.badlogic.gdx.scenes.scene2d.utils.Align; //導入方法依賴的package包/類
/** Sets {@link Align#right} and clears {@link Align#left} for the alignment of widgets within the vertical group. */
public VerticalGroup right () {
align |= Align.right;
align &= ~Align.left;
return this;
}
示例10: 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();
}
示例11: left
import com.badlogic.gdx.scenes.scene2d.utils.Align; //導入方法依賴的package包/類
/** Sets {@link Align#left} and clears {@link Align#right} for the alignment of the actor within the container. */
public Container<T> left () {
align |= Align.left;
align &= ~Align.right;
return this;
}
示例12: right
import com.badlogic.gdx.scenes.scene2d.utils.Align; //導入方法依賴的package包/類
/** Sets {@link Align#right} and clears {@link Align#left} for the alignment of the actor within the container. */
public Container<T> right () {
align |= Align.right;
align &= ~Align.left;
return this;
}
示例13: left
import com.badlogic.gdx.scenes.scene2d.utils.Align; //導入方法依賴的package包/類
/** Adds {@link Align#left} and clears {@link Align#right} for the alignment of the logical table within the table actor. */
public Table left () {
align |= Align.left;
align &= ~Align.right;
return this;
}
示例14: right
import com.badlogic.gdx.scenes.scene2d.utils.Align; //導入方法依賴的package包/類
/** Adds {@link Align#right} and clears {@link Align#left} for the alignment of the logical table within the table actor. */
public Table right () {
align |= Align.right;
align &= ~Align.left;
return this;
}
示例15: 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);
}