Jump to content
  • Advertisement
Sign in to follow this  

Libgdx: How to leave the dialog visible?

This topic is 668 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

    setBtn.addListener(new ClickListener() {
        public void clicked(InputEvent event, float x, float y) {
            final Dialog dialog = new Dialog("Settings", skin, "dialog") {
                public void result(Object obj) {
                    Preferences prefs = Gdx.app.getPreferences("My Preferences");
                    if (obj.equals(2))
                        muteMusic = true;
                    if (obj.equals(3))
                        muteMusic = false;
                    prefs.putBoolean("music", muteMusic);
            dialog.text("Do you want to play music");
            dialog.button("Yes", 2); //sends "true" as the result
            dialog.button("No", 3); //sends "false" as the result
            dialog.button("Ok", false);
  • I want the ok button to be on an another row but if I do `dialog.row()` like with tables, it won't work, I can't add an empty row
  • I want the dialog to stay visible on the screen until the ok button is touched, only then I want to call `dialog.hide()`
I can't do
    if (obj.equals(false))
    dialog.hide(); // IDE will suggest that i create a local variable called dialog

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!