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));
}