Search in sources :

Example 1 with TipGenerator

use of gaiasky.util.TipGenerator 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

Texture (com.badlogic.gdx.graphics.Texture)1 Sprite (com.badlogic.gdx.graphics.g2d.Sprite)1 Stage (com.badlogic.gdx.scenes.scene2d.Stage)1 HorizontalGroup (com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup)1 Table (com.badlogic.gdx.scenes.scene2d.ui.Table)1 ChangeEvent (com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent)1 Drawable (com.badlogic.gdx.scenes.scene2d.utils.Drawable)1 SpriteDrawable (com.badlogic.gdx.scenes.scene2d.utils.SpriteDrawable)1 ScreenViewport (com.badlogic.gdx.utils.viewport.ScreenViewport)1 Settings (gaiasky.util.Settings)1 TipGenerator (gaiasky.util.TipGenerator)1 OwnLabel (gaiasky.util.scene2d.OwnLabel)1 OwnTextIconButton (gaiasky.util.scene2d.OwnTextIconButton)1