Java Code Examples for com.badlogic.gdx.scenes.scene2d.Actor#getClass()

The following examples show how to use com.badlogic.gdx.scenes.scene2d.Actor#getClass() . 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: BottomMenu.java    From Norii with Apache License 2.0 6 votes vote down vote up
private void updateStatsMenu() {
	final float statsWidth = Gdx.graphics.getWidth() - (HERO_PORTRAIT_WIDTH_TILES * tileWidthPixel);
	final float statsHeight = BOTTOM_MENU_HEIGHT_TILES * tileHeightPixel;

	statsGroup.setHeight(statsHeight);
	statsGroup.setWidth(statsWidth);
	final LabelStyle labelStyle = Utility.createLabelStyle("fonts/BreatheFireIi-2z9W.ttf", 105, 1, Color.LIGHT_GRAY, 1, 1);
	for (final Actor actor : statsGroup.getChildren()) {
		if (actor.getClass() == Label.class) {
			final Label label = (Label) actor;
			label.setStyle(labelStyle);
			label.setFontScale(Gdx.graphics.getWidth() * LABEL_FONT_SCALE, Gdx.graphics.getHeight() * LABEL_FONT_SCALE);
		}
	}
	statsGroup.setPosition(HERO_PORTRAIT_WIDTH_TILES * tileWidthPixel, 0);
}
 
Example 2
Source File: UIWindow.java    From Norii with Apache License 2.0 5 votes vote down vote up
protected void updateSize() {
	for (final Actor actor : this.getChildren()) {
		if (actor.getClass() == Label.class) {
			updateSizeLabels(actor);
		}

		if (actor.getClass() == ImageButton.class) {
			updateSizeImageButtons(actor);
		}
	}
}
 
Example 3
Source File: PrefHeightIfVisibleValue.java    From vis-ui with Apache License 2.0 5 votes vote down vote up
@Override
public float get (Actor actor) {
	if (actor instanceof Widget) {
		Widget widget = (Widget) actor;
		return widget.isVisible() ? widget.getPrefHeight() : 0;
	}

	if (actor instanceof Table) {
		Table table = (Table) actor;
		return table.isVisible() ? table.getPrefHeight() : 0;
	}

	throw new IllegalStateException("Unsupported actor type for PrefHeightIfVisibleValue: " + actor.getClass());
}
 
Example 4
Source File: PrefWidthIfVisibleValue.java    From vis-ui with Apache License 2.0 5 votes vote down vote up
@Override
public float get (Actor actor) {
	if (actor instanceof Widget) {
		Widget widget = (Widget) actor;
		return widget.isVisible() ? widget.getPrefWidth() : 0;
	}

	if (actor instanceof Table) {
		Table table = (Table) actor;
		return table.isVisible() ? table.getPrefWidth() : 0;
	}

	throw new IllegalStateException("Unsupported actor type for PrefWidthIfVisibleValue: " + actor.getClass());
}