Table table = new Table(game.getSkin());
table.setFillParent(true);
table.center();
Label title = new Label("JFIGHTER2DX\nSETTINGS", game.getSkin());
title.setFontScale(2.5f);
final CheckBox checkSound = new CheckBox(" SOUND", game.getSkin());
checkSound.setChecked(prefs.getBoolean("sound"));
checkSound.addListener(new ClickListener() {
public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
prefs.putBoolean("sound", checkSound.isChecked());
}
});
Label difficultyLabel = new Label("-- DIFFICULTY --", game.getSkin());
String[] resolutionsArray = {"LOW", "MEDIUM", "HIGH"};
final List difficultyList = new List(resolutionsArray, game.getSkin());
difficultyList.addListener(new ClickListener() {
public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
switch (difficultyList.getSelectedIndex()) {
case 0:
prefs.putString("difficulty", "low");
break;
case 1:
prefs.putString("difficulty", "medium");
break;
case 2:
prefs.putString("difficulty", "high");
break;
default:
}
}
});
TextButton exitButton = new TextButton("MAIN MENU", game.getSkin());
exitButton.addListener(new ClickListener() {
public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
prefs.flush();
dispose();
game.setScreen(new MainMenuScreen(game));
}
});
Label aboutLabel = new Label("jfighter2dx v1\n(c) Santiago Faci\nhttp://bitbucket.org/sfaci/jfighter2dx", game.getSkin());
aboutLabel.setFontScale(1f);
table.row().height(150);
table.add(title).center().pad(35f);
table.row().height(20);
table.add(checkSound).center().pad(5f);