Search in sources :

Example 1 with OwnTextIconButton

use of gaiasky.util.scene2d.OwnTextIconButton in project gaiasky by langurmonkey.

the class VisualEffectsComponent method initialize.

@SuppressWarnings("unchecked")
public void initialize() {
    float contentWidth = ControlsWindow.getContentWidth();
    /* Star brightness */
    starBrightness = new OwnSliderPlus(I18n.txt("gui.starbrightness"), Constants.MIN_SLIDER, Constants.MAX_SLIDER, Constants.SLIDER_STEP_TINY, Constants.MIN_STAR_BRIGHTNESS, Constants.MAX_STAR_BRIGHTNESS, skin);
    starBrightness.setName("star brightness");
    starBrightness.setWidth(contentWidth);
    starBrightness.setMappedValue(Settings.settings.scene.star.brightness);
    starBrightness.addListener(event -> {
        if (event instanceof ChangeEvent && hackProgrammaticChangeEvents) {
            EventManager.publish(Event.STAR_BRIGHTNESS_CMD, starBrightness, starBrightness.getMappedValue());
            return true;
        }
        return false;
    });
    /* Star brightness power */
    starBrightnessPower = new OwnSliderPlus(I18n.txt("gui.starbrightness.pow"), Constants.MIN_STAR_BRIGHTNESS_POW, Constants.MAX_STAR_BRIGHTNESS_POW, Constants.SLIDER_STEP_TINY, skin);
    starBrightnessPower.setName("star brightness power");
    starBrightnessPower.setWidth(contentWidth);
    starBrightnessPower.setMappedValue(Settings.settings.scene.star.power);
    starBrightnessPower.addListener(event -> {
        if (event instanceof ChangeEvent && hackProgrammaticChangeEvents) {
            EventManager.publish(Event.STAR_BRIGHTNESS_POW_CMD, starBrightnessPower, starBrightnessPower.getValue());
            return true;
        }
        return false;
    });
    /* Star size */
    starSize = new OwnSliderPlus(I18n.txt("gui.star.size"), Constants.MIN_STAR_POINT_SIZE, Constants.MAX_STAR_POINT_SIZE, Constants.SLIDER_STEP_TINY, skin);
    starSize.setName("star size");
    starSize.setWidth(contentWidth);
    starSize.setMappedValue(Settings.settings.scene.star.pointSize);
    starSize.addListener(event -> {
        if (flag && event instanceof ChangeEvent) {
            EventManager.publish(Event.STAR_POINT_SIZE_CMD, starSize, starSize.getMappedValue());
            return true;
        }
        return false;
    });
    /* Star min opacity */
    starMinOpacity = new OwnSliderPlus(I18n.txt("gui.star.opacity"), Constants.MIN_STAR_MIN_OPACITY, Constants.MAX_STAR_MIN_OPACITY, Constants.SLIDER_STEP_TINY, skin);
    starMinOpacity.setName("star min opacity");
    starMinOpacity.setWidth(contentWidth);
    starMinOpacity.setMappedValue(Settings.settings.scene.star.opacity[0]);
    starMinOpacity.addListener(event -> {
        if (event instanceof ChangeEvent && hackProgrammaticChangeEvents) {
            EventManager.publish(Event.STAR_MIN_OPACITY_CMD, starMinOpacity, starMinOpacity.getMappedValue());
            return true;
        }
        return false;
    });
    /* Ambient light */
    ambientLight = new OwnSliderPlus(I18n.txt("gui.light.ambient"), Constants.MIN_AMBIENT_LIGHT, Constants.MAX_AMBIENT_LIGHT, Constants.SLIDER_STEP_TINY, skin);
    ambientLight.setName("ambient light");
    ambientLight.setWidth(contentWidth);
    ambientLight.setMappedValue(Settings.settings.scene.renderer.ambient);
    ambientLight.addListener(event -> {
        if (event instanceof ChangeEvent) {
            EventManager.publish(Event.AMBIENT_LIGHT_CMD, ambientLight, ambientLight.getMappedValue());
            return true;
        }
        return false;
    });
    /* Label size */
    labelSize = new OwnSliderPlus(I18n.txt("gui.label.size"), Constants.MIN_LABEL_SIZE, Constants.MAX_LABEL_SIZE, Constants.SLIDER_STEP_TINY, skin);
    labelSize.setName("label size");
    labelSize.setWidth(contentWidth);
    labelSize.setMappedValue(Settings.settings.scene.label.size);
    labelSize.addListener(event -> {
        if (event instanceof ChangeEvent && hackProgrammaticChangeEvents) {
            float val = labelSize.getMappedValue();
            EventManager.publish(Event.LABEL_SIZE_CMD, labelSize, val);
            return true;
        }
        return false;
    });
    /* Line width */
    lineWidth = new OwnSliderPlus(I18n.txt("gui.line.width"), Constants.MIN_LINE_WIDTH, Constants.MAX_LINE_WIDTH, Constants.SLIDER_STEP_TINY, Constants.MIN_LINE_WIDTH, Constants.MAX_LINE_WIDTH, skin);
    lineWidth.setName("line width");
    lineWidth.setWidth(contentWidth);
    lineWidth.setMappedValue(Settings.settings.scene.lineWidth);
    lineWidth.addListener(event -> {
        if (event instanceof ChangeEvent && hackProgrammaticChangeEvents) {
            float val = lineWidth.getMappedValue();
            EventManager.publish(Event.LINE_WIDTH_CMD, lineWidth, val);
            return true;
        }
        return false;
    });
    /* Elevation multiplier */
    elevMult = new OwnSliderPlus(I18n.txt("gui.elevation.multiplier"), Constants.MIN_ELEVATION_MULT, Constants.MAX_ELEVATION_MULT, 0.1f, false, skin);
    elevMult.setName("elevation mult");
    elevMult.setWidth(contentWidth);
    elevMult.setValue((float) MathUtilsd.roundAvoid(Settings.settings.scene.renderer.elevation.multiplier, 1));
    elevMult.addListener(event -> {
        if (event instanceof ChangeEvent) {
            float val = elevMult.getValue();
            EventManager.publish(Event.ELEVATION_MULTIPLIER_CMD, elevMult, val);
            return true;
        }
        return false;
    });
    /* Reset defaults */
    OwnTextIconButton resetDefaults = new OwnTextIconButton(I18n.txt("gui.resetdefaults"), skin, "reset");
    resetDefaults.align(Align.center);
    resetDefaults.setWidth(contentWidth);
    resetDefaults.addListener(new OwnTextTooltip(I18n.txt("gui.resetdefaults.tooltip"), skin));
    resetDefaults.addListener(event -> {
        if (event instanceof ChangeEvent) {
            // Read defaults from internal settings file
            try {
                Path confFolder = Settings.settings.assetsPath("conf");
                Path internalFolderConfFile = confFolder.resolve(SettingsManager.getConfigFileName(Settings.settings.runtime.openVr));
                Yaml yaml = new Yaml();
                Map<Object, Object> conf = yaml.load(Files.newInputStream(internalFolderConfFile));
                float br = ((Double) ((Map<String, Object>) ((Map<String, Object>) conf.get("scene")).get("star")).get("brightness")).floatValue();
                float pow = ((Double) ((Map<String, Object>) ((Map<String, Object>) conf.get("scene")).get("star")).get("power")).floatValue();
                float ss = ((Double) ((Map<String, Object>) ((Map<String, Object>) conf.get("scene")).get("star")).get("pointSize")).floatValue();
                float pam = (((java.util.List<Double>) ((Map<String, Object>) ((Map<String, Object>) conf.get("scene")).get("star")).get("opacity")).get(0)).floatValue();
                float amb = ((Double) ((Map<String, Object>) ((Map<String, Object>) conf.get("scene")).get("renderer")).get("ambient")).floatValue();
                float ls = ((Double) ((Map<String, Object>) ((Map<String, Object>) conf.get("scene")).get("label")).get("size")).floatValue();
                float lw = ((Double) ((Map<String, Object>) conf.get("scene")).get("lineWidth")).floatValue();
                float em = ((Double) ((Map<String, Object>) ((Map<String, Object>) ((Map<Object, Object>) conf.get("scene")).get("renderer")).get("elevation")).get("multiplier")).floatValue();
                // Events
                EventManager m = EventManager.instance;
                m.post(Event.STAR_BRIGHTNESS_CMD, resetDefaults, br);
                m.post(Event.STAR_BRIGHTNESS_POW_CMD, resetDefaults, pow);
                m.post(Event.STAR_POINT_SIZE_CMD, resetDefaults, ss);
                m.post(Event.STAR_MIN_OPACITY_CMD, resetDefaults, pam);
                m.post(Event.AMBIENT_LIGHT_CMD, resetDefaults, amb);
                m.post(Event.LABEL_SIZE_CMD, resetDefaults, ls);
                m.post(Event.LINE_WIDTH_CMD, resetDefaults, lw);
                m.post(Event.ELEVATION_MULTIPLIER_CMD, resetDefaults, em);
            } catch (IOException e) {
                logger.error(e, "Error loading default configuration file");
            }
            return true;
        }
        return false;
    });
    /* Add to group */
    VerticalGroup lightingGroup = new VerticalGroup().align(Align.left).columnAlign(Align.left);
    lightingGroup.space(pad9);
    lightingGroup.addActor(starBrightness);
    lightingGroup.addActor(starBrightnessPower);
    lightingGroup.addActor(starSize);
    lightingGroup.addActor(starMinOpacity);
    lightingGroup.addActor(ambientLight);
    lightingGroup.addActor(lineWidth);
    lightingGroup.addActor(labelSize);
    lightingGroup.addActor(elevMult);
    lightingGroup.addActor(resetDefaults);
    component = lightingGroup;
    EventManager.instance.subscribe(this, Event.STAR_POINT_SIZE_CMD, Event.STAR_BRIGHTNESS_CMD, Event.STAR_BRIGHTNESS_POW_CMD, Event.STAR_MIN_OPACITY_CMD, Event.LABEL_SIZE_CMD, Event.LINE_WIDTH_CMD);
}
Also used : OwnTextIconButton(gaiasky.util.scene2d.OwnTextIconButton) Path(java.nio.file.Path) OwnTextTooltip(gaiasky.util.scene2d.OwnTextTooltip) EventManager(gaiasky.event.EventManager) OwnSliderPlus(gaiasky.util.scene2d.OwnSliderPlus) IOException(java.io.IOException) VerticalGroup(com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup) Yaml(org.yaml.snakeyaml.Yaml) ChangeEvent(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent) Map(java.util.Map)

Example 2 with OwnTextIconButton

use of gaiasky.util.scene2d.OwnTextIconButton in project gaiasky by langurmonkey.

the class WelcomeGui method buildWelcomeUI.

private void buildWelcomeUI() {
    serverDatasets = !downloadError ? DataDescriptorUtils.instance().buildServerDatasets(dataDescriptor) : null;
    reloadLocalDatasets();
    // Center table
    Table center = new Table(skin);
    center.setFillParent(true);
    center.center();
    if (bgTex == null)
        bgTex = new Texture(Gdx.files.internal("img/splash/splash.jpg"));
    Drawable bg = new SpriteDrawable(new Sprite(bgTex));
    center.setBackground(bg);
    float pad16 = 16f;
    float pad18 = 18f;
    float pad32 = 32f;
    float pad28 = 28f;
    float bw = 540f;
    float bh = 110f;
    Set<String> removed = removeNonExistent();
    if (removed.size() > 0) {
        logger.warn(I18n.txt("gui.welcome.warn.nonexistent", removed.size()));
        logger.warn(TextUtils.setToStr(removed));
    }
    int numCatalogsAvailable = numCatalogsAvailable();
    int numGaiaDRCatalogsEnabled = numGaiaDRCatalogsEnabled();
    int numStarCatalogsEnabled = numStarCatalogsEnabled();
    int numTotalCatalogsEnabled = numTotalDatasetsEnabled();
    boolean baseDataPresent = baseDataPresent();
    // Title
    HorizontalGroup titleGroup = new HorizontalGroup();
    titleGroup.space(pad32 * 2f);
    OwnLabel gaiaSky = new OwnLabel(Settings.getApplicationTitle(Settings.settings.runtime.openVr), skin, "main-title");
    OwnLabel version = new OwnLabel(Settings.settings.version.version, skin, "main-title");
    version.setColor(skin.getColor("theme"));
    titleGroup.addActor(gaiaSky);
    titleGroup.addActor(version);
    String textStyle = "main-title-s";
    // Start Gaia Sky button
    OwnTextIconButton startButton = new OwnTextIconButton(I18n.txt("gui.welcome.start", Settings.APPLICATION_NAME), skin, "start");
    startButton.setSpace(pad18);
    startButton.setContentAlign(Align.center);
    startButton.align(Align.center);
    startButton.setSize(bw, bh);
    startButton.addListener((event) -> {
        if (event instanceof ChangeEvent) {
            // Check base data is enabled
            gaiaSky();
        }
        return true;
    });
    Table startGroup = new Table(skin);
    OwnLabel startLabel = new OwnLabel(I18n.txt("gui.welcome.start.desc", Settings.APPLICATION_NAME), skin, textStyle);
    startGroup.add(startLabel).top().left().padBottom(pad16).row();
    if (!baseDataPresent) {
        // No basic data, can't start!
        startButton.setDisabled(true);
        OwnLabel noBaseData = new OwnLabel(I18n.txt("gui.welcome.start.nobasedata"), skin, textStyle);
        noBaseData.setColor(ColorUtils.gRedC);
        startGroup.add(noBaseData).bottom().left();
    } else if (numCatalogsAvailable > 0 && numTotalCatalogsEnabled == 0) {
        OwnLabel noCatsSelected = new OwnLabel(I18n.txt("gui.welcome.start.nocatalogs"), skin, textStyle);
        noCatsSelected.setColor(ColorUtils.gRedC);
        startGroup.add(noCatsSelected).bottom().left();
    } else if (numGaiaDRCatalogsEnabled > 1 || numStarCatalogsEnabled == 0) {
        OwnLabel tooManyDR = new OwnLabel(I18n.txt("gui.welcome.start.check"), skin, textStyle);
        tooManyDR.setColor(ColorUtils.gRedC);
        startGroup.add(tooManyDR).bottom().left();
    } else {
        OwnLabel ready = new OwnLabel(I18n.txt("gui.welcome.start.ready"), skin, textStyle);
        ready.setColor(ColorUtils.gGreenC);
        startGroup.add(ready).bottom().left();
    }
    // Dataset manager button
    OwnTextIconButton datasetManagerButton = new OwnTextIconButton(I18n.txt("gui.welcome.dsmanager"), skin, "cloud-download");
    datasetManagerButton.setSpace(pad18);
    datasetManagerButton.setContentAlign(Align.center);
    datasetManagerButton.align(Align.center);
    datasetManagerButton.setSize(bw * 0.8f, bh * 0.8f);
    datasetManagerButton.addListener((event) -> {
        if (event instanceof ChangeEvent) {
            addDatasetManagerWindow(serverDatasets);
        }
        return true;
    });
    Table datasetManagerInfo = new Table(skin);
    OwnLabel downloadLabel = new OwnLabel(I18n.txt("gui.welcome.dsmanager.desc"), skin, textStyle);
    datasetManagerInfo.add(downloadLabel).top().left().padBottom(pad16);
    if (serverDatasets != null && serverDatasets.updatesAvailable) {
        datasetManagerInfo.row();
        OwnLabel updates = new OwnLabel(I18n.txt("gui.welcome.dsmanager.updates", serverDatasets.numUpdates), skin, textStyle);
        updates.setColor(ColorUtils.gYellowC);
        datasetManagerInfo.add(updates).bottom().left();
    } else if (!baseDataPresent) {
        datasetManagerInfo.row();
        OwnLabel getBasedata = new OwnLabel(I18n.txt("gui.welcome.dsmanager.info"), skin, textStyle);
        getBasedata.setColor(ColorUtils.gGreenC);
        datasetManagerInfo.add(getBasedata).bottom().left();
    } else {
        // Number selected
        OwnLabel numCatalogsEnabled = new OwnLabel(I18n.txt("gui.welcome.enabled", numTotalCatalogsEnabled, numCatalogsAvailable), skin, textStyle);
        numCatalogsEnabled.setColor(ColorUtils.gBlueC);
        datasetManagerInfo.row().padBottom(pad16);
        datasetManagerInfo.add(numCatalogsEnabled).left().padBottom(pad18);
    }
    // Selection problems/issues
    Table selectionInfo = new Table(skin);
    if (numCatalogsAvailable == 0) {
        // No catalog files, disable and add notice
        OwnLabel noCatalogs = new OwnLabel(I18n.txt("gui.welcome.catalogsel.nocatalogs"), skin, textStyle);
        noCatalogs.setColor(ColorUtils.aOrangeC);
        selectionInfo.add(noCatalogs);
    } else if (numGaiaDRCatalogsEnabled > 1) {
        OwnLabel tooManyDR = new OwnLabel(I18n.txt("gui.welcome.catalogsel.manydrcatalogs"), skin, textStyle);
        tooManyDR.setColor(ColorUtils.gRedC);
        selectionInfo.add(tooManyDR);
    } else if (numStarCatalogsEnabled > 1) {
        OwnLabel warn2Star = new OwnLabel(I18n.txt("gui.welcome.catalogsel.manystarcatalogs"), skin, textStyle);
        warn2Star.setColor(ColorUtils.aOrangeC);
        selectionInfo.add(warn2Star);
    } else if (numStarCatalogsEnabled == 0) {
        OwnLabel noStarCatalogs = new OwnLabel(I18n.txt("gui.welcome.catalogsel.nostarcatalogs"), skin, textStyle);
        noStarCatalogs.setColor(ColorUtils.aOrangeC);
        selectionInfo.add(noStarCatalogs);
    }
    // Exit button
    OwnTextIconButton quitButton = new OwnTextIconButton(I18n.txt("gui.exit"), skin, "quit");
    quitButton.setSpace(pad16);
    quitButton.align(Align.center);
    quitButton.setSize(bw * 0.5f, bh * 0.6f);
    quitButton.addListener(new ClickListener() {

        public void clicked(InputEvent event, float x, float y) {
            Gdx.app.exit();
        }
    });
    // Title
    center.add(titleGroup).center().padBottom(pad18 * 6f).colspan(2).row();
    // Start button
    center.add(startButton).right().top().padBottom(pad18 * 10f).padRight(pad28 * 2f);
    center.add(startGroup).top().left().padBottom(pad18 * 10f).row();
    // Dataset manager
    center.add(datasetManagerButton).right().top().padBottom(pad32).padRight(pad28 * 2f);
    center.add(datasetManagerInfo).left().top().padBottom(pad32).row();
    center.add(selectionInfo).colspan(2).center().top().padBottom(pad32 * 4f).row();
    // Quit
    center.add(quitButton).center().top().colspan(2);
    // Version line table
    Table topLeft = new VersionLineTable(skin);
    ui.addActor(center);
    ui.addActor(topLeft);
    ui.addActor(popupInterface);
    if (!baseDataPresent) {
        // Open dataset manager if base data is not there
        addDatasetManagerWindow(serverDatasets);
    } else {
        // Check if there is an update for the base data, and show a notice if so
        if (serverDatasets != null && serverDatasets.updatesAvailable) {
            DatasetDesc baseData = serverDatasets.findDataset("default-data");
            if (baseData != null && baseData.myVersion < baseData.serverVersion) {
                // We have a base data update, show notice
                GenericDialog baseDataNotice = new GenericDialog(I18n.txt("gui.basedata.title"), skin, ui) {

                    @Override
                    protected void build() {
                        content.clear();
                        content.pad(pad20, pad28 * 2f, pad20, pad28 * 2f);
                        content.add(new OwnLabel(I18n.txt("gui.basedata.default", baseData.name, I18n.txt("gui.welcome.dsmanager")), skin, "msg-24")).left().colspan(3).padBottom(pad20 * 2f).row();
                        content.add(new OwnLabel(I18n.txt("gui.basedata.version", baseData.myVersion), skin, "header-large")).center().padRight(pad20);
                        content.add(new OwnLabel("->", skin, "main-title-s")).center().padRight(pad20);
                        content.add(new OwnLabel(I18n.txt("gui.basedata.version", baseData.serverVersion), skin, "header-large")).center().padRight(pad20);
                    }

                    @Override
                    protected void accept() {
                    // Nothing
                    }

                    @Override
                    protected void cancel() {
                    // Nothing
                    }

                    @Override
                    public void dispose() {
                    // Nothing
                    }
                };
                baseDataNotice.setAcceptText(I18n.txt("gui.ok"));
                baseDataNotice.buildSuper();
                baseDataNotice.show(ui);
            }
        }
    }
}
Also used : OwnTextIconButton(gaiasky.util.scene2d.OwnTextIconButton) SpriteDrawable(com.badlogic.gdx.scenes.scene2d.utils.SpriteDrawable) Table(com.badlogic.gdx.scenes.scene2d.ui.Table) Sprite(com.badlogic.gdx.graphics.g2d.Sprite) Drawable(com.badlogic.gdx.scenes.scene2d.utils.Drawable) SpriteDrawable(com.badlogic.gdx.scenes.scene2d.utils.SpriteDrawable) Texture(com.badlogic.gdx.graphics.Texture) ChangeEvent(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent) DatasetDesc(gaiasky.util.datadesc.DatasetDesc) HorizontalGroup(com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup) OwnLabel(gaiasky.util.scene2d.OwnLabel) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Example 3 with OwnTextIconButton

use of gaiasky.util.scene2d.OwnTextIconButton in project gaiasky by langurmonkey.

the class LocationLogComponent method refresh.

/**
 * Refreshes the locations list with the current data in the location log manager
 */
private void refresh() {
    locations.clear();
    LinkedList<LocationRecord> locations = LocationLogManager.instance().getLocations();
    for (int i = locations.size() - 1; i >= 0; i--) {
        LocationRecord lr = locations.get(i);
        Table recordTable = new Table(skin);
        // Create location
        Label num = new OwnLabel(Integer.toString(locations.size() - i) + ":", skin, "default-blue");
        num.setWidth(30f);
        Label name = new OwnLabel(TextUtils.capString(lr.name, 14), skin, "default");
        name.addListener(new OwnTextTooltip(lr.name, skin));
        name.setWidth(165f);
        Label time = new OwnLabel("(" + lr.elapsedString() + ")", skin, "default-pink");
        time.addListener(new OwnTextTooltip(I18n.txt("gui.locationlog.visited", lr.entryTime), skin));
        time.setWidth(40f);
        OwnTextIconButton goToLoc = new OwnTextIconButton("", skin, "go-to");
        goToLoc.addListener(new OwnTextTooltip(I18n.txt("gui.locationlog.goto.location", lr.entryTime), skin));
        goToLoc.setSize(30f, 30f);
        goToLoc.addListener((event) -> {
            if (event instanceof ChangeEvent) {
                EventManager.publish(Event.CAMERA_MODE_CMD, goToLoc, CameraManager.CameraMode.FREE_MODE);
                EventManager.publish(Event.CAMERA_POS_CMD, goToLoc, lr.position.valuesd());
                EventManager.publish(Event.CAMERA_DIR_CMD, goToLoc, lr.direction.values());
                EventManager.publish(Event.CAMERA_UP_CMD, goToLoc, lr.up.values());
                EventManager.publish(Event.TIME_CHANGE_CMD, goToLoc, lr.simulationTime);
                return true;
            }
            return false;
        });
        OwnTextIconButton goToObj = new OwnTextIconButton("", skin, "land-on");
        goToObj.addListener(new OwnTextTooltip(I18n.txt("gui.locationlog.goto.object", lr.entryTime), skin));
        goToObj.setSize(30f, 30f);
        goToObj.addListener((event) -> {
            if (event instanceof ChangeEvent) {
                GaiaSky.postRunnable(() -> ((EventScriptingInterface) GaiaSky.instance.scripting()).setCameraFocusInstantAndGo(lr.name, false));
                return true;
            }
            return false;
        });
        recordTable.add(num).left().padRight(pad8);
        recordTable.add(name).left().padRight(pad8);
        recordTable.add(time).left();
        Table mainTable = new Table(skin);
        mainTable.add(recordTable).left().padRight(pad12 * 1.5f);
        mainTable.add(goToLoc).left().padRight(pad8);
        mainTable.add(goToObj).left().padRight(pad8);
        this.locations.addActor(mainTable);
    }
    if (locations.size() == 0) {
        this.locations.addActor(new OwnLabel(I18n.txt("gui.locationlog.empty"), skin));
    }
}
Also used : LocationRecord(gaiasky.util.LocationLogManager.LocationRecord) OwnTextIconButton(gaiasky.util.scene2d.OwnTextIconButton) OwnTextTooltip(gaiasky.util.scene2d.OwnTextTooltip) ChangeEvent(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent) OwnLabel(gaiasky.util.scene2d.OwnLabel) OwnLabel(gaiasky.util.scene2d.OwnLabel)

Example 4 with OwnTextIconButton

use of gaiasky.util.scene2d.OwnTextIconButton in project gaiasky by langurmonkey.

the class LoadingGui method initialize.

@Override
public void initialize(AssetManager assetManager, SpriteBatch sb) {
    interfaces = new Array<>();
    float pad30 = 48f;
    float pad10 = 16f;
    final Settings settings = Settings.settings;
    // User interface
    ScreenViewport vp = new ScreenViewport();
    vp.setUnitsPerPixel(unitsPerPixel);
    ui = new Stage(vp, sb);
    if (vr) {
        vp.update(settings.graphics.backBufferResolution[0], settings.graphics.backBufferResolution[1], true);
    } else {
        vp.update(GaiaSky.instance.graphics.getWidth(), GaiaSky.instance.graphics.getHeight(), true);
    }
    center = new Table(skin);
    if (!vr) {
        Texture tex = new Texture(Gdx.files.internal("img/splash/splash.jpg"));
        Drawable bg = new SpriteDrawable(new Sprite(tex));
        center.setBackground(bg);
    }
    center.setFillParent(true);
    center.center();
    if (hoffset > 0)
        center.padLeft(hoffset);
    else if (hoffset < 0)
        center.padRight(-hoffset);
    HorizontalGroup titleGroup = new HorizontalGroup();
    titleGroup.space(pad30 * 2f);
    OwnLabel gaiaSky = new OwnLabel(Settings.getApplicationTitle(settings.runtime.openVr), skin, "main-title");
    OwnLabel version = new OwnLabel(Settings.settings.version.version, skin, "main-title");
    version.setColor(skin.getColor("theme"));
    titleGroup.addActor(gaiaSky);
    titleGroup.addActor(version);
    // Funny text
    lastFunnyTime = 0;
    i = -1;
    m1 = BigInteger.ZERO;
    m2 = BigInteger.ZERO;
    spin = new OwnLabel("0", skin, "main-title-xs");
    spin.setColor(skin.getColor("theme"));
    center.add(titleGroup).center().padBottom(pad10 * 2f).row();
    center.add(spin).padBottom(pad30).row();
    // Tips
    tipGenerator = new TipGenerator(skin);
    tip = new HorizontalGroup();
    tip.space(pad10);
    bottomMiddle = new Table(skin);
    bottomMiddle.setFillParent(true);
    bottomMiddle.center().bottom();
    bottomMiddle.padLeft(pad30).padBottom(pad10);
    bottomMiddle.add(tip);
    // Version and build
    topLeft = new VersionLineTable(skin);
    // SCREEN MODE BUTTON - TOP RIGHT
    screenMode = new Table(skin);
    screenMode.setFillParent(true);
    screenMode.top().right();
    screenMode.pad(pad10);
    OwnTextIconButton screenModeButton = new OwnTextIconButton("", skin, "screen-mode");
    screenModeButton.addListener(event -> {
        if (event instanceof ChangeEvent) {
            settings.graphics.fullScreen.active = !settings.graphics.fullScreen.active;
            EventManager.publish(Event.SCREEN_MODE_CMD, screenModeButton);
            return true;
        }
        return false;
    });
    screenMode.add(screenModeButton);
    // MESSAGE INTERFACE - BOTTOM
    notificationsInterface = new NotificationsInterface(skin, lock, false, false, false);
    center.add(notificationsInterface);
    interfaces.add(notificationsInterface);
    rebuildGui();
}
Also used : OwnTextIconButton(gaiasky.util.scene2d.OwnTextIconButton) SpriteDrawable(com.badlogic.gdx.scenes.scene2d.utils.SpriteDrawable) Table(com.badlogic.gdx.scenes.scene2d.ui.Table) Sprite(com.badlogic.gdx.graphics.g2d.Sprite) Drawable(com.badlogic.gdx.scenes.scene2d.utils.Drawable) SpriteDrawable(com.badlogic.gdx.scenes.scene2d.utils.SpriteDrawable) ScreenViewport(com.badlogic.gdx.utils.viewport.ScreenViewport) Texture(com.badlogic.gdx.graphics.Texture) ChangeEvent(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent) Stage(com.badlogic.gdx.scenes.scene2d.Stage) HorizontalGroup(com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup) OwnLabel(gaiasky.util.scene2d.OwnLabel) TipGenerator(gaiasky.util.TipGenerator) Settings(gaiasky.util.Settings)

Aggregations

ChangeEvent (com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent)4 OwnTextIconButton (gaiasky.util.scene2d.OwnTextIconButton)4 OwnLabel (gaiasky.util.scene2d.OwnLabel)3 Texture (com.badlogic.gdx.graphics.Texture)2 Sprite (com.badlogic.gdx.graphics.g2d.Sprite)2 HorizontalGroup (com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup)2 Table (com.badlogic.gdx.scenes.scene2d.ui.Table)2 Drawable (com.badlogic.gdx.scenes.scene2d.utils.Drawable)2 SpriteDrawable (com.badlogic.gdx.scenes.scene2d.utils.SpriteDrawable)2 OwnTextTooltip (gaiasky.util.scene2d.OwnTextTooltip)2 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)1 Stage (com.badlogic.gdx.scenes.scene2d.Stage)1 VerticalGroup (com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup)1 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)1 ScreenViewport (com.badlogic.gdx.utils.viewport.ScreenViewport)1 EventManager (gaiasky.event.EventManager)1 LocationRecord (gaiasky.util.LocationLogManager.LocationRecord)1 Settings (gaiasky.util.Settings)1 TipGenerator (gaiasky.util.TipGenerator)1 DatasetDesc (gaiasky.util.datadesc.DatasetDesc)1