Commit d8490ebd authored by Sergio Emanuel Rodriguez Rivera's avatar Sergio Emanuel Rodriguez Rivera
Browse files

Merge remote-tracking branch 'origin/FinalUpdated' into FinalUpdated

# Conflicts:
#	.idea/misc.xml
#	.idea/vcs.xml
#	target/classes/Shape/MovingObject$Deformation.class
#	target/classes/Shape/MovingObject.class
#	target/classes/module-info.class
#	target/classes/org/example/newmat/GraphicsAndWindowsTest$1.class
#	target/classes/org/example/newmat/GraphicsAndWindowsTest.class
#	target/classes/org/example/newmat/MainScene.class
parents 76449c0b ff400a53
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -7,6 +7,9 @@
        <option value="$PROJECT_DIR$/pom.xml" />
      </list>
    </option>
    <option name="workspaceImportForciblyTurnedOn" value="true" />
  </component>
  <component name="ProjectRootManager" version="2" languageLevel="JDK_21" project-jdk-name="22" project-jdk-type="JavaSDK">
    <output url="file://$PROJECT_DIR$/out" />
  </component>
  <component name="ProjectRootManager" version="2" languageLevel="JDK_X" default="true" project-jdk-name="22" project-jdk-type="JavaSDK" />
</project>
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="VcsDirectoryMappings">
    <mapping directory="" vcs="Git" />
    <mapping directory="$PROJECT_DIR$" vcs="Git" />
  </component>
</project>
 No newline at end of file
+1 −3
Original line number Diff line number Diff line
@@ -520,5 +520,3 @@ public class GraphicsAndWindowsTest extends Application {
        Application.launch(args);
    }
}
 No newline at end of file

+48 −7
Original line number Diff line number Diff line
@@ -4,10 +4,14 @@ import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import javafx.stage.FileChooser;

import java.io.File;
import java.io.IOException;

public class MainScene extends Application {
@@ -15,6 +19,16 @@ public class MainScene extends Application {
    @Override
    public void start(Stage stage) throws Exception {
        Scene menuScene = createMenuScene(stage);
        stage.addEventHandler(KeyEvent.KEY_PRESSED, event -> {
            if (event.getCode() == KeyCode.ESCAPE)
            {
                try {
                    stage.setScene(menuScene);
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }
        });
        stage.setScene(menuScene);
        stage.setTitle("Menu");
        stage.show();
@@ -24,6 +38,8 @@ public class MainScene extends Application {
    String figure2 = "None";
    String figure3 = "None";

    String filepath = "No File Selected";

    int normalObstacles = 0;
    int gameObstacles = 0;

@@ -64,7 +80,10 @@ public class MainScene extends Application {
        RadioButton fig1None = new RadioButton("None");
        fig1None.getStyleClass().add("check-button");
        fig1None.setToggleGroup(group1);
        VBox fig1Box = new VBox(fig1Arma, fig1teapot, fig1sphere, fig1CL, fig1None);
        RadioButton fig1FP = new RadioButton("File Path");
        fig1FP.getStyleClass().add("check-button");
        fig1FP.setToggleGroup(group1);
        VBox fig1Box = new VBox(fig1Arma, fig1teapot, fig1sphere, fig1CL, fig1None, fig1FP);

        // Second group of radio buttons
        ToggleGroup group2 = new ToggleGroup();
@@ -83,7 +102,10 @@ public class MainScene extends Application {
        RadioButton fig2None = new RadioButton("None");
        fig2None.getStyleClass().add("check-button");
        fig2None.setToggleGroup(group2);
        VBox fig2Box = new VBox(fig2Arma, fig2teapot, fig2sphere, fig2CL, fig2None);
        RadioButton fig2FP = new RadioButton("File Path");
        fig2FP.getStyleClass().add("check-button");
        fig2FP.setToggleGroup(group2);
        VBox fig2Box = new VBox(fig2Arma, fig2teapot, fig2sphere, fig2CL, fig2None, fig2FP);

        // Third group of radio buttons
        ToggleGroup group3 = new ToggleGroup();
@@ -102,7 +124,10 @@ public class MainScene extends Application {
        RadioButton fig3None = new RadioButton("None");
        fig3None.getStyleClass().add("check-button");
        fig3None.setToggleGroup(group3);
        VBox fig3Box = new VBox(fig3Arma, fig3teapot, fig3sphere, fig3CL, fig3None);
        RadioButton fig3FP = new RadioButton("File Path");
        fig3FP.getStyleClass().add("check-button");
        fig3FP.setToggleGroup(group3);
        VBox fig3Box = new VBox(fig3Arma, fig3teapot, fig3sphere, fig3CL, fig3None, fig3FP);

        // Adding listeners to each group
        group1.selectedToggleProperty().addListener((observable, oldValue, newValue) -> {
@@ -126,6 +151,23 @@ public class MainScene extends Application {
        selector.getChildren().addAll(fig1Box, fig2Box, fig3Box);
        selector.setAlignment(Pos.CENTER);

        Label selectedFileLabel = new Label(filepath);
        selectedFileLabel.getStyleClass().add("check-button");

        Button FPButton = new Button("Select File");
        FPButton.getStyleClass().add("menu-button");
        FPButton.setOnAction(event -> {FileChooser fileChooser = new FileChooser();
            File selectedFile = fileChooser.showOpenDialog(stage);
            if (selectedFile != null) {
                filepath = selectedFile.getAbsolutePath();
            }
            selectedFileLabel.setText(filepath);
            if (figure1.equals("No File Selected")) {figure1 = filepath;}
            if (figure2.equals("No File Selected")) {figure2 = filepath;}
            if (figure3.equals("No File Selected")) {figure3 = filepath;}
            });



        //FOR OBSTACLE SELECTION
        Label normObsText = new Label("Enter number of normal obstacles");
@@ -174,7 +216,7 @@ public class MainScene extends Application {
        //PARENT OF ALL THE LAYOUTS
        VBox menuLayout = new VBox(10);
        menuLayout.setAlignment(Pos.CENTER);
        menuLayout.getChildren().addAll(startButton, figHBox,selector, normObsText,
        menuLayout.getChildren().addAll(startButton, figHBox,selector, FPButton, selectedFileLabel,normObsText,
                normalObstInt, gameObsText, gameObstInt);

        Scene menuScene = new Scene(menuLayout, 1500, 800);
@@ -182,9 +224,7 @@ public class MainScene extends Application {
        return menuScene;
    }

    public static void main(String[] args) {
        launch(args);
    }
    public static void main(String[] args) {launch(args);}

    //Switch statement for the text taken from the buttons
    public String chooseFigureStr(RadioButton selected){
@@ -194,6 +234,7 @@ public class MainScene extends Application {
            case "Sphere" -> "src/sphereOut.txt";
            case "None" -> "none";
            case "Command Line" -> "Use CL";
            case "File Path" -> filepath;
            default -> "nothing picked";
        };
    }

src/teapotOut.txt

0 → 100644
+6320 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading