public void validate () { if (!layoutEnabled) return; Group parent = getParent(); if (fillParent && parent != null) { float parentWidth, parentHeight; Stage stage = getStage(); if (stage != null && parent == stage.getRoot()) { parentWidth = stage.getWidth(); parentHeight = stage.getHeight(); } else { parentWidth = parent.getWidth(); parentHeight = parent.getHeight(); } setSize(parentWidth, parentHeight); } if (!needsLayout) return; needsLayout = false; layout(); }
public void validate () { if (!layoutEnabled) return; Group parent = getParent(); if (fillParent && parent != null) { float parentWidth, parentHeight; Stage stage = getStage(); if (stage != null && parent == stage.getRoot()) { parentWidth = stage.getWidth(); parentHeight = stage.getHeight(); } else { parentWidth = parent.getWidth(); parentHeight = parent.getHeight(); } setSize(parentWidth, parentHeight); } if (!needsLayout) return; needsLayout = false; layout(); }
parentHeight = stage.getHeight(); } else { parentWidth = parent.getWidth(); parentHeight = parent.getHeight();
parentHeight = stage.getHeight(); } else { parentWidth = parent.getWidth(); parentHeight = parent.getHeight();
public T show(Group group, float sx, float sy, int aglin) { group.addActor(t); t.setPosition(group.getWidth() * sx, group.getHeight() * sy, aglin); return t; }
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); } }
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); } }
public void validate () { if (!layoutEnabled) return; Group parent = getParent(); if (fillParent && parent != null) { float parentWidth, parentHeight; Stage stage = getStage(); if (stage != null && parent == stage.getRoot()) { parentWidth = stage.getWidth(); parentHeight = stage.getHeight(); } else { parentWidth = parent.getWidth(); parentHeight = parent.getHeight(); } setSize(parentWidth, parentHeight); } if (!needsLayout) return; needsLayout = false; layout(); }
@Override public void draw (Batch batch, float parentAlpha) { if (keepWithinParent && getParent() != null) { float parentWidth = getParent().getWidth(); float parentHeight = getParent().getHeight(); if (getX() < 0) setX(0); if (getRight() > parentWidth) setX(parentWidth - getWidth()); if (getY() < 0) setY(0); if (getTop() > parentHeight) setY(parentHeight - getHeight()); } super.draw(batch, parentAlpha); } }
/** * Target screen resolution(800x480) may be smaller than selected asset resolution(1280x800) for * device screen resolution 1280x800. sizeMultiplier in this case will be "1". If there is size * information in layout xml file generated for 800x480 target screen resolution, size multiplier value "1" will * not work correctly. Position multiplier (1280 / 800 = 1.6) must be used in such cases for providing correct scaling. * * @param defaultWidth if width of the actor is not specified in layout file then defaultWidth is multiplied with sizeMultiplier * @param defaultHeight if height of the actor is not specified in layout file then defaultHeight is multiplied with sizeMultiplier */ protected void normalizeModelSize(BaseModel model, Group parent, float defaultWidth, float defaultHeight) { if (parent != null && model.isFillParentWidth()) { model.setWidth(parent.getWidth()); } else { float width = model.getWidth(); model.setWidth(width == 0 ? defaultWidth * resolutionHelper.getSizeMultiplier() : width * resolutionHelper.getPositionMultiplier()); } if (parent != null && model.isFillParentHeight()) { model.setHeight(parent.getHeight()); } else { float height = model.getHeight(); model.setHeight(height == 0 ? defaultHeight * resolutionHelper.getSizeMultiplier() : height * resolutionHelper.getPositionMultiplier()); } }
parentHeight = stage.getHeight(); } else { parentWidth = parent.getWidth(); parentHeight = parent.getHeight();
private void updateGroupProperties( ExternalGroupModel model, Group group){ group.setName( model.getName()); model.setWidth( group.getWidth()); model.setHeight( group.getHeight()); // For example .. <FriendsPanel > in top xml and its implementation's root group (FriendsPanel.xml file's) // should both be visible=true in order to set whole group visible, if at least one of them set to false // whole group will be invisible. group.setVisible(model.isVisible() && group.isVisible()); Vector2 screenPos; if (model.getScreenAlignmentSupport() == null) { screenPos = calculateScreenPosition(model.getScreenAlignment(), model); } else { screenPos = calculateScreenPosition(model.getScreenAlignment(), model.getScreenAlignmentSupport(), model); } if (screenPos != null) { group.setPosition(screenPos.x, screenPos.y); } else { float positionMultiplier = resolutionHelper.getPositionMultiplier(); group.setPosition(model.getX() * positionMultiplier, model.getY() * positionMultiplier); } setScaleProperty(model, group); } }