Search in sources :

Example 1 with SelectBox

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

the class PreviewPane method refresh.

/**
	 * 
	 */
public void refresh() {
    Gdx.app.log("PreviewPane", "Refresh pane!");
    clear();
    ImageButton button = (ImageButton) game.screenMain.barWidgets.group.getChecked();
    String widget = button.getUserObject().toString();
    String widgetStyle = "com.badlogic.gdx.scenes.scene2d.ui." + widget + "$" + widget + "Style";
    try {
        Class<?> style = Class.forName(widgetStyle);
        ObjectMap<String, ?> styles = game.skinProject.getAll(style);
        if (styles == null) {
            Label label = new Label("No styles defined for this widget type", game.skin, "error");
            add(label).row().pad(10);
        } else {
            Keys<String> keys = styles.keys();
            Array<String> sortedKeys = new Array<String>();
            for (String key : keys) {
                sortedKeys.add(key);
            }
            sortedKeys.sort();
            for (String key : sortedKeys) {
                // We render one per key
                add(new Label(key, game.skin, "title")).left().pad(10).expandX().row();
                try {
                    if (widget.equals("Label")) {
                        Label w = new Label("This is a Label widget", game.skinProject, key);
                        add(w).pad(10).padBottom(20).row();
                    } else if (widget.equals("Button")) {
                        // Button
                        Button w = new Button(game.skinProject, key);
                        add(w).width(120).height(32).pad(10).padBottom(20).row();
                    } else if (widget.equals("TextButton")) {
                        // TextButton
                        TextButton w = new TextButton("This is a TextButton widget", game.skinProject, key);
                        add(w).pad(10).padBottom(20).row();
                    } else if (widget.equals("ImageButton")) {
                        // ImageButton
                        ImageButton w = new ImageButton(game.skinProject, key);
                        add(w).pad(10).padBottom(20).row();
                    } else if (widget.equals("CheckBox")) {
                        // CheckBox
                        CheckBox w = new CheckBox("This is a CheckBox widget", game.skinProject, key);
                        w.setChecked(true);
                        add(w).pad(10).padBottom(20).row();
                    } else if (widget.equals("TextField")) {
                        // TextField
                        TextField w = new TextField("This is a TextField widget", game.skinProject, key);
                        if (w.getStyle().fontColor == null) {
                            throw new Exception("Textfield style requires a font color!");
                        }
                        w.addListener(stopTouchDown);
                        add(w).pad(10).width(220).padBottom(20).row();
                    } else if (widget.equals("List")) {
                        // List
                        List w = new List(game.skinProject, key);
                        Array<String> items = new Array<String>();
                        items.add("This is");
                        items.add("a");
                        items.add("List widget!");
                        w.setItems(items);
                        add(w).pad(10).width(220).height(120).padBottom(20).expandX().fillX().row();
                    } else if (widget.equals("SelectBox")) {
                        // SelectBox
                        SelectBox<String> w = new SelectBox<String>(game.skinProject, key);
                        Array<String> items = new Array<String>();
                        items.add("This is");
                        items.add("a");
                        items.add("SelectBox widget!");
                        w.setItems(items);
                        add(w).pad(10).width(220).padBottom(20).expandX().fillX().row();
                    } else if (widget.equals("ProgressBar")) {
                        // ProgressBar
                        ProgressBarStyle progressStyle = game.skinProject.get(key, ProgressBarStyle.class);
                        // Check for edge-case: fields knob and knobBefore are optional but at least one should be specified
                        if (progressStyle.knob == null && progressStyle.knobBefore == null) {
                            throw new IllegalArgumentException("Fields 'knob' and 'knobBefore' in ProgressBarStyle are both optional but at least one should be specified");
                        }
                        ProgressBar w = new ProgressBar(0, 100, 5, false, progressStyle);
                        w.setValue(50);
                        w.addListener(stopTouchDown);
                        add(w).pad(10).width(220).padBottom(20).expandX().fillX().row();
                    } else if (widget.equals("Slider")) {
                        // Slider
                        Slider w = new Slider(0, 100, 5, false, game.skinProject, key);
                        add(w).pad(10).width(220).padBottom(20).expandX().fillX().row();
                        w.addListener(stopTouchDown);
                        Slider w2 = new Slider(0, 100, 5, true, game.skinProject, key);
                        add(w2).pad(10).padBottom(20).expandX().fillX().row();
                        w2.addListener(stopTouchDown);
                    } else if (widget.equals("ScrollPane")) {
                        // ScrollPane
                        Table t = new Table(game.skin);
                        for (int i = 0; i < 20; i++) {
                            t.add("This is a ScrollPane Widget").padRight(10);
                            t.add("This is a ScrollPane Widget").padRight(10);
                            t.add("This is a ScrollPane Widget").row();
                        }
                        ScrollPane w = new ScrollPane(t, game.skinProject, key);
                        w.addListener(stopTouchDown);
                        w.setFlickScroll(true);
                        w.setScrollbarsOnTop(true);
                        w.setScrollBarPositions(true, true);
                        w.setFadeScrollBars(false);
                        add(w).pad(10).width(420).height(240).padBottom(20).expandX().fillX().row();
                    } else if (widget.equals("SplitPane")) {
                        for (int j = 0; j < 2; j++) {
                            Table t = new Table(game.skin);
                            t.setBackground(game.skin.getDrawable("default-rect"));
                            Table t2 = new Table(game.skin);
                            t2.setBackground(game.skin.getDrawable("default-rect"));
                            for (int i = 0; i < 20; i++) {
                                t.add("This is a SplitPane Widget").pad(10).row();
                                t2.add("This is a SplitPane Widget").pad(10).row();
                            }
                            SplitPane w = new SplitPane(t, t2, (j % 2 == 0), game.skinProject, key);
                            w.addListener(stopTouchDown);
                            add(w).pad(10).width(220).height(160).padBottom(20).expandX().fillX();
                        }
                        row();
                    } else if (widget.equals("Window")) {
                        // Window
                        Table t = new Table(game.skin);
                        for (int i = 0; i < 5; i++) {
                            t.add("This is a Window Widget").row();
                        }
                        Window w = new Window("This is a Window Widget", game.skinProject, key);
                        w.addListener(stopTouchDown);
                        w.add(t);
                        add(w).pad(10).width(420).height(240).padBottom(20).expandX().fillX().row();
                    } else if (widget.equals("Touchpad")) {
                        // Touchpad
                        Touchpad w = new Touchpad(0, game.skinProject, key);
                        w.addListener(stopTouchDown);
                        add(w).pad(10).width(200).height(200).padBottom(20).expandX().fillX().row();
                    } else if (widget.equals("Tree")) {
                        // Tree
                        Tree w = new Tree(game.skinProject, key);
                        Tree.Node node = new Tree.Node(new Label("This", game.skin));
                        Tree.Node node1 = new Tree.Node(new Label("is", game.skin));
                        Tree.Node node2 = new Tree.Node(new Label("a", game.skin));
                        Tree.Node node3 = new Tree.Node(new Label("Tree", game.skin));
                        Tree.Node node4 = new Tree.Node(new Label("Widget", game.skin));
                        node3.add(node4);
                        node2.add(node3);
                        node1.add(node2);
                        node.add(node1);
                        w.add(node);
                        w.expandAll();
                        add(w).pad(10).width(200).height(200).padBottom(20).expandX().fillX().row();
                    } else {
                        add(new Label("Unknown widget type!", game.skin, "error")).pad(10).padBottom(20).row();
                    }
                } catch (Exception e) {
                    add(new Label("Please fill all required fields", game.skin, "error")).pad(10).padBottom(20).row();
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : Slider(com.badlogic.gdx.scenes.scene2d.ui.Slider) Node(com.badlogic.gdx.graphics.g3d.model.Node) Label(com.badlogic.gdx.scenes.scene2d.ui.Label) SplitPane(com.badlogic.gdx.scenes.scene2d.ui.SplitPane) ImageButton(com.badlogic.gdx.scenes.scene2d.ui.ImageButton) ProgressBarStyle(com.badlogic.gdx.scenes.scene2d.ui.ProgressBar.ProgressBarStyle) TextButton(com.badlogic.gdx.scenes.scene2d.ui.TextButton) Button(com.badlogic.gdx.scenes.scene2d.ui.Button) ImageButton(com.badlogic.gdx.scenes.scene2d.ui.ImageButton) Touchpad(com.badlogic.gdx.scenes.scene2d.ui.Touchpad) TextField(com.badlogic.gdx.scenes.scene2d.ui.TextField) Tree(com.badlogic.gdx.scenes.scene2d.ui.Tree) List(com.badlogic.gdx.scenes.scene2d.ui.List) ProgressBar(com.badlogic.gdx.scenes.scene2d.ui.ProgressBar) TextButton(com.badlogic.gdx.scenes.scene2d.ui.TextButton) Window(com.badlogic.gdx.scenes.scene2d.ui.Window) Table(com.badlogic.gdx.scenes.scene2d.ui.Table) SelectBox(com.badlogic.gdx.scenes.scene2d.ui.SelectBox) Array(com.badlogic.gdx.utils.Array) CheckBox(com.badlogic.gdx.scenes.scene2d.ui.CheckBox) ScrollPane(com.badlogic.gdx.scenes.scene2d.ui.ScrollPane)

Example 2 with SelectBox

use of com.badlogic.gdx.scenes.scene2d.ui.SelectBox in project libgdx by libgdx.

the class ProjectiveTextureTest method setupUI.

public void setupUI() {
    ui = new Stage();
    skin = new Skin(Gdx.files.internal("data/uiskin.json"));
    TextButton reload = new TextButton("Reload Shaders", skin.get(TextButtonStyle.class));
    camera = new SelectBox(skin.get(SelectBoxStyle.class));
    camera.setItems("Camera", "Light");
    fps = new Label("fps: ", skin.get(LabelStyle.class));
    Table table = new Table();
    table.setFillParent(true);
    table.top().padTop(15);
    table.add(reload).spaceRight(5);
    table.add(camera).spaceRight(5);
    table.add(fps);
    ui.addActor(table);
    reload.addListener(new ClickListener() {

        public void clicked(InputEvent event, float x, float y) {
            ShaderProgram prog = new ShaderProgram(Gdx.files.internal("data/shaders/projtex-vert.glsl").readString(), Gdx.files.internal("data/shaders/projtex-frag.glsl").readString());
            if (prog.isCompiled() == false) {
                Gdx.app.log("GLSL ERROR", "Couldn't reload shaders:\n" + prog.getLog());
            } else {
                projTexShader.dispose();
                projTexShader = prog;
            }
        }
    });
}
Also used : TextButton(com.badlogic.gdx.scenes.scene2d.ui.TextButton) Table(com.badlogic.gdx.scenes.scene2d.ui.Table) ShaderProgram(com.badlogic.gdx.graphics.glutils.ShaderProgram) SelectBox(com.badlogic.gdx.scenes.scene2d.ui.SelectBox) Label(com.badlogic.gdx.scenes.scene2d.ui.Label) Stage(com.badlogic.gdx.scenes.scene2d.Stage) TextButtonStyle(com.badlogic.gdx.scenes.scene2d.ui.TextButton.TextButtonStyle) Skin(com.badlogic.gdx.scenes.scene2d.ui.Skin) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Example 3 with SelectBox

use of com.badlogic.gdx.scenes.scene2d.ui.SelectBox in project libgdx by libgdx.

the class UITest method create.

@Override
public void create() {
    skin = new Skin(Gdx.files.internal("data/uiskin.json"));
    texture1 = new Texture(Gdx.files.internal("data/badlogicsmall.jpg"));
    texture2 = new Texture(Gdx.files.internal("data/badlogic.jpg"));
    TextureRegion image = new TextureRegion(texture1);
    TextureRegion imageFlipped = new TextureRegion(image);
    imageFlipped.flip(true, true);
    TextureRegion image2 = new TextureRegion(texture2);
    // stage = new Stage(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false, new PolygonSpriteBatch());
    stage = new Stage(new ScreenViewport());
    Gdx.input.setInputProcessor(stage);
    // Group.debug = true;
    ImageButtonStyle style = new ImageButtonStyle(skin.get(ButtonStyle.class));
    style.imageUp = new TextureRegionDrawable(image);
    style.imageDown = new TextureRegionDrawable(imageFlipped);
    ImageButton iconButton = new ImageButton(style);
    Button buttonMulti = new TextButton("Multi\nLine\nToggle", skin, "toggle");
    Button imgButton = new Button(new Image(image), skin);
    Button imgToggleButton = new Button(new Image(image), skin, "toggle");
    Label myLabel = new Label("this is some text.", skin);
    myLabel.setWrap(true);
    Table t = new Table();
    t.row();
    t.add(myLabel);
    t.layout();
    final CheckBox checkBox = new CheckBox(" Continuous rendering", skin);
    checkBox.setChecked(true);
    final Slider slider = new Slider(0, 10, 1, false, skin);
    slider.setAnimateDuration(0.3f);
    TextField textfield = new TextField("", skin);
    textfield.setMessageText("Click here!");
    textfield.setAlignment(Align.center);
    final SelectBox selectBox = new SelectBox(skin);
    selectBox.addListener(new ChangeListener() {

        public void changed(ChangeEvent event, Actor actor) {
            System.out.println(selectBox.getSelected());
        }
    });
    selectBox.setItems("Android1", "Windows1 long text in item", "Linux1", "OSX1", "Android2", "Windows2", "Linux2", "OSX2", "Android3", "Windows3", "Linux3", "OSX3", "Android4", "Windows4", "Linux4", "OSX4", "Android5", "Windows5", "Linux5", "OSX5", "Android6", "Windows6", "Linux6", "OSX6", "Android7", "Windows7", "Linux7", "OSX7");
    selectBox.setSelected("Linux6");
    Image imageActor = new Image(image2);
    ScrollPane scrollPane = new ScrollPane(imageActor);
    List list = new List(skin);
    list.setItems(listEntries);
    list.getSelection().setMultiple(true);
    list.getSelection().setRequired(false);
    // list.getSelection().setToggle(true);
    ScrollPane scrollPane2 = new ScrollPane(list, skin);
    scrollPane2.setFlickScroll(false);
    SplitPane splitPane = new SplitPane(scrollPane, scrollPane2, false, skin, "default-horizontal");
    fpsLabel = new Label("fps:", skin);
    // configures an example of a TextField in password mode.
    final Label passwordLabel = new Label("Textfield in password mode: ", skin);
    final TextField passwordTextField = new TextField("", skin);
    passwordTextField.setMessageText("password");
    passwordTextField.setPasswordCharacter('*');
    passwordTextField.setPasswordMode(true);
    buttonMulti.addListener(new TextTooltip("This is a tooltip! This is a tooltip! This is a tooltip! This is a tooltip! This is a tooltip! This is a tooltip!", skin));
    Table tooltipTable = new Table(skin);
    tooltipTable.pad(10).background("default-round");
    tooltipTable.add(new TextButton("Fancy tooltip!", skin));
    imgButton.addListener(new Tooltip(tooltipTable));
    // window.debug();
    Window window = new Window("Dialog", skin);
    window.getTitleTable().add(new TextButton("X", skin)).height(window.getPadTop());
    window.setPosition(0, 0);
    window.defaults().spaceBottom(10);
    window.row().fill().expandX();
    window.add(iconButton);
    window.add(buttonMulti);
    window.add(imgButton);
    window.add(imgToggleButton);
    window.row();
    window.add(checkBox);
    window.add(slider).minWidth(100).fillX().colspan(3);
    window.row();
    window.add(selectBox).maxWidth(100);
    window.add(textfield).minWidth(100).expandX().fillX().colspan(3);
    window.row();
    window.add(splitPane).fill().expand().colspan(4).maxHeight(200);
    window.row();
    window.add(passwordLabel).colspan(2);
    window.add(passwordTextField).minWidth(100).expandX().fillX().colspan(2);
    window.row();
    window.add(fpsLabel).colspan(4);
    window.pack();
    // stage.addActor(new Button("Behind Window", skin));
    stage.addActor(window);
    textfield.setTextFieldListener(new TextFieldListener() {

        public void keyTyped(TextField textField, char key) {
            if (key == '\n')
                textField.getOnscreenKeyboard().show(false);
        }
    });
    slider.addListener(new ChangeListener() {

        public void changed(ChangeEvent event, Actor actor) {
            Gdx.app.log("UITest", "slider: " + slider.getValue());
        }
    });
    iconButton.addListener(new ChangeListener() {

        public void changed(ChangeEvent event, Actor actor) {
            new Dialog("Some Dialog", skin, "dialog") {

                protected void result(Object object) {
                    System.out.println("Chosen: " + object);
                }
            }.text("Are you enjoying this demo?").button("Yes", true).button("No", false).key(Keys.ENTER, true).key(Keys.ESCAPE, false).show(stage);
        }
    });
    checkBox.addListener(new ChangeListener() {

        public void changed(ChangeEvent event, Actor actor) {
            Gdx.graphics.setContinuousRendering(checkBox.isChecked());
        }
    });
}
Also used : Slider(com.badlogic.gdx.scenes.scene2d.ui.Slider) Label(com.badlogic.gdx.scenes.scene2d.ui.Label) TextureRegionDrawable(com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable) SplitPane(com.badlogic.gdx.scenes.scene2d.ui.SplitPane) Image(com.badlogic.gdx.scenes.scene2d.ui.Image) Texture(com.badlogic.gdx.graphics.Texture) TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) ImageButton(com.badlogic.gdx.scenes.scene2d.ui.ImageButton) TextTooltip(com.badlogic.gdx.scenes.scene2d.ui.TextTooltip) TextButton(com.badlogic.gdx.scenes.scene2d.ui.TextButton) Button(com.badlogic.gdx.scenes.scene2d.ui.Button) ImageButton(com.badlogic.gdx.scenes.scene2d.ui.ImageButton) Dialog(com.badlogic.gdx.scenes.scene2d.ui.Dialog) Actor(com.badlogic.gdx.scenes.scene2d.Actor) Stage(com.badlogic.gdx.scenes.scene2d.Stage) TextField(com.badlogic.gdx.scenes.scene2d.ui.TextField) ImageButtonStyle(com.badlogic.gdx.scenes.scene2d.ui.ImageButton.ImageButtonStyle) ChangeListener(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener) List(com.badlogic.gdx.scenes.scene2d.ui.List) TextFieldListener(com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldListener) ImageButtonStyle(com.badlogic.gdx.scenes.scene2d.ui.ImageButton.ImageButtonStyle) ButtonStyle(com.badlogic.gdx.scenes.scene2d.ui.Button.ButtonStyle) TextButton(com.badlogic.gdx.scenes.scene2d.ui.TextButton) Window(com.badlogic.gdx.scenes.scene2d.ui.Window) Table(com.badlogic.gdx.scenes.scene2d.ui.Table) SelectBox(com.badlogic.gdx.scenes.scene2d.ui.SelectBox) TextTooltip(com.badlogic.gdx.scenes.scene2d.ui.TextTooltip) Tooltip(com.badlogic.gdx.scenes.scene2d.ui.Tooltip) ScreenViewport(com.badlogic.gdx.utils.viewport.ScreenViewport) CheckBox(com.badlogic.gdx.scenes.scene2d.ui.CheckBox) ScrollPane(com.badlogic.gdx.scenes.scene2d.ui.ScrollPane) Skin(com.badlogic.gdx.scenes.scene2d.ui.Skin)

Example 4 with SelectBox

use of com.badlogic.gdx.scenes.scene2d.ui.SelectBox in project libgdx by libgdx.

the class NoncontinuousRenderingTest method populateTable.

private void populateTable() {
    Table root = new Table();
    stage.addActor(root);
    root.setFillParent(true);
    root.pad(5);
    root.defaults().left().space(5);
    Button button0 = new TextButton("Toggle continuous rendering", skin, "toggle");
    button0.addListener(new ChangeListener() {

        public void changed(ChangeEvent event, Actor actor) {
            boolean continuous = Gdx.graphics.isContinuousRendering();
            Gdx.graphics.setContinuousRendering(!continuous);
        }
    });
    root.add(button0).row();
    final String str1 = "2s sleep -> Application.postRunnable()";
    Button button1 = new TextButton(str1, skin);
    button1.addListener(new ChangeListener() {

        public void changed(ChangeEvent event, Actor actor) {
            new Thread(new Runnable() {

                public void run() {
                    try {
                        Thread.sleep(2000);
                    } catch (InterruptedException ignored) {
                    }
                    nextColor();
                    Gdx.app.postRunnable(new Runnable() {

                        public void run() {
                            Gdx.app.log(str1, "Posted runnable to Gdx.app");
                        }
                    });
                }
            }).start();
        }
    });
    root.add(button1).row();
    final String str2 = "2s sleep -> Graphics.requestRendering()";
    Button button2 = new TextButton(str2, skin);
    button2.addListener(new ChangeListener() {

        public void changed(ChangeEvent event, Actor actor) {
            // caching necessary to ensure call on this window
            final Graphics graphics = Gdx.graphics;
            new Thread(new Runnable() {

                public void run() {
                    try {
                        Thread.sleep(2000);
                    } catch (InterruptedException ignored) {
                    }
                    nextColor();
                    graphics.requestRendering();
                    Gdx.app.log(str2, "Called Gdx.graphics.requestRendering()");
                }
            }).start();
        }
    });
    root.add(button2).row();
    final String str3 = "2s Timer -> Application.postRunnable()";
    Button button3 = new TextButton(str3, skin);
    button3.addListener(new ChangeListener() {

        public void changed(ChangeEvent event, Actor actor) {
            Timer.schedule(new Task() {

                public void run() {
                    nextColor();
                    Gdx.app.postRunnable(new Runnable() {

                        public void run() {
                            Gdx.app.log(str3, "Posted runnable to Gdx.app");
                        }
                    });
                }
            }, 2f);
        }
    });
    root.add(button3).row();
    final String str4 = "2s DelayAction";
    Button button4 = new TextButton(str4, skin);
    button4.addListener(new ChangeListener() {

        public void changed(ChangeEvent event, Actor actor) {
            stage.addAction(Actions.sequence(Actions.delay(2), Actions.run(new Runnable() {

                public void run() {
                    nextColor();
                    Gdx.app.log(str4, "RunnableAction executed");
                }
            })));
        }
    });
    root.add(button4).row();
    final String str5 = "(2s sleep -> toggle continuous) 2X";
    Button button5 = new TextButton(str5, skin);
    button5.addListener(new ChangeListener() {

        public void changed(ChangeEvent event, Actor actor) {
            // caching necessary to ensure call on this window
            final Graphics graphics = Gdx.graphics;
            new Thread(new Runnable() {

                public void run() {
                    for (int i = 0; i < 2; i++) {
                        try {
                            Thread.sleep(2000);
                        } catch (InterruptedException ignored) {
                        }
                        nextColor();
                        boolean continuous = graphics.isContinuousRendering();
                        graphics.setContinuousRendering(!continuous);
                        Gdx.app.log(str5, "Toggled continuous");
                    }
                }
            }).start();
        }
    });
    root.add(button5).row();
    final CheckBox actionsRequestRendering = new CheckBox("ActionsRequestRendering", skin);
    actionsRequestRendering.setChecked(true);
    actionsRequestRendering.addListener(new ChangeListener() {

        public void changed(ChangeEvent event, Actor actor) {
            stage.setActionsRequestRendering(actionsRequestRendering.isChecked());
        }
    });
    root.add(actionsRequestRendering).row();
    Drawable knobDown = skin.newDrawable("default-slider-knob", Color.GRAY);
    SliderStyle sliderStyle = skin.get("default-horizontal", SliderStyle.class);
    sliderStyle.knobDown = knobDown;
    Slider slider = new Slider(0, 100, 1, false, sliderStyle);
    root.add(slider).row();
    SelectBox<Pixmap.Format> selectBox = new SelectBox(skin);
    selectBox.setItems(Pixmap.Format.values());
    root.add(selectBox).row();
    root.add();
    root.add().grow();
}
Also used : TextButton(com.badlogic.gdx.scenes.scene2d.ui.TextButton) Task(com.badlogic.gdx.utils.Timer.Task) Table(com.badlogic.gdx.scenes.scene2d.ui.Table) Slider(com.badlogic.gdx.scenes.scene2d.ui.Slider) SelectBox(com.badlogic.gdx.scenes.scene2d.ui.SelectBox) Drawable(com.badlogic.gdx.scenes.scene2d.utils.Drawable) Graphics(com.badlogic.gdx.Graphics) TextButton(com.badlogic.gdx.scenes.scene2d.ui.TextButton) Button(com.badlogic.gdx.scenes.scene2d.ui.Button) CheckBox(com.badlogic.gdx.scenes.scene2d.ui.CheckBox) Actor(com.badlogic.gdx.scenes.scene2d.Actor) ChangeListener(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener) SliderStyle(com.badlogic.gdx.scenes.scene2d.ui.Slider.SliderStyle)

Example 5 with SelectBox

use of com.badlogic.gdx.scenes.scene2d.ui.SelectBox in project libgdx by libgdx.

the class MipMapTest method createUI.

private void createUI() {
    skin = new Skin(Gdx.files.internal("data/uiskin.json"));
    ui = new Stage();
    String[] filters = new String[TextureFilter.values().length];
    int idx = 0;
    for (TextureFilter filter : TextureFilter.values()) {
        filters[idx++] = filter.toString();
    }
    hwMipMap = new CheckBox("Hardware Mips", skin);
    minFilter = new SelectBox(skin);
    minFilter.setItems(filters);
    magFilter = new SelectBox(skin.get(SelectBoxStyle.class));
    magFilter.setItems("Nearest", "Linear");
    Table table = new Table();
    table.setSize(ui.getWidth(), 30);
    table.setY(ui.getHeight() - 30);
    table.add(hwMipMap).spaceRight(5);
    table.add(new Label("Min Filter", skin)).spaceRight(5);
    table.add(minFilter).spaceRight(5);
    table.add(new Label("Mag Filter", skin)).spaceRight(5);
    table.add(magFilter);
    ui.addActor(table);
}
Also used : Table(com.badlogic.gdx.scenes.scene2d.ui.Table) CheckBox(com.badlogic.gdx.scenes.scene2d.ui.CheckBox) SelectBox(com.badlogic.gdx.scenes.scene2d.ui.SelectBox) Label(com.badlogic.gdx.scenes.scene2d.ui.Label) Stage(com.badlogic.gdx.scenes.scene2d.Stage) Skin(com.badlogic.gdx.scenes.scene2d.ui.Skin) TextureFilter(com.badlogic.gdx.graphics.Texture.TextureFilter)

Aggregations

SelectBox (com.badlogic.gdx.scenes.scene2d.ui.SelectBox)6 Label (com.badlogic.gdx.scenes.scene2d.ui.Label)5 Table (com.badlogic.gdx.scenes.scene2d.ui.Table)5 CheckBox (com.badlogic.gdx.scenes.scene2d.ui.CheckBox)4 TextButton (com.badlogic.gdx.scenes.scene2d.ui.TextButton)4 Actor (com.badlogic.gdx.scenes.scene2d.Actor)3 Stage (com.badlogic.gdx.scenes.scene2d.Stage)3 Button (com.badlogic.gdx.scenes.scene2d.ui.Button)3 ImageButton (com.badlogic.gdx.scenes.scene2d.ui.ImageButton)3 Skin (com.badlogic.gdx.scenes.scene2d.ui.Skin)3 Slider (com.badlogic.gdx.scenes.scene2d.ui.Slider)3 TextField (com.badlogic.gdx.scenes.scene2d.ui.TextField)3 ChangeListener (com.badlogic.gdx.scenes.scene2d.utils.ChangeListener)3 Texture (com.badlogic.gdx.graphics.Texture)2 List (com.badlogic.gdx.scenes.scene2d.ui.List)2 ScrollPane (com.badlogic.gdx.scenes.scene2d.ui.ScrollPane)2 SplitPane (com.badlogic.gdx.scenes.scene2d.ui.SplitPane)2 Window (com.badlogic.gdx.scenes.scene2d.ui.Window)2 Drawable (com.badlogic.gdx.scenes.scene2d.utils.Drawable)2 Graphics (com.badlogic.gdx.Graphics)1