List of usage examples for com.badlogic.gdx.scenes.scene2d.ui WidgetGroup addActor
public void addActor(Actor actor)
From source file:com.kotcrab.vis.ui.layout.DragPane.java
License:Apache License
/** @param group will replace the internally managed group. All current children will be moved to this group. */ @Override/*from w ww . j a va 2s . c om*/ public void setActor(final WidgetGroup group) { if (group == null) { throw new IllegalArgumentException("Group cannot be null."); } final Group previousGroup = getActor(); super.setActor(group); attachListener(); // Attaches draggable to all previous group children. for (final Actor child : previousGroup.getChildren()) { group.addActor(child); // No need to attach draggable, child was already in pane. } }
From source file:de.longri.cachebox3.gui.activities.Settings_Activity.java
License:Open Source License
private void showListView(ListView listView, String name, boolean animate) { float y = btnOk.getY() + btnOk.getHeight() + CB.scaledSizes.MARGIN; WidgetGroup widgetGroup = new WidgetGroup(); widgetGroup.setBounds(CB.scaledSizes.MARGIN, y, Gdx.graphics.getWidth() - CB.scaledSizes.MARGINx2, Gdx.graphics.getHeight() - (y + CB.scaledSizes.MARGIN)); // title/*from w w w . j a v a 2 s. c o m*/ WidgetGroup titleGroup = new WidgetGroup(); float topY = widgetGroup.getHeight() - CB.scaledSizes.MARGIN_HALF; float xPos = 0; ClickListener backClickListener = new ClickListener() { public void clicked(InputEvent event, float x, float y) { backClick(); } }; // add the titleLabel on top if (style.backIcon != null && listViewsNames.size > 0) { Image backImage = new Image(style.backIcon); backImage.setPosition(xPos, 0); xPos += backImage.getWidth() + CB.scaledSizes.MARGIN; titleGroup.addActor(backImage); } VisLabel titleLabel = new VisLabel(name, "menu_title_act"); if (listViewsNames.size > 0) { VisLabel parentTitleLabel = new VisLabel(listViewsNames.get(listViewsNames.size - 1), "menu_title_parent"); parentTitleLabel.setPosition(xPos, 0); xPos += parentTitleLabel.getWidth() + CB.scaledSizes.MARGINx2; titleGroup.addActor(parentTitleLabel); } else { //center titleLabel xPos = (Gdx.graphics.getWidth() - titleLabel.getWidth()) / 2; } titleLabel.setPosition(xPos, 0); titleGroup.addActor(titleLabel); float titleHeight = titleLabel.getHeight() + CB.scaledSizes.MARGIN; titleGroup.setBounds(0, Gdx.graphics.getHeight() - (y + titleHeight), Gdx.graphics.getWidth(), titleHeight); titleGroup.addListener(backClickListener); widgetGroup.addActor(titleGroup); listView.setBounds(0, 0, widgetGroup.getWidth(), titleGroup.getY() - CB.scaledSizes.MARGIN); listView.layout(); listView.setBackground(null); // remove default background widgetGroup.addActor(listView); if (listViews.size > 0) { // animate float nextXPos = Gdx.graphics.getWidth() + CB.scaledSizes.MARGIN; if (animate) { listViews.get(listViews.size - 1) .addAction(Actions.moveTo(0 - nextXPos, y, Menu.MORE_MENU_ANIMATION_TIME)); widgetGroup.setPosition(nextXPos, y); widgetGroup.addAction(Actions.moveTo(CB.scaledSizes.MARGIN, y, Menu.MORE_MENU_ANIMATION_TIME)); } else { widgetGroup.setPosition(CB.scaledSizes.MARGIN, y); } } listViews.add(widgetGroup); listViewsNames.add(name); this.addActor(widgetGroup); }
From source file:de.longri.cachebox3.gui.animations.actor_animations.AddActorAction.java
License:Open Source License
public boolean act(float delta) { if (!added) { added = true;/*from w ww .j av a 2 s . co m*/ if (target instanceof WidgetGroup) { WidgetGroup group = (WidgetGroup) target; group.addActor(actor); } } return true; }
From source file:es.eucm.ead.engine.LoadingIndicatorDemo.java
License:Open Source License
@Override public void create() { Gdx.app.setLogLevel(Application.LOG_DEBUG); Gdx.gl.glClearColor(0f, 0f, 0f, 0f); stage = new Stage(new ScreenViewport()); WidgetGroup modalContainer = new WidgetGroup(); modalContainer.setFillParent(true);//w w w .j a va 2 s .c o m WidgetGroup viewContainer = new WidgetGroup(); viewContainer.setFillParent(true); stage.getRoot().addActor(viewContainer); stage.getRoot().addActor(modalContainer); Gdx.input.setInputProcessor(stage); actor = new LoadingIndicator(); if (actor instanceof WidgetGroup) { ((WidgetGroup) actor).setFillParent(true); } viewContainer.addActor(actor); }