Search in sources :

Example 1 with TextButtonX

use of eidolons.libgdx.gui.generic.btn.TextButtonX in project Eidolons by IDemiurge.

the class MapTimePanel method init.

public void init() {
    setSize((355), (203));
    speedUpBtn = new TextButtonX("", STD_BUTTON.SPEED_UP, () -> {
        MacroGame.getGame().getLoop().getTimeMaster().speedUp();
    });
    speedDownBtn = new TextButtonX("", STD_BUTTON.SPEED_DOWN, () -> {
        MacroGame.getGame().getLoop().getTimeMaster().speedDown();
    });
    pauseButton = new TextButtonX("", STD_BUTTON.PAUSE, () -> {
        MacroGame.getGame().getLoop().togglePaused();
        MacroGame.getGame().getLoop().getTimeMaster().resetSpeed();
    });
    float moonSize = GdxMaster.adjustSize(SIZE);
    addListener(new DynamicTooltip(() -> getDateString()).getController());
    // display DatePanel?
    for (MOON moon : MOON.values()) {
        MoonActor container = new MoonActor(moon);
        moonMap.put(moon, container);
    }
    float sunSize = moonSize * 2f;
    sun = new SunActor(false);
    sun.setSize(sunSize, sunSize);
    sun.setVisible(false);
    undersun = new SunActor(true);
    undersun.setSize(sunSize, sunSize);
    undersun.setVisible(false);
    timeLabel = new Label("", StyleHolder.getSizedLabelStyle(FONT.NYALA, 18));
    addActor(weave);
    addActor(mainCircle);
    addActor(sun);
    addActor(undersun);
    addActor(labelBg = new Image(TextureCache.getOrCreateR(getPath() + "label bg.png")));
    addActor(pauseButton);
    addActor(speedUpBtn);
    addActor(speedDownBtn);
    addActor(timeLabel);
    initPositions();
    GuiEventManager.bind(MapEvent.TIME_CHANGED, p -> {
        update((DAY_TIME) p.get());
    });
    sun.addListener(new ClickListener() {

        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            MacroGame.getGame().getLoop().getTimeMaster().newMonth();
            return super.touchDown(event, x, y, pointer, button);
        }
    });
    undersun.addListener(new ClickListener() {

        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            MacroGame.getGame().getLoop().getTimeMaster().newMonth();
            return super.touchDown(event, x, y, pointer, button);
        }
    });
// adjustSizes();
}
Also used : TextButtonX(eidolons.libgdx.gui.generic.btn.TextButtonX) MOON(eidolons.libgdx.screens.map.ui.time.MapTimePanel.MOON) DynamicTooltip(eidolons.libgdx.gui.tooltips.DynamicTooltip) Label(com.badlogic.gdx.scenes.scene2d.ui.Label) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) Image(com.badlogic.gdx.scenes.scene2d.ui.Image) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Aggregations

InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)1 Image (com.badlogic.gdx.scenes.scene2d.ui.Image)1 Label (com.badlogic.gdx.scenes.scene2d.ui.Label)1 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)1 TextButtonX (eidolons.libgdx.gui.generic.btn.TextButtonX)1 DynamicTooltip (eidolons.libgdx.gui.tooltips.DynamicTooltip)1 MOON (eidolons.libgdx.screens.map.ui.time.MapTimePanel.MOON)1