Java Code Examples for com.badlogic.gdx.utils.Align#bottom()
The following examples show how to use
com.badlogic.gdx.utils.Align#bottom() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RadialBlurEffect.java From gdx-vfx with Apache License 2.0 | 6 votes |
/** * Specify the zoom origin in {@link Align} bits. * @see Align */ public void setOrigin(int align) { final float originX; final float originY; if ((align & Align.left) != 0) { originX = 0f; } else if ((align & Align.right) != 0) { originX = 1f; } else { originX = 0.5f; } if ((align & Align.bottom) != 0) { originY = 0f; } else if ((align & Align.top) != 0) { originY = 1f; } else { originY = 0.5f; } setOrigin(originX, originY); }
Example 2
Source File: ZoomEffect.java From gdx-vfx with Apache License 2.0 | 6 votes |
/** * Specify the zoom origin in {@link Align} bits. * @see Align */ public void setOrigin(int align) { final float originX; final float originY; if ((align & Align.left) != 0) { originX = 0f; } else if ((align & Align.right) != 0) { originX = 1f; } else { originX = 0.5f; } if ((align & Align.bottom) != 0) { originY = 0f; } else if ((align & Align.top) != 0) { originY = 1f; } else { originY = 0.5f; } setOrigin(originX, originY); }
Example 3
Source File: MenuScreen.java From bladecoder-adventure-engine with Apache License 2.0 | 6 votes |
private int getAlign() { if (getStyle().align == null || "center".equals(getStyle().align)) return Align.center; if ("top".equals(getStyle().align)) return Align.top; if ("bottom".equals(getStyle().align)) return Align.bottom; if ("left".equals(getStyle().align)) return Align.left; if ("right".equals(getStyle().align)) return Align.right; return Align.center; }
Example 4
Source File: AlignUtils.java From bladecoder-adventure-engine with Apache License 2.0 | 6 votes |
public static String getAlign(int align) { switch (align) { case Align.bottomRight: return "bottom-right"; case Align.bottomLeft: return "bottom-left"; case Align.topRight: return "top-right"; case Align.topLeft: return "top-left"; case Align.right: return "right"; case Align.left: return "left"; case Align.bottom: return "bottom"; case Align.top: return "top"; case Align.center: return "center"; } return ""; }
Example 5
Source File: AlignUtils.java From bladecoder-adventure-engine with Apache License 2.0 | 6 votes |
public static int getAlign(String s) { if ("bottom-right".equals(s)) return Align.bottomRight; else if ("bottom-left".equals(s)) return Align.bottomLeft; else if ("top-right".equals(s)) return Align.topRight; else if ("top-left".equals(s)) return Align.topLeft; else if ("right".equals(s)) return Align.right; else if ("left".equals(s)) return Align.left; else if ("bottom".equals(s)) return Align.bottom; else if ("top".equals(s)) return Align.top; else if ("center".equals(s)) return Align.center; return 0; }
Example 6
Source File: CCLabel.java From cocos-ui-libgdx with Apache License 2.0 | 5 votes |
@Override public Actor parse(CocoStudioUIEditor editor, ObjectData widget) { final TTFLabelStyle labelStyle = editor.createLabelStyle(widget, widget.getLabelText(), editor.getColor(widget.getCColor(), 0)); TTFLabel label = new TTFLabel(widget.getLabelText(), labelStyle); // 水平 int h = Integer.MAX_VALUE; if ("HT_Center".equals(widget.getHorizontalAlignmentType())) { h = Align.center; } else if ("HT_Left".equals(widget.getHorizontalAlignmentType())) { h = Align.left; } else if ("HT_Right".equals(widget.getHorizontalAlignmentType())) { h = Align.right; } // 垂直 int v = Integer.MAX_VALUE; if ("HT_Center".equals(widget.getVerticalAlignmentType())) { v = Align.center; } else if ("HT_Top".equals(widget.getVerticalAlignmentType())) { v = Align.top; } else if ("HT_Bottom".equals(widget.getVerticalAlignmentType())) { v = Align.bottom; } if (v != Integer.MAX_VALUE) { label.setAlignment(h, v); } return label; }
Example 7
Source File: ToastManager.java From gdx-texture-packer-gui with Apache License 2.0 | 5 votes |
private void updateToastsPositions () { boolean bottom = (alignment & Align.bottom) != 0; boolean left = (alignment & Align.left) != 0; float y = bottom ? screenPadding : root.getHeight() - screenPadding; for (Toast toast : toasts) { Table table = toast.getMainTable(); table.setPosition( left ? screenPadding : root.getWidth() - table.getWidth() - screenPadding, bottom ? y : y - table.getHeight()); y += (table.getHeight() + messagePadding) * (bottom ? 1 : -1); } }
Example 8
Source File: ToastManager.java From vis-ui with Apache License 2.0 | 5 votes |
private void updateToastsPositions () { boolean bottom = (alignment & Align.bottom) != 0; boolean left = (alignment & Align.left) != 0; float y = bottom ? screenPaddingY : root.getHeight() - screenPaddingY; for (Toast toast : toasts) { Table table = toast.getMainTable(); table.setPosition( left ? screenPaddingX : root.getWidth() - table.getWidth() - screenPaddingX, bottom ? y : y - table.getHeight()); y += (table.getHeight() + messagePadding) * (bottom ? 1 : -1); } }
Example 9
Source File: TextRenderer.java From bladecoder-adventure-engine with Apache License 2.0 | 5 votes |
public static float getAlignDy(float height, int align) { if ((align & Align.bottom) != 0) return 0; else if ((align & Align.top) != 0) return -height; else if ((align & Align.center) != 0) return -height / 2.0f; return 0; }
Example 10
Source File: AnimationRenderer.java From bladecoder-adventure-engine with Apache License 2.0 | 5 votes |
public static float getAlignDy(float height, int align) { if ((align & Align.bottom) != 0) return 0; else if ((align & Align.top) != 0) return -height; else if ((align & Align.center) != 0) return -height / 2.0f; return 0; }
Example 11
Source File: EditWidget.java From skin-composer with MIT License | 4 votes |
@Override public void layout() { super.layout(); temp.set(0, 0); if (followActor != null) { followActor.localToStageCoordinates(temp); stageToLocalCoordinates(temp); setBounds(temp.x, temp.y, followActor.getWidth(), followActor.getHeight()); } else if (cell != null) { var table = cell.getTable(); temp.set(table.getPadLeft(), table.getPadBottom()); var contentWidth = 0f; var contentHeight = 0f; for (int i = 0; i < table.getColumns(); i++) { contentWidth += table.getColumnWidth(i); } for (int i = 0; i < table.getRows(); i++) { contentHeight += table.getRowHeight(i); } if ((table.getAlign() & Align.right) != 0) { temp.add(table.getWidth() - contentWidth - table.getPadLeft() - table.getPadRight(), 0); } else if ((table.getAlign() & Align.left) == 0) { temp.add((table.getWidth() - contentWidth - table.getPadLeft() - table.getPadRight()) / 2, 0); } if ((table.getAlign() & Align.top) != 0) { temp.add(0, table.getHeight() - contentHeight - table.getPadBottom() - table.getPadTop()); } else if ((table.getAlign() & Align.bottom) == 0) { temp.add(0, (table.getHeight() - contentHeight - table.getPadBottom() - table.getPadTop()) / 2); } table.localToStageCoordinates(temp); stageToLocalCoordinates(temp); var xpos = 0f; var ypos = 0f; for (int i = 0; i < cell.getColumn(); i++) { xpos += table.getColumnWidth(i); } for (int i = table.getRows() - 1; i > cell.getRow(); i--) { ypos += table.getRowHeight(i); } var cellWidth = 0; for (int i = cell.getColumn(); i < cell.getColumn() + cell.getColspan(); i++) { cellWidth += table.getColumnWidth(i); } setBounds(temp.x + xpos, temp.y + ypos, cellWidth, table.getRowHeight(cell.getRow())); } }