本文整理匯總了Java中com.badlogic.gdx.scenes.scene2d.utils.Align.right方法的典型用法代碼示例。如果您正苦於以下問題:Java Align.right方法的具體用法?Java Align.right怎麽用?Java Align.right使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.scenes.scene2d.utils.Align
的用法示例。
在下文中一共展示了Align.right方法的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: show
import com.badlogic.gdx.scenes.scene2d.utils.Align; //導入方法依賴的package包/類
protected void show(Actor parentWidget, Actor relativeTo) {
setVisible(true);
content.setVisible(true);
parentWidget.getStage().addActor(this);
parentWidget.getStage().addActor(content);
content.pack();
pack();
float relativeX = relativeTo.getX() + parentWidget.getX();
if ((arrowAlignment & Align.right) != 0) {
setX(relativeX - getWidth() + relativeTo.getWidth() - ((relativeTo.getWidth() - triangle.getWidth()) / 2) + 8);
} else {
setX(relativeX + ((relativeTo.getWidth() - triangle.getWidth()) / 2) - 8);
}
setY(relativeTo.getY() + parentWidget.getY() - getHeight() - relativeTo.getHeight() / 2);
content.setX(getX() + Display.devicePixel(10));
content.setY(getY() + Display.devicePixel(10));
InputSystem.instance().bind(new int[] { ESCAPE, BACK }, inputCallback);
InputSystem.instance().addInputProcessor(clickCallback, 0);
addAction(Actions.fadeIn(BUTTON_FADE_DURATION));
content.addAction(Actions.fadeIn(BUTTON_FADE_DURATION));
}
示例3: onTouchDown
import com.badlogic.gdx.scenes.scene2d.utils.Align; //導入方法依賴的package包/類
@Override
public void onTouchDown(Actor actor) {
if (Scene.mouseButton == 0) {
edge = 0;
float x = Scene.mouse.x;
float y = Scene.mouse.y;
if (x > actor.getX() + actor.getWidth() - 10) edge |= Align.right;
if (y > actor.getY() + actor.getHeight() - 10) edge |= Align.top;
//if (x < actor.getX() + 20 && y < actor.getY() + 20) edge = Align.left; no rotation
dragging = edge != 0;
startX = x;
startY = y;
lastX = x;
lastY = y;
}
}
示例4: 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);
}
示例5: 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;
}
示例6: 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;
}
示例7: 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();
}
示例8: draw
import com.badlogic.gdx.scenes.scene2d.utils.Align; //導入方法依賴的package包/類
@Override
public void draw(SpriteBatch batch, float parentAlpha) {
SceneManager.activeScene().effects().drawDropShadow(batch, parentAlpha, this);
float xOffset = (arrowAlignment & Align.right) != 0 ? getWidth() - triangle.getWidth() - 8 : 8;
batch.setColor(Colors.ICS_BLUE);
batch.draw(triangle, getX() + xOffset + 2, getY() + getHeight() + 2, 2, 3, triangle.getWidth() - 4, triangle.getHeight() - 6);
batch.draw(swatch, getX() - 2, getY() - 2, getWidth() + 4, getHeight() + 4);
batch.setColor(Colors.DARKER_GRAY);
batch.draw(triangle, getX() + xOffset, getY() + getHeight() - 4);
batch.setColor(Color.WHITE);
batch.draw(background, getX(), getY(), getWidth(), getHeight());
}
示例9: 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;
}
示例10: 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;
}
示例11: 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();
}
示例12: 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;
}
示例13: 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;
}
示例14: 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;
}
示例15: 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;
}