Added control menu to title screen. Pressing control button will open a pop-up window showing game controls.

This commit is contained in:
zwu18
2017-08-15 21:26:23 +12:00
parent ab9aeeb58f
commit 5e0bcd2af5
4 changed files with 38 additions and 0 deletions
@@ -8,6 +8,7 @@ import javafx.scene.control.Button;
import javafx.scene.control.RadioButton;
import javafx.scene.image.Image;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Modality;
import javafx.stage.Stage;
import visualiser.app.App;
@@ -82,4 +83,25 @@ public class TitleController extends Controller {
public void initialize(URL location, ResourceBundle resources) {
}
/**
* Called when control button is pressed. New pop up window displaying controls
*/
public void controlBtnPressed(){
FXMLLoader loader = new FXMLLoader();
loader.setLocation(getClass().getResource("/visualiser/scenes/controls.fxml"));
Parent layout;
try {
layout = loader.load();
Scene scene = new Scene(layout);
Stage popupStage = new Stage();
popupStage.setTitle("Game Controls");
popupStage.initModality(Modality.WINDOW_MODAL);
popupStage.setScene(scene);
popupStage.showAndWait();
} catch (Exception e){
e.printStackTrace();
}
}
}