Skip to content

Instantly share code, notes, and snippets.

@Tom-Ski
Created January 22, 2014 15:11
Show Gist options
  • Save Tom-Ski/8560369 to your computer and use it in GitHub Desktop.
Save Tom-Ski/8560369 to your computer and use it in GitHub Desktop.
Simple Dialog
public static void simpleOkAlert(Stage stage, Skin skin, String title, String text) {
Dialog dialog = new Dialog(title, skin);
dialog.defaults().center();
dialog.setBackground(new TextureRegionDrawable(skin.get("Alert", TextureRegion.class)));
dialog.text(text).padTop(20).align(Align.center);
dialog.getButtonTable().defaults().pad(0).expandX().fillX().width(200);
dialog.button("Ok, Ill stop misbehaving").padBottom(3);
dialog.setWidth(400);
dialog.setHeight(140);
dialog.setPosition(Gdx.graphics.getWidth() / 2 - 400, Gdx.graphics.getHeight() / 2 - 140);
stage.addActor(dialog);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment