int y = screenPadding;
String label;
// Button for open the game menu
label = FontHelper.firstToUpper(I18n.get("global.game_menu"));
TextButton gameMenuButton = new TextButton(label, x, y);
gameMenuButton.setSize(buttonWidth, buttonHeight);
gameMenuButton.setActionHandler(new ActionHandler() {
@Override
public void run() {
toggleGameMenu();
}
});
add(gameMenuButton);
// Load button
y += vPadding;
label = FontHelper.firstToUpper(I18n.get("global.load"));
Button loadButton = new TextButton(label, x, y);
loadButton.setSize(buttonWidth, buttonHeight);
loadButton.disable();
loadButton.hide();
loadButton.setActionHandler(new ActionHandler() {
@Override
public void run() {
// TODO
}
});
gameMenuButtons.add(loadButton);
add(loadButton);
// Save button
y += vPadding;
label = FontHelper.firstToUpper(I18n.get("global.save"));
Button saveButton = new TextButton(label, x, y);
saveButton.hide();
saveButton.setSize(buttonWidth, buttonHeight);
saveButton.disable();
saveButton.setActionHandler(new ActionHandler() {
@Override
public void run() {
// TODO
}
});
gameMenuButtons.add(saveButton);
add(saveButton);
// Settings button
y += vPadding;
label = FontHelper.firstToUpper(I18n.get("global.settings"));
Button settingsButton = new TextButton(label, x, y);
settingsButton.setSize(buttonWidth, buttonHeight);
settingsButton.disable();
settingsButton.hide();
settingsButton.setActionHandler(new ActionHandler() {
@Override
public void run() {
// TODO
}
});
gameMenuButtons.add(settingsButton);
add(settingsButton);
// Main menu button
y += vPadding;
label = FontHelper.firstToUpper(I18n.get("global.main_menu"));
Button mainMenu = new TextButton(label, x, y);
mainMenu.setSize(buttonWidth, buttonHeight);
mainMenu.hide();
mainMenu.setActionHandler(new ActionHandler() {
@Override
public void run() {
GameData.getGame().enterState(AloneInSpace.MAIN_MENU_STATE);
}
});
gameMenuButtons.add(mainMenu);
add(mainMenu);
// Exit button
y += vPadding;
label = FontHelper.firstToUpper(I18n.get("global.exit"));
Button exitButton = new TextButton(label, x, y);
exitButton.setSize(buttonWidth, buttonHeight);
exitButton.hide();
exitButton.setActionHandler(new ActionHandler() {
@Override
public void run() {
GameData.getGameContainer().exit();
}