Browse Source
Merge branch 'main' into 'addGameOver'
Merge branch 'main' into 'addGameOver'
# Conflicts: # src/main/java/de/hsfulda/onses/models/Game.javamain
fdai7793
11 months ago
12 changed files with 156 additions and 82 deletions
-
18src/main/java/de/hsfulda/onses/App.java
-
3src/main/java/de/hsfulda/onses/Main.java
-
29src/main/java/de/hsfulda/onses/controllers/AppController.java
-
9src/main/java/de/hsfulda/onses/controllers/Controller.java
-
22src/main/java/de/hsfulda/onses/controllers/MainController.java
-
0src/main/java/de/hsfulda/onses/models/.gitkeep
-
37src/main/java/de/hsfulda/onses/models/Card.java
-
25src/main/java/de/hsfulda/onses/models/Game.java
-
23src/main/java/de/hsfulda/onses/models/Player.java
-
22src/main/resources/de/hsfulda/onses/views/app.fxml
-
14src/main/resources/de/hsfulda/onses/views/main.fxml
-
36src/test/java/de/hsfulda/onses/CardTest.java
@ -0,0 +1,18 @@ |
|||||
|
package de.hsfulda.onses; |
||||
|
|
||||
|
import de.hsfulda.onses.controllers.AppController; |
||||
|
import de.hsfulda.onses.models.Game; |
||||
|
import javafx.application.Application; |
||||
|
import javafx.scene.Scene; |
||||
|
import javafx.stage.Stage; |
||||
|
|
||||
|
public class App extends Application { |
||||
|
@Override |
||||
|
public void start(Stage stage) throws Exception { |
||||
|
final AppController appController = new AppController(new Game()); |
||||
|
|
||||
|
stage.setTitle("Onses - Uno Game"); |
||||
|
stage.setScene(new Scene(appController.render())); |
||||
|
stage.show(); |
||||
|
} |
||||
|
} |
@ -1,10 +1,9 @@ |
|||||
package de.hsfulda.onses; |
package de.hsfulda.onses; |
||||
|
|
||||
import de.hsfulda.onses.controllers.MainController; |
|
||||
import javafx.application.Application; |
import javafx.application.Application; |
||||
|
|
||||
public class Main { |
public class Main { |
||||
public static void main(String[] args) { |
public static void main(String[] args) { |
||||
Application.launch(MainController.class); |
|
||||
|
Application.launch(App.class); |
||||
} |
} |
||||
} |
} |
@ -0,0 +1,29 @@ |
|||||
|
package de.hsfulda.onses.controllers; |
||||
|
|
||||
|
import de.hsfulda.onses.Main; |
||||
|
import de.hsfulda.onses.models.Game; |
||||
|
import javafx.fxml.FXMLLoader; |
||||
|
import javafx.scene.Parent; |
||||
|
import javafx.scene.control.Button; |
||||
|
|
||||
|
import java.io.IOException; |
||||
|
import java.util.Objects; |
||||
|
|
||||
|
public class AppController implements Controller { |
||||
|
|
||||
|
private final Game game; |
||||
|
|
||||
|
public AppController(Game game) { |
||||
|
this.game = game; |
||||
|
} |
||||
|
@Override |
||||
|
public Parent render() throws IOException { |
||||
|
final Parent parent = FXMLLoader.load(Main.class.getResource("views/app.fxml")); |
||||
|
Button button = (Button) parent.lookup("#startGameBtn"); |
||||
|
|
||||
|
button.setOnAction(e -> { |
||||
|
System.out.println("Pressed"); |
||||
|
}); |
||||
|
return parent; |
||||
|
} |
||||
|
} |
@ -0,0 +1,9 @@ |
|||||
|
package de.hsfulda.onses.controllers; |
||||
|
|
||||
|
import javafx.scene.Parent; |
||||
|
|
||||
|
import java.io.IOException; |
||||
|
|
||||
|
public interface Controller { |
||||
|
Parent render() throws IOException; |
||||
|
} |
@ -1,22 +0,0 @@ |
|||||
package de.hsfulda.onses.controllers; |
|
||||
|
|
||||
import de.hsfulda.onses.Main; |
|
||||
import javafx.application.Application; |
|
||||
import javafx.fxml.FXMLLoader; |
|
||||
import javafx.scene.Parent; |
|
||||
import javafx.scene.Scene; |
|
||||
import javafx.stage.Stage; |
|
||||
|
|
||||
import java.io.IOException; |
|
||||
import java.util.Objects; |
|
||||
|
|
||||
public class MainController extends Application { |
|
||||
@Override |
|
||||
public void start(Stage stage) throws IOException { |
|
||||
final Parent parent = FXMLLoader.load(Objects.requireNonNull(Main.class.getResource("views/main.fxml"))); |
|
||||
|
|
||||
stage.setTitle("Onses"); |
|
||||
stage.setScene(new Scene(parent)); |
|
||||
stage.show(); |
|
||||
} |
|
||||
} |
|
@ -0,0 +1,22 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
|
||||
|
<?import javafx.scene.control.Button?> |
||||
|
<?import javafx.scene.control.Label?> |
||||
|
<?import javafx.scene.layout.AnchorPane?> |
||||
|
<?import javafx.scene.text.Font?> |
||||
|
|
||||
|
|
||||
|
<AnchorPane prefHeight="585.0" prefWidth="1125.0" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1"> |
||||
|
<children> |
||||
|
<Label layoutX="473.0" layoutY="121.0" text="Uno Game" AnchorPane.leftAnchor="473.0" AnchorPane.topAnchor="121.0"> |
||||
|
<font> |
||||
|
<Font size="34.0" /> |
||||
|
</font> |
||||
|
</Label> |
||||
|
<Button fx:id="startGameBtn" layoutX="495.0" layoutY="275.0" mnemonicParsing="false" text="Start Game" AnchorPane.leftAnchor="495.0" AnchorPane.topAnchor="275.0"> |
||||
|
<font> |
||||
|
<Font size="19.0" /> |
||||
|
</font> |
||||
|
</Button> |
||||
|
</children> |
||||
|
</AnchorPane> |
@ -1,14 +0,0 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||
|
|
||||
<?import java.lang.*?> |
|
||||
<?import java.util.*?> |
|
||||
<?import javafx.scene.*?> |
|
||||
<?import javafx.scene.control.*?> |
|
||||
<?import javafx.scene.layout.*?> |
|
||||
|
|
||||
<AnchorPane xmlns="http://javafx.com/javafx" |
|
||||
xmlns:fx="http://javafx.com/fxml" |
|
||||
fx:controller="de.hsfulda.onses.controllers.MainController" |
|
||||
prefHeight="400.0" prefWidth="600.0"> |
|
||||
|
|
||||
</AnchorPane> |
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue