Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sub-sections for settings panel, added width/height values. #147

Merged
merged 2 commits into from
Feb 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/app/view/mapBuilder/FurniturePane.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void loadButtons(VBox vbox)
Label func = new Label("Create your Map:");
Button create = new Button("Create");
create.setPrefWidth(BUTTON_WIDTH);
create.setOnAction(e -> startMenu.saveSettings()); // TODO add event handling
create.setOnAction(e -> startMenu.saveSettings()); // TODO add event handling!

Button crOpen = new Button("Create & Open");
crOpen.setPrefWidth(BUTTON_WIDTH);
Expand Down
74 changes: 40 additions & 34 deletions src/main/java/app/view/mapBuilder/SettingsPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public class SettingsPane extends StackPane
private Settings s;
private TextField name;
private TextField mode;
private TextField step;
private TextField scale;
private TextField w;
private TextField h;
private TextField noGuards;
private TextField noIntruders;
private TextField bGuard;
Expand Down Expand Up @@ -45,32 +45,36 @@ public SettingsPane(StartMenu startMenu, Settings s)
mapName.setFont(new Font(16));
Label gameMode = new Label("Game Mode:");
gameMode.setFont(new Font(16));
Label timeStep = new Label("Time Step:");
timeStep.setFont(new Font(16));
Label scaling = new Label("Scaling:");
scaling.setFont(new Font(16));
Label noOfGuards = new Label("Number of Guards:");
Label width = new Label("Width:");
width.setFont(new Font(16));
Label height = new Label("Height:");
height.setFont(new Font(16));
Label guard = new Label("Guards:");
guard.setFont(Font.font("", FontWeight.BOLD, 18));
Label noOfGuards = new Label("Number");
noOfGuards.setFont(new Font(16));
Label noOfIntruders = new Label("Number of Intruders:");
noOfIntruders.setFont(new Font(16));
Label baseGuard = new Label("Walk speed Guard:");
Label baseGuard = new Label("Walk Speed");
baseGuard.setFont(new Font(16));
Label baseIntruder = new Label("Walk speed Intruder:");
baseIntruder.setFont(new Font(16));
Label sprintGuard = new Label("Sprint speed Guard:");
Label sprintGuard = new Label("Sprint Speed");
sprintGuard.setFont(new Font(16));
Label sprintIntruder = new Label("Sprint speed Intruder:");
Label intruder = new Label("Intruders:");
intruder.setFont(Font.font("", FontWeight.BOLD, 18));
Label noOfIntruders = new Label("Number");
noOfIntruders.setFont(new Font(16));
Label baseIntruder = new Label("Walk Speed");
baseIntruder.setFont(new Font(16));
Label sprintIntruder = new Label("Sprint Speed");
sprintIntruder.setFont(new Font(16));

// Text Fields with current values editable.
name = new TextField();
name.setText(s.getName());
mode = new TextField();
mode.setText(""+s.getGameMode());
step = new TextField();
step.setText(""+s.getTimeStep());
scale = new TextField();
scale.setText(""+s.getScaling());
w = new TextField();
w.setText(""+s.getWidth());
h = new TextField();
h.setText(""+s.getHeight());
noGuards = new TextField();
noGuards.setText(""+s.getNoOfGuards());
noIntruders = new TextField();
Expand All @@ -89,22 +93,24 @@ public SettingsPane(StartMenu startMenu, Settings s)
grid.add(name, 1, 0);
grid.add(gameMode, 0, 1);
grid.add(mode, 1, 1);
grid.add(timeStep, 0, 2);
grid.add(step, 1, 2);
grid.add(scaling, 0, 3);
grid.add(scale, 1, 3);
grid.add(noOfGuards, 0, 4);
grid.add(noGuards, 1, 4);
grid.add(noOfIntruders, 0, 5);
grid.add(noIntruders, 1, 5);
grid.add(baseGuard, 0, 6);
grid.add(bGuard, 1, 6);
grid.add(baseIntruder, 0, 7);
grid.add(bIntruder, 1, 7);
grid.add(width, 0, 2);
grid.add(w, 1, 2);
grid.add(height, 0, 3);
grid.add(h, 1, 3);
grid.add(guard, 0, 5);
grid.add(noOfGuards, 0, 6);
grid.add(noGuards, 1, 6);
grid.add(baseGuard, 0, 7);
grid.add(bGuard, 1, 7);
grid.add(sprintGuard, 0, 8);
grid.add(sGuard, 1, 8);
grid.add(sprintIntruder, 0, 9);
grid.add(sIntruder, 1, 9);
grid.add(intruder, 0, 10);
grid.add(noOfIntruders, 0, 11);
grid.add(noIntruders, 1, 11);
grid.add(baseIntruder, 0, 12);
grid.add(bIntruder, 1, 12);
grid.add(sprintIntruder, 0, 13);
grid.add(sIntruder, 1, 13);

vbox.getChildren().addAll(header, grid);
this.setMargin(vbox, new Insets(10, 10, 10, 10));
Expand All @@ -115,8 +121,8 @@ public void getSettings()
{
s.setName(name.getText());
s.setGameMode(Integer.parseInt(mode.getText()));
s.setTimeStep(Double.parseDouble(step.getText()));
s.setScaling(Double.parseDouble(scale.getText()));
s.setWidth(Integer.parseInt(w.getText()));
s.setHeight(Integer.parseInt(h.getText()));
s.setNoOfGuards(Integer.parseInt(noGuards.getText()));
s.setNoOfIntruders(Integer.parseInt(noIntruders.getText()));
s.setWalkSpeedGuard(Double.parseDouble(bGuard.getText()));
Expand Down