Search in sources :

Example 1 with ImageContainer

use of eidolons.libgdx.bf.generic.ImageContainer in project Eidolons by IDemiurge.

the class ValueContainer method init.

protected void init(TextureRegion texture, String name, String value) {
    imageContainer = addElement(null);
    setName(name);
    if (texture != null) {
        imageContainer.setActor(new ImageContainer(new Image(texture))).height(texture.getRegionHeight()).width(texture.getRegionWidth()).center();
    } else {
        imageContainer.fill(false).expand(0, 0);
    }
    if (isVertical()) {
        row();
    }
    this.nameContainer = addElement(null);
    if (isVertical()) {
        row();
    }
    if (name != null) {
        setName(name);
        nameLabel = new Label(name, style);
    }
    nameContainer.setActor(nameLabel).grow().center().padRight(12);
    valueContainer = addElement(null);
    if (isVertical()) {
        row();
    }
    if (StringUtils.isNotEmpty(value)) {
        valueLabel = new Label(value, style);
    }
    valueContainer.setActor(valueLabel).grow().center();
    setNameAlignment(Align.center);
    setValueAlignment(Align.center);
    initSize();
}
Also used : Label(com.badlogic.gdx.scenes.scene2d.ui.Label) Image(com.badlogic.gdx.scenes.scene2d.ui.Image) ImageContainer(eidolons.libgdx.bf.generic.ImageContainer)

Example 2 with ImageContainer

use of eidolons.libgdx.bf.generic.ImageContainer in project Eidolons by IDemiurge.

the class MapStage method updateBackground.

private void updateBackground(String s, boolean nextMapUpdate) {
    final String path = s;
    TextureRegion backTexture = getOrCreateR(path);
    ImageContainer map = this.map;
    if (nextMapUpdate) {
        map = this.nextMap;
    }
    map.setContents(new Image(backTexture));
    lastNextMapAlphaPercentage = 0;
}
Also used : TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) Image(com.badlogic.gdx.scenes.scene2d.ui.Image) ImageContainer(eidolons.libgdx.bf.generic.ImageContainer)

Example 3 with ImageContainer

use of eidolons.libgdx.bf.generic.ImageContainer in project Eidolons by IDemiurge.

the class MapAlphaLayers method init.

public void init() {
    for (File subdir : FileManager.getFilesFromDirectory(getMainPath(), true)) {
        MAP_LAYER_TYPE type = new EnumMaster<MAP_LAYER_TYPE>().retrieveEnumConst(MAP_LAYER_TYPE.class, subdir.getName().toUpperCase());
        if (type != null)
            if (subdir.isDirectory())
                for (File img : subdir.listFiles()) // FileManager.getFilesFromDirectory(subdir.getPath(), true)
                {
                    if (!FileManager.isImageFile(img.getName()))
                        continue;
                    String path = img.getPath();
                    try {
                        path = StringMaster.removePreviousPathSegments(img.getPath(), PathFinder.getImagePath());
                    } catch (Exception e) {
                        main.system.ExceptionMaster.printStackTrace(e);
                    }
                    Image image = new Image(TextureCache.getOrCreateR(path));
                    ImageContainer container = new ImageContainer(image);
                    container.setFluctuateAlpha(true);
                    container.setFluctuatingAlpha(RandomWizard.getRandomFloatBetween(type.alphaMin, type.alphaMax));
                    container.setFluctuatingAlphaPauseDuration(type.pauseAtZero);
                    container.setFluctuatingFullAlphaDuration(type.pauseAtFull);
                    container.setFluctuatingAlphaMin(type.alphaMin);
                    container.setFluctuatingAlphaMax(type.alphaMax);
                    container.setAlphaStep(type.alphaStep);
                    container.setFluctuatingAlphaRandomness(type.randomness);
                    if (img.getName().split("_").length < 2)
                        continue;
                    Coordinates c = new Coordinates(true, img.getName().split("_")[1]);
                    container.setPosition(c.x, MapScreen.defaultSize - c.y);
                    for (DAY_TIME sub : type.times) MapMaster.addToListMap(map, sub, container);
                }
    }
    initialized = true;
}
Also used : DAY_TIME(main.content.enums.macro.MACRO_CONTENT_CONSTS.DAY_TIME) Coordinates(main.game.bf.Coordinates) Image(com.badlogic.gdx.scenes.scene2d.ui.Image) File(java.io.File) ImageContainer(eidolons.libgdx.bf.generic.ImageContainer)

Aggregations

Image (com.badlogic.gdx.scenes.scene2d.ui.Image)3 ImageContainer (eidolons.libgdx.bf.generic.ImageContainer)3 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)1 Label (com.badlogic.gdx.scenes.scene2d.ui.Label)1 File (java.io.File)1 DAY_TIME (main.content.enums.macro.MACRO_CONTENT_CONSTS.DAY_TIME)1 Coordinates (main.game.bf.Coordinates)1