diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..26d33521 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 00000000..abf76483 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..a09fa6f9 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 00000000..797acea5 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..35eb1ddf --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Client/out/production/untitled/Client.class b/Client/out/production/untitled/Client.class new file mode 100644 index 00000000..a18c9670 Binary files /dev/null and b/Client/out/production/untitled/Client.class differ diff --git a/Client/src/Client.java b/Client/src/Client.java new file mode 100644 index 00000000..f2e92449 --- /dev/null +++ b/Client/src/Client.java @@ -0,0 +1,60 @@ +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.net.Socket; +import java.net.UnknownHostException; +import java.util.Scanner; + +public class Client { + + static String host = "192.168.43.6"; + static int port = 6969; + static DataInputStream in; + static DataOutputStream out; + static Socket socket; + + public static void main(String[] args) { + + Scanner input = new Scanner(System.in); + boolean connect = true; + + try { + socket = new Socket(host, port); + in = new DataInputStream(socket.getInputStream()); + out = new DataOutputStream(socket.getOutputStream()); + + //while (connect) { + /*System.out.println("Enter annual interest rate"); + double annualInterestRate = input.nextDouble(); + + System.out.println("Enter number of years"); + int numOfYears = input.nextInt(); + + System.out.println("Enter loan amount"); + double loanAmount = input.nextDouble(); + + out.writeDouble(annualInterestRate); + out.writeInt(numOfYears); + out.writeDouble(loanAmount); + + */ + //out.flush(); + + // } + while(true){ + String name = input.nextLine(); + out.writeUTF(name); + while(true){ + String print = in.readUTF(); + System.out.println(print); + } + + } + + } catch (UnknownHostException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/Client/untitled.iml b/Client/untitled.iml new file mode 100644 index 00000000..9465dd86 --- /dev/null +++ b/Client/untitled.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/GameFx/GameFx.iml b/GameFx/GameFx.iml new file mode 100644 index 00000000..cf79cfdc --- /dev/null +++ b/GameFx/GameFx.iml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/GameFx/pom.xml b/GameFx/pom.xml new file mode 100644 index 00000000..843f3cd3 --- /dev/null +++ b/GameFx/pom.xml @@ -0,0 +1,70 @@ + + + 4.0.0 + + com.example + GameFx + 1.0-SNAPSHOT + GameFx + + + UTF-8 + 5.7.1 + + + + + org.openjfx + javafx-controls + 17-ea+11 + + + org.openjfx + javafx-fxml + 17-ea+11 + + + + org.junit.jupiter + junit-jupiter-api + ${junit.version} + test + + + org.junit.jupiter + junit-jupiter-engine + ${junit.version} + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 17 + 17 + + + + org.openjfx + javafx-maven-plugin + 0.0.6 + + + + default-cli + + com.example.gamefx/com.example.gamefx.HelloApplication + + + + + + + \ No newline at end of file diff --git a/GameFx/src/main/java/com/example/gamefx/HelloApplication.java b/GameFx/src/main/java/com/example/gamefx/HelloApplication.java new file mode 100644 index 00000000..76493339 --- /dev/null +++ b/GameFx/src/main/java/com/example/gamefx/HelloApplication.java @@ -0,0 +1,32 @@ +package com.example.gamefx; + +import javafx.application.Application; +import javafx.fxml.FXML; +import javafx.fxml.FXMLLoader; +import javafx.scene.Scene; +import javafx.scene.control.Label; +import javafx.scene.control.TextField; +import javafx.stage.Stage; + +import java.io.IOException; + + +public class HelloApplication extends Application { + + @Override + public void start(Stage stage) throws IOException { + // which scene we want to be initially displayed.. load that .fxml file + FXMLLoader fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("CARDS_AGAINST_MEDIALOGY.fxml")); + Scene scene = new Scene(fxmlLoader.load()); + stage.setTitle("Card Game"); //the title of the window + stage.setScene(scene); + stage.show(); + } + + public static void main(String[] args) { + launch(); + } + +} + + diff --git a/GameFx/src/main/java/com/example/gamefx/SceneController.java b/GameFx/src/main/java/com/example/gamefx/SceneController.java new file mode 100644 index 00000000..f3ec106e --- /dev/null +++ b/GameFx/src/main/java/com/example/gamefx/SceneController.java @@ -0,0 +1,51 @@ +package com.example.gamefx; + +import javafx.event.ActionEvent; +import javafx.fxml.FXML; +import javafx.fxml.FXMLLoader; +import javafx.scene.Node; +import javafx.scene.Scene; +import javafx.scene.control.Label; +import javafx.scene.control.TextField; +import javafx.stage.Stage; + +import java.io.IOException; + +public class SceneController { + @FXML + private Label welcomeText; + private Stage stage; + private Scene scene; + private FXMLLoader fxmlLoader; + + //https://www.youtube.com/watch?v=hcM-R-YOKkQ&ab_channel=BroCode + // method to switch scenes + @FXML + protected void onButtonClick(ActionEvent event) throws IOException { + welcomeText.setText("Welcome to JavaFX Application!"); + //load the correct .fxml file + fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("CARDS_AGAINST_MEDIALOGY.fxml")); + //cast the source of the event to Node, cast the entire stage to Stage + stage = (Stage)((Node)event.getSource()).getScene().getWindow(); + scene = new Scene(fxmlLoader.load()); + // set the scene to the stage + stage.setScene(scene); + stage.show(); //display it + + + } + + + + @FXML + protected void switchToScene2(ActionEvent event) throws IOException { + fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("second-page.fxml")); + stage = (Stage)((Node)event.getSource()).getScene().getWindow(); + scene = new Scene(fxmlLoader.load(), 560, 440); + stage.setScene(scene); + stage.show(); + + } + + +} \ No newline at end of file diff --git a/GameFx/src/main/java/module-info.java b/GameFx/src/main/java/module-info.java new file mode 100644 index 00000000..88833793 --- /dev/null +++ b/GameFx/src/main/java/module-info.java @@ -0,0 +1,8 @@ +module com.example.gamefx { + requires javafx.controls; + requires javafx.fxml; + + + opens com.example.gamefx to javafx.fxml; + exports com.example.gamefx; +} \ No newline at end of file diff --git a/GameFx/src/main/resources/com/example/gamefx/CARDS_AGAINST_MEDIALOGY.fxml b/GameFx/src/main/resources/com/example/gamefx/CARDS_AGAINST_MEDIALOGY.fxml new file mode 100644 index 00000000..d99364ff --- /dev/null +++ b/GameFx/src/main/resources/com/example/gamefx/CARDS_AGAINST_MEDIALOGY.fxml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/GameFx/src/main/resources/com/example/gamefx/CARDS_FOR_HUMANITY.fxml b/GameFx/src/main/resources/com/example/gamefx/CARDS_FOR_HUMANITY.fxml new file mode 100644 index 00000000..aac53222 --- /dev/null +++ b/GameFx/src/main/resources/com/example/gamefx/CARDS_FOR_HUMANITY.fxml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/GameFx/src/main/resources/com/example/gamefx/hello-view.fxml b/GameFx/src/main/resources/com/example/gamefx/hello-view.fxml new file mode 100644 index 00000000..97133bb9 --- /dev/null +++ b/GameFx/src/main/resources/com/example/gamefx/hello-view.fxml @@ -0,0 +1,16 @@ + + + + + + + + + + + + +