Java Code Examples for com.badlogic.gdx.scenes.scene2d.ui.Image#setColor()

The following examples show how to use com.badlogic.gdx.scenes.scene2d.ui.Image#setColor() . 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: AbilityIconCounter.java    From dice-heroes with GNU General Public License v3.0 6 votes vote down vote up
public AbilityIconCounter(Ability ability, int value) {
    if (ability == null) {
        ability = Config.abilities.get("skip-turn");
    }
    image = new Image(Config.skin.getDrawable("ability/" + ability.name + "-icon"));
    if (ability.cost <0) image.setColor(AbilityIcon.unique);
    image.setScaling(Scaling.none);
    image.setAlign(Align.left | Align.top);
    image.moveBy(0, 1);

    counter = new Label("", Config.skin, "default", "inventory-counter");
    counter.setAlignment(Align.right | Align.bottom);
    setCount(value);

    addActor(image);
    addActor(counter);

    setSize(image.getPrefWidth(), image.getPrefHeight());
}
 
Example 2
Source File: BeamVisualizer.java    From dice-heroes with GNU General Public License v3.0 5 votes vote down vote up
@Override public IFuture<Void> visualize(ITargetOwner result) {
    final Future<Void> future = new Future<Void>();
    SoundManager.instance.playSoundIfExists(soundName);
    Image image = new Image(Config.skin, "effect-luck-image");
    image.setColor(color);
    image.setScale(0, 0);
    image.setOrigin(image.getWidth() / 2, image.getHeight() / 2);
    image.setPosition(
        result.getTarget().getX() * ViewController.CELL_SIZE + (ViewController.CELL_SIZE - image.getWidth()) * 0.5f,
        result.getTarget().getY() * ViewController.CELL_SIZE + (ViewController.CELL_SIZE - image.getHeight()) * 0.5f + 6
    );
    visualizer.viewController.effectLayer.addActor(image);
    image.addAction(
        Actions.sequence(
            Actions.parallel(
                Actions.scaleTo(0.75f, 0.75f, 0.5f, Interpolation.sine),
                Actions.rotateBy(135, 0.5f)
            ),
            Actions.parallel(
                Actions.scaleTo(0, 0, 0.5f, Interpolation.sine),
                Actions.rotateBy(135, 0.5f)
            ),
            Actions.run(future),
            Actions.removeActor()
        )
    );
    return future;
}
 
Example 3
Source File: TestColorPicker.java    From vis-ui with Apache License 2.0 5 votes vote down vote up
public TestColorPicker () {
	super("color picker");

	final Image image = new Image(white);

	picker = new ColorPicker("color picker", new ColorPickerAdapter() {
		@Override
		public void finished (Color newColor) {
			image.setColor(newColor);
		}
	});

	VisTextButton showPickerButton = new VisTextButton("show color picker");
	showPickerButton.addListener(new ChangeListener() {
		@Override
		public void changed (ChangeEvent event, Actor actor) {
			getStage().addActor(picker.fadeIn());
		}
	});

	Color c = new Color(27 / 255.0f, 161 / 255.0f, 226 / 255.0f, 1);
	picker.setColor(c);
	image.setColor(c);

	TableUtils.setSpacingDefaults(this);

	add(showPickerButton);
	add(image).size(32).pad(3);

	pack();
	setPosition(948, 148);
}