Search in sources :

Example 76 with Table

use of com.badlogic.gdx.scenes.scene2d.ui.Table in project gdx-skineditor by cobolfoo.

the class WelcomeScreen method show.

@Override
public void show() {
    Table table = new Table(game.skin);
    table.setFillParent(true);
    table.setBackground(game.skin.getDrawable("dialogDim"));
    stage.addActor(table);
    Table tableContent = new Table(game.skin);
    tableContent.left();
    tableContent.add(new Label("Project List", game.skin, "title")).left().row();
    listProjects = new List<String>(game.skin);
    ScrollPane scrollPane = new ScrollPane(listProjects, game.skin);
    tableContent.add(scrollPane).width(320).height(200).row();
    Table tableButtons = new Table(game.skin);
    TextButton buttonNewProject = new TextButton("New Project", game.skin);
    final TextButton buttonOpen = new TextButton("Open", game.skin);
    final TextButton buttonDelete = new TextButton("Delete", game.skin);
    buttonOpen.setDisabled(true);
    buttonDelete.setDisabled(true);
    tableButtons.add(buttonNewProject).pad(5).expandX().fillX();
    tableButtons.add(buttonOpen).pad(5).width(92);
    tableButtons.add(buttonDelete).pad(5).width(92);
    tableContent.add(tableButtons).expandX().fillX();
    table.add(tableContent);
    Gdx.input.setInputProcessor(stage);
    listProjects.addListener(new ChangeListener() {

        @Override
        public void changed(ChangeEvent event, Actor actor) {
            if (listProjects.getSelected() != null) {
                buttonOpen.setDisabled(false);
                buttonDelete.setDisabled(false);
            } else {
                buttonOpen.setDisabled(true);
                buttonDelete.setDisabled(true);
            }
        }
    });
    buttonNewProject.addListener(new ChangeListener() {

        @Override
        public void changed(ChangeEvent event, Actor actor) {
            showNewProjectDialog();
        }
    });
    buttonOpen.addListener(new ChangeListener() {

        @Override
        public void changed(ChangeEvent event, Actor actor) {
            game.screenMain.setCurrentProject((String) listProjects.getSelected());
            game.setScreen(game.screenMain);
        }
    });
    buttonDelete.addListener(new ChangeListener() {

        @Override
        public void changed(ChangeEvent event, Actor actor) {
            showDeleteDialog();
        }
    });
    refreshProjects();
// NinePatchEditorDialog dlg = new NinePatchEditorDialog(game);
// dlg.show(stage);
}
Also used : TextButton(com.badlogic.gdx.scenes.scene2d.ui.TextButton) Table(com.badlogic.gdx.scenes.scene2d.ui.Table) ScrollPane(com.badlogic.gdx.scenes.scene2d.ui.ScrollPane) Actor(com.badlogic.gdx.scenes.scene2d.Actor) Label(com.badlogic.gdx.scenes.scene2d.ui.Label) ChangeListener(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener)

Example 77 with Table

use of com.badlogic.gdx.scenes.scene2d.ui.Table in project AnotherMonekyParadox by SantiagoMille.

the class PantallaDeveloper method crearMenu.

private void crearMenu() {
    stageMenu = new Stage(vista);
    prefs = Gdx.app.getPreferences("AnotherMonkeyPreferenceStory");
    Skin skin = new Skin(Gdx.files.internal("skin/comic-ui.json"));
    imgBackground = new Texture("pantalla_config.png");
    spriteBackground = new Sprite(imgBackground);
    spriteBackground.setAlpha(0.7f);
    container = new Table();
    stageMenu.addActor(container);
    container.setFillParent(true);
    container.setPosition(0, 30);
    Table table = new Table();
    final ScrollPane scroll = new ScrollPane(table, skin);
    // Boton Return
    TextureRegionDrawable trdReturn = new TextureRegionDrawable(new TextureRegion(new Texture("go-back.png")));
    ImageButton btnReturn = new ImageButton(trdReturn);
    btnReturn.setPosition(ANCHO - 80, ALTO - 30 - btnReturn.getHeight());
    // Click en boton Return
    btnReturn.addListener(new ClickListener() {

        @Override
        public void clicked(InputEvent event, float x, float y) {
            super.clicked(event, x, y);
            prefs.putFloat("Difficulty", difficulty);
            prefs.putFloat("Sensitivity", sensitivity);
            main.setScreen(new PantallaMenu(main));
        }
    });
    InputListener stopTouchDown = new InputListener() {

        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            event.stop();
            difficulty = x;
            return false;
        }
    };
    InputListener stopTouchDown2 = new InputListener() {

        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            event.stop();
            sensitivity = x;
            return false;
        }
    };
    table.pad(10).defaults().expandX().space(4);
    titulo = new Texto(1, 1, 1);
    table.row();
    table.row();
    table.row();
    table.row();
    table.add(new Label("\n\n\n\n\n\n\n\n\n\n\n ", skin));
    table.row();
    table.add(new Label("\n\n\n\n\n\n\n\n\n\n\n ", skin));
    TextButton buttonVolumen = new TextButton("Difficulty", skin);
    table.add(buttonVolumen);
    buttonVolumen.addListener(new ClickListener() {

        public void clicked(InputEvent event, float x, float y) {
            System.out.println("click " + x + ", " + y);
        }
    });
    Slider sliderDif = new Slider(0, 100, 1, false, skin);
    // Stops touchDown events from propagating to the FlickScrollPane.
    sliderDif.addListener(stopTouchDown);
    table.add(sliderDif);
    table.add(new Label("                                                                                                               ", skin));
    table.row();
    table.add(new Label(" ", skin));
    table.row();
    table.add(new Label(" ", skin));
    table.row();
    table.add(new Label("                                                                                             ", skin)).expandX().fillX();
    TextButton buttonSensitivity = new TextButton("Sensitivity", skin);
    table.add(buttonSensitivity);
    buttonSensitivity.addListener(new ClickListener() {

        public void clicked(InputEvent event, float x, float y) {
            System.out.println("click " + x + ", " + y);
        }
    });
    Slider sliderSens = new Slider(0, 100, 1, false, skin);
    // Stops touchDown events from propagating to the FlickScrollPane.
    sliderSens.addListener(stopTouchDown2);
    table.add(sliderSens);
    table.add(new Label("                                                                                                               ", skin));
    final TextButton creditsButton = new TextButton("Creditos", skin.get("default", TextButton.TextButtonStyle.class));
    creditsButton.setChecked(true);
    creditsButton.addListener(new ChangeListener() {

        public void changed(ChangeEvent event, Actor actor) {
            scroll.setFlickScroll(creditsButton.isChecked());
            prefs.putFloat("Difficulty", difficulty);
            prefs.putFloat("Sensitivity", sensitivity);
            main.setScreen(new PantallaCredits(main));
        }
    });
    container.add(scroll).expand().fill().colspan(4);
    container.row().space(10).padBottom(10);
    container.add(new Label("  ", skin));
    table.row();
    table.add(new Label("\n\n\n\n\n\n\n\n\n\n\n ", skin));
    table.row();
    table.add(new Label("\n\n\n\n\n\n\n\n\n\n\n ", skin));
    table.row();
    container.add(creditsButton).left().expandX();
    stageMenu.addActor(btnReturn);
    Gdx.input.setInputProcessor(stageMenu);
    float ddiiff = prefs.getFloat("Difficulty");
    sliderDif.setX(ddiiff);
    sliderSens.setX(prefs.getFloat("Sensitivity"));
}
Also used : TextButton(com.badlogic.gdx.scenes.scene2d.ui.TextButton) Table(com.badlogic.gdx.scenes.scene2d.ui.Table) Sprite(com.badlogic.gdx.graphics.g2d.Sprite) Slider(com.badlogic.gdx.scenes.scene2d.ui.Slider) Label(com.badlogic.gdx.scenes.scene2d.ui.Label) TextureRegionDrawable(com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable) Texture(com.badlogic.gdx.graphics.Texture) TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) ImageButton(com.badlogic.gdx.scenes.scene2d.ui.ImageButton) InputListener(com.badlogic.gdx.scenes.scene2d.InputListener) ScrollPane(com.badlogic.gdx.scenes.scene2d.ui.ScrollPane) Actor(com.badlogic.gdx.scenes.scene2d.Actor) Stage(com.badlogic.gdx.scenes.scene2d.Stage) Skin(com.badlogic.gdx.scenes.scene2d.ui.Skin) ChangeListener(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Example 78 with Table

use of com.badlogic.gdx.scenes.scene2d.ui.Table in project AnotherMonekyParadox by SantiagoMille.

the class PantallaScoresSurvival method crearMenu.

@Override
void crearMenu() {
    super.stageMenu = new Stage(vista);
    title = new Texto(1, 1, 1);
    imgBackground = new Texture("logros.png");
    spriteBackground = new Sprite(imgBackground);
    spriteBackground.setPosition(0, 0);
    spriteBackground.setAlpha(0.7f);
    Skin skin = new Skin(Gdx.files.internal("skin/comic-ui.json"));
    Preferences prefs = Gdx.app.getPreferences("AnotherMonkeyPreferenceSurvival");
    String names = prefs.getString("names", null);
    if (names == null) {
        // prefs.putString("names", "Astro");
        names = "Astro,";
    }
    String scores = prefs.getString("highscores", null);
    if (scores == null) {
        // prefs.putString("highscores", "10000");
        scores = "10000,";
    }
    Table table = new Table(skin);
    table.defaults().pad(10f);
    table.setFillParent(true);
    table.setPosition(table.getX(), table.getY() + 250);
    /**
     * Se hace el titulo de scores
     */
    /**
     * Se crean las columnas con puntuajes
     */
    Label columnName;
    Label columnScore;
    String[] allScores = scores.split(",");
    String[] allNames = names.split(",");
    int i = 0;
    table.row();
    for (String name : allNames) {
        columnName = new Label(name + ": ", skin);
        columnName.setFontScale(3f, 3f);
        table.add(columnName);
        columnScore = new Label(allScores[i], skin);
        columnScore.setFontScale(3f, 3f);
        table.add(columnScore);
        i++;
        table.row();
    }
    // Boton Return
    TextureRegionDrawable trdReturn = new TextureRegionDrawable(new TextureRegion(new Texture("go-back.png")));
    ImageButton btnReturn = new ImageButton(trdReturn);
    btnReturn.setPosition(30, ALTO - 30 - btnReturn.getHeight());
    // Click en boton Return
    btnReturn.addListener(new ClickListener() {

        @Override
        public void clicked(InputEvent event, float x, float y) {
            super.clicked(event, x, y);
            main.setScreen(new PantallaMenu(main));
        }
    });
    stageMenu.addActor(table);
    stageMenu.addActor(btnReturn);
    Gdx.input.setInputProcessor(stageMenu);
}
Also used : Table(com.badlogic.gdx.scenes.scene2d.ui.Table) Sprite(com.badlogic.gdx.graphics.g2d.Sprite) Label(com.badlogic.gdx.scenes.scene2d.ui.Label) TextureRegionDrawable(com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable) Texture(com.badlogic.gdx.graphics.Texture) TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) ImageButton(com.badlogic.gdx.scenes.scene2d.ui.ImageButton) Stage(com.badlogic.gdx.scenes.scene2d.Stage) Skin(com.badlogic.gdx.scenes.scene2d.ui.Skin) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) Preferences(com.badlogic.gdx.Preferences) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Example 79 with Table

use of com.badlogic.gdx.scenes.scene2d.ui.Table in project Eidolons by IDemiurge.

the class OptionsWindow method open.

public void open(Map<OPTIONS_GROUP, Options> optionsMap, Stage stage) {
    this.optionsMap = optionsMap;
    this.stage = stage;
    setVisible(true);
    clearChildren();
    root = new Table();
    root.setFillParent(true);
    add(root);
    Table content = init();
    root.add(content).expand().fill().row();
    stage.addActor(this);
    root.setPosition(GdxMaster.centerWidth(root), GdxMaster.centerHeight(root));
    centerWindow();
    center();
    fadeIn();
}
Also used : Table(com.badlogic.gdx.scenes.scene2d.ui.Table)

Example 80 with Table

use of com.badlogic.gdx.scenes.scene2d.ui.Table in project Eidolons by IDemiurge.

the class OptionsWindow method init.

private Table init() {
    tabs = new Array<>();
    TabbedPane optionsPane = new TabbedPane();
    // tabs
    add(optionsPane.getTable()).expandX().fillX().row();
    // tab content
    final Table content = new Table();
    optionsPane.addListener(new TabbedPaneAdapter() {

        @Override
        public void switchedTab(Tab tab) {
            content.clear();
            content.add(tab.getContentTable()).expand().top().left();
        }
    });
    for (OPTIONS_GROUP group : optionsMap.keySet()) {
        OptionsTab tab = new OptionsTab(group);
        tabs.add(tab);
        optionsPane.add(tab);
    }
    optionsPane.switchTab(0);
    Table bottomMenu = new Table();
    bottomMenu.defaults().pad(4);
    add(bottomMenu).expandX().left();
    {
        VisTextButton button = new VisTextButton("Ok");
        addClickListener(button, this::ok);
        bottomMenu.add(button);
    }
    {
        VisTextButton button = new VisTextButton("Save");
        addClickListener(button, this::save);
        bottomMenu.add(button);
    }
    {
        VisTextButton button = new VisTextButton("Apply");
        addClickListener(button, this::apply);
        bottomMenu.add(button);
    }
    {
        VisTextButton button = new VisTextButton("Cancel");
        addClickListener(button, this::cancel);
        bottomMenu.add(button);
    }
    {
        VisTextButton button = new VisTextButton("Defaults");
        addClickListener(button, this::toDefaults);
        bottomMenu.add(button);
    }
    return content;
}
Also used : Table(com.badlogic.gdx.scenes.scene2d.ui.Table) Tab(com.kotcrab.vis.ui.widget.tabbedpane.Tab) TabbedPaneAdapter(com.kotcrab.vis.ui.widget.tabbedpane.TabbedPaneAdapter) OPTIONS_GROUP(eidolons.system.options.OptionsMaster.OPTIONS_GROUP) TabbedPane(com.kotcrab.vis.ui.widget.tabbedpane.TabbedPane)

Aggregations

Table (com.badlogic.gdx.scenes.scene2d.ui.Table)85 Label (com.badlogic.gdx.scenes.scene2d.ui.Label)51 Stage (com.badlogic.gdx.scenes.scene2d.Stage)48 Skin (com.badlogic.gdx.scenes.scene2d.ui.Skin)36 TextButton (com.badlogic.gdx.scenes.scene2d.ui.TextButton)35 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)31 Actor (com.badlogic.gdx.scenes.scene2d.Actor)30 ChangeListener (com.badlogic.gdx.scenes.scene2d.utils.ChangeListener)25 ScrollPane (com.badlogic.gdx.scenes.scene2d.ui.ScrollPane)21 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)18 Texture (com.badlogic.gdx.graphics.Texture)17 ScreenViewport (com.badlogic.gdx.utils.viewport.ScreenViewport)16 InputListener (com.badlogic.gdx.scenes.scene2d.InputListener)15 TextField (com.badlogic.gdx.scenes.scene2d.ui.TextField)14 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)13 Image (com.badlogic.gdx.scenes.scene2d.ui.Image)12 ImageButton (com.badlogic.gdx.scenes.scene2d.ui.ImageButton)11 ImageTextButton (com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton)11 CheckBox (com.badlogic.gdx.scenes.scene2d.ui.CheckBox)9 Dialog (com.badlogic.gdx.scenes.scene2d.ui.Dialog)8