Initial add

This commit is contained in:
Paul Scott
2023-03-13 20:34:59 +11:00
commit b1a8ce7352
37 changed files with 1310 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
package comp1110.ass2;
/*
This is a placeholder for the BlueLagoon class that will be provided in an
update sometime after D2B is complete. This class will contain a set of
static methods that you will need to connect to your game code. These
static methods work as an interface between our tests and your game logic.
IMPORTANT: do not modify this file in any way. Its contents will be
overridden in an update.
*/
public class BlueLagoon {
}

View File

@@ -0,0 +1,22 @@
package comp1110.ass2.gui;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.stage.Stage;
// FIXME Task 14
// FIXME Task 15
public class Game extends Application {
private final Group root = new Group();
private static final int WINDOW_WIDTH = 1200;
private static final int WINDOW_HEIGHT = 700;
@Override
public void start(Stage stage) throws Exception {
Scene scene = new Scene(this.root, WINDOW_WIDTH, WINDOW_HEIGHT);
stage.setScene(scene);
stage.show();
}
}

View File

@@ -0,0 +1,70 @@
package comp1110.ass2.gui;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;
public class Viewer extends Application {
private static final int VIEWER_WIDTH = 1200;
private static final int VIEWER_HEIGHT = 700;
private final Group root = new Group();
private final Group controls = new Group();
private TextField stateTextField;
/**
* Given a state string, draw a representation of the state
* on the screen.
* <p>
* This may prove useful for debugging complex states.
*
* @param stateString a string representing a game state
*/
void displayState(String stateString) {
// FIXME Task 5
}
/**
* Create a basic text field for input and a refresh button.
*/
private void makeControls() {
Label playerLabel = new Label("Game State:");
stateTextField = new TextField();
stateTextField.setPrefWidth(200);
Button button = new Button("Refresh");
button.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
displayState(stateTextField.getText());
}
});
HBox hb = new HBox();
hb.getChildren().addAll(playerLabel, stateTextField, button);
hb.setSpacing(10);
hb.setLayoutX(50);
hb.setLayoutY(VIEWER_HEIGHT - 50);
controls.getChildren().add(hb);
}
@Override
public void start(Stage primaryStage) throws Exception {
primaryStage.setTitle("Blue Lagoon Viewer");
Scene scene = new Scene(root, VIEWER_WIDTH, VIEWER_HEIGHT);
root.getChildren().add(controls);
makeControls();
primaryStage.setScene(scene);
primaryStage.show();
}
}