com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup Java Examples

The following examples show how to use com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup. 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: VfxViewController.java    From gdx-vfx with Apache License 2.0 5 votes vote down vote up
@LmlAction("createCanvas") Actor createCanvas() {
    canvasRoot = new WidgetGroup();
    canvasRoot.setName("canvasRoot");
    canvasRoot.setFillParent(true);

    VfxWidgetGroup vfxGroup = new VfxWidgetGroup(Pixmap.Format.RGBA8888);
    vfxGroup.setName("vfxGroup");
    vfxGroup.addActor(canvasRoot);
    vfxGroup.setMatchWidgetSize(true);

    vfxManager = vfxGroup.getVfxManager();
    vfxManager.setBlendingEnabled(false);

    return vfxGroup;
}
 
Example #2
Source File: StatusUI.java    From Norii with Apache License 2.0 5 votes vote down vote up
private void createGroups() {
	group = new WidgetGroup();
	group2 = new WidgetGroup();
	group.addActor(hpBarBackground);
	group.addActor(hpBar);
	group.setFillParent(true);
	group2.addActor(xpBar);
	group2.addActor(xpBarBackground);
	group2.setFillParent(true);

	defaults().expand().fill();
}
 
Example #3
Source File: HPBar.java    From Norii with Apache License 2.0 5 votes vote down vote up
private void initVariables() {
	group = new WidgetGroup();
	tileWidthPixel = Gdx.graphics.getWidth() / (float) TILE_TO_PIXEL_RATIO;
	tileHeightPixel = Gdx.graphics.getHeight() / (float) TILE_TO_PIXEL_RATIO;
	createDynamicHpBar();
	addImagesToGroup();
}
 
Example #4
Source File: ToastManager.java    From vis-ui with Apache License 2.0 5 votes vote down vote up
/** Toast manager will create own group to host toasts and put it into the stage root. */
public ToastManager (Stage stage) {
	WidgetGroup widgetGroup = new WidgetGroup();
	widgetGroup.setFillParent(true);
	widgetGroup.setTouchable(Touchable.childrenOnly);
	stage.addActor(widgetGroup);
	this.root = widgetGroup;
}
 
Example #5
Source File: DragPane.java    From vis-ui with Apache License 2.0 5 votes vote down vote up
/** @param group will replace the internally managed group. All current children will be moved to this group. */
@Override
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.
	}
}
 
Example #6
Source File: CardViewSmall.java    From Cardshifter with Apache License 2.0 5 votes vote down vote up
@Override
public void set(Object key, Object value) {
    if ("HEALTH".equals(key)) {
        Integer health = (Integer) value;
        Integer oldHealth = (Integer) properties.get(key);
        int diff = health - oldHealth;
        WidgetGroup grp = (WidgetGroup) table.getParent();
        grp.layout();
        
        if (diff != 0) {
            Vector2 pos = new Vector2(table.getWidth() / 2, table.getHeight() / 2);
            table.localToStageCoordinates(pos);
            final Label changeLabel = new Label(String.valueOf(diff), context.getSkin());
            Gdx.app.log("Anim", "Create health animation at " + pos.x + ", " + pos.y);
            changeLabel.setPosition(pos.x, pos.y);
            if (diff > 0) {
            	changeLabel.setColor(Color.GREEN);
            } else {
            	changeLabel.setColor(Color.RED);
            }
            changeLabel.addAction(Actions.sequence(Actions.moveBy(0, this.screenHeight/8, 1.5f), Actions.run(new Runnable() {
                @Override
                public void run() {
                    changeLabel.remove();
                }
            })));
            context.getStage().addActor(changeLabel);
        }
    }
    properties.put((String) key, value);
    cost.update(properties);
    stats.update(properties);
}
 
Example #7
Source File: HPBar.java    From Norii with Apache License 2.0 4 votes vote down vote up
public WidgetGroup getHpBarGroup() {
	return group;
}
 
Example #8
Source File: GroupLmlTag.java    From gdx-texture-packer-gui with Apache License 2.0 4 votes vote down vote up
@Override
protected WidgetGroup getNewInstanceOfGroup(LmlActorBuilder builder) {
    return new WidgetGroup();
}
 
Example #9
Source File: ToastManager.java    From gdx-texture-packer-gui with Apache License 2.0 4 votes vote down vote up
public ToastManager(Stage stage) {
	WidgetGroup widgetGroup = new WidgetGroup();
	widgetGroup.setFillParent(true);
	stage.addActor(widgetGroup);
	this.root = widgetGroup;
}
 
Example #10
Source File: DragPane.java    From vis-ui with Apache License 2.0 4 votes vote down vote up
/** @return internally managed group of actors. */
public WidgetGroup getGroup () {
	return getActor();
}
 
Example #11
Source File: DragPane.java    From vis-ui with Apache License 2.0 4 votes vote down vote up
/** @param group will replace the internally managed group. All current children will be moved to this group. */
public void setGroup (final WidgetGroup group) {
	setActor(group);
}
 
Example #12
Source File: TestFlowGroup.java    From vis-ui with Apache License 2.0 4 votes vote down vote up
public TestFlowGroup () {
		super("flow groups");

		TableUtils.setSpacingDefaults(this);
		columnDefaults(0).left();

		setResizable(true);
		addCloseButton();
		closeOnEscape();

		WidgetGroup group = new VerticalFlowGroup(2);

		String lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi luctus magna sit amet tellus egestas tincidunt. " +
				"Morbi tempus eleifend dictum. Nunc ex nisl, dignissim eget gravida vel, rutrum a nibh. Fusce congue odio ac elit " +
				"rhoncus rutrum. Donec nec lectus leo. Phasellus et consectetur ante. Cras vel consectetur mauris, sed semper lectus. ";
		String[] parts = lorem.split(" ");
		for (String part : parts) {
			group.addActor(new VisLabel(part));
		}

//		group.addActor(new VisLabel("Lorem ipsum"));
//		group.addActor(new VisLabel("dolor sit"));
//		group.addActor(new VisLabel("amet"));
//		group.addActor(new VisLabel("a\nb\nc"));
//		group.addActor(new VisLabel("Lorem ipsum"));
//		group.addActor(new VisLabel("dolor sit"));
//		group.addActor(new VisLabel("amet"));
//		group.addActor(new VisLabel("a\nb\nc"));
//		group.addActor(new VisLabel("Lorem ipsum"));
//		group.addActor(new VisLabel("dolor sit"));
//		group.addActor(new VisLabel("amet"));
//		group.addActor(new VisLabel("a\nb\nc"));

		VisScrollPane scrollPane = new VisScrollPane(group);
		scrollPane.setFadeScrollBars(false);
		scrollPane.setFlickScroll(false);
		scrollPane.setOverscroll(false, false);
		scrollPane.setScrollingDisabled(group instanceof HorizontalFlowGroup, group instanceof VerticalFlowGroup);
		add(scrollPane).grow();

		setSize(300, 150);
		centerWindow();
	}
 
Example #13
Source File: DragPane.java    From vis-ui with Apache License 2.0 3 votes vote down vote up
/**
 * @param group must append its actors through standard {@link WidgetGroup#addActor(Actor)} method. Must support
 * {@link WidgetGroup#addActorAfter(Actor, Actor)} and {@link WidgetGroup#addActorBefore(Actor, Actor)} methods. Note
 * that {@link com.badlogic.gdx.scenes.scene2d.ui.Table} does not meet these requirements.
 * @see VerticalGroup
 * @see HorizontalGroup
 * @see GridGroup
 */
public DragPane (final WidgetGroup group) {
	if (group == null) {
		throw new IllegalArgumentException("Group cannot be null.");
	}
	super.setActor(group);
	setTouchable(Touchable.enabled);
}