From 8b63085575f4a2bd0ffe9ebc6b82e9da20162f71 Mon Sep 17 00:00:00 2001 From: Leon Montag Date: Wed, 18 Jan 2023 11:18:55 +0100 Subject: [PATCH] Add DarkSoulsBtn to Gui --- src/main/java/Gui/StartGameGui.java | 7 ++++++- src/main/java/Gui/gui.java | 5 ++++- src/main/java/game/StartDarkSoulsGame.java | 5 +++++ src/test/java/Gui/guiTest.java | 2 +- .../compile/default-compile/inputFiles.lst | 19 ++++++++++--------- .../default-testCompile/inputFiles.lst | 10 +++++----- 6 files changed, 31 insertions(+), 17 deletions(-) create mode 100644 src/main/java/game/StartDarkSoulsGame.java diff --git a/src/main/java/Gui/StartGameGui.java b/src/main/java/Gui/StartGameGui.java index 591f7d2..5993265 100644 --- a/src/main/java/Gui/StartGameGui.java +++ b/src/main/java/Gui/StartGameGui.java @@ -3,6 +3,7 @@ package Gui; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import game.StartDarkSoulsGame; import game.runGame; public class StartGameGui implements ActionListener { @@ -10,7 +11,11 @@ public class StartGameGui implements ActionListener { @Override public void actionPerformed(ActionEvent e) { gui.Panel.setVisible(false); - startGame(); + if(e.getSource() == gui.StartBtn) { + startGame(); + } else { + new StartDarkSoulsGame(); + } } public void startGame() { diff --git a/src/main/java/Gui/gui.java b/src/main/java/Gui/gui.java index 337c0a9..b21e1d7 100644 --- a/src/main/java/Gui/gui.java +++ b/src/main/java/Gui/gui.java @@ -12,7 +12,7 @@ import javax.swing.JPanel; public class gui implements GuiInterface { public static JFrame Frame; - public static JButton StartBtn, CloseBtn; + public static JButton StartBtn, CloseBtn, StartDarkSoulsBtn; public static JPanel Panel; public static JLabel Label; public static int width = 800, height = 600; @@ -37,6 +37,8 @@ public class gui implements GuiInterface { public void createButtons() { StartBtn = new JButton("Starte Spiel"); StartBtn.addActionListener(new StartGameGui()); + StartDarkSoulsBtn = new JButton("Starte Dark Souls 4"); + StartDarkSoulsBtn.addActionListener(new StartGameGui()); CloseBtn = new JButton("Schliessen"); CloseBtn.addActionListener(new ActionHandler()); @@ -58,6 +60,7 @@ public class gui implements GuiInterface { Label.setFont(new Font("Serif", Font.BOLD, 28)); Panel.add(Label, gbc); Panel.add(StartBtn, gbc); + Panel.add(StartDarkSoulsBtn, gbc); Panel.add(CloseBtn, gbc); Frame.add(Panel); Frame.setVisible(true); diff --git a/src/main/java/game/StartDarkSoulsGame.java b/src/main/java/game/StartDarkSoulsGame.java new file mode 100644 index 0000000..cbeaa30 --- /dev/null +++ b/src/main/java/game/StartDarkSoulsGame.java @@ -0,0 +1,5 @@ +package game; + +public class StartDarkSoulsGame { + +} diff --git a/src/test/java/Gui/guiTest.java b/src/test/java/Gui/guiTest.java index 1994c27..ad53354 100644 --- a/src/test/java/Gui/guiTest.java +++ b/src/test/java/Gui/guiTest.java @@ -42,7 +42,7 @@ class guiTest { @Test public void testCreatePanel() { // arrange - int NumPanels = 3; + int NumPanels = 4; // act int TargetNumPanels = gui.Panel.getComponents().length; diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst index b7c28cf..f4e91a4 100644 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -1,9 +1,10 @@ -C:\Users\ozan_\MiniGameProject\src\main\java\Gui\GuiInterface.java -C:\Users\ozan_\MiniGameProject\src\main\java\Gui\GameGuiInterface.java -C:\Users\ozan_\MiniGameProject\src\main\java\Gui\gui.java -C:\Users\ozan_\MiniGameProject\src\main\java\game\loadNextQuestion.java -C:\Users\ozan_\MiniGameProject\src\main\java\Gui\ActionHandler.java -C:\Users\ozan_\MiniGameProject\src\main\java\main.java -C:\Users\ozan_\MiniGameProject\src\main\java\game\runGame.java -C:\Users\ozan_\MiniGameProject\src\main\java\Gui\StartGameGui.java -C:\Users\ozan_\MiniGameProject\src\main\java\Gui\GameGui.java +C:\Users\Leon\MiniGameProject\src\main\java\Gui\ActionHandler.java +C:\Users\Leon\MiniGameProject\src\main\java\game\loadNextQuestion.java +C:\Users\Leon\MiniGameProject\src\main\java\Gui\GameGuiInterface.java +C:\Users\Leon\MiniGameProject\src\main\java\Gui\gui.java +C:\Users\Leon\MiniGameProject\src\main\java\game\runGame.java +C:\Users\Leon\MiniGameProject\src\main\java\game\StartDarkSoulsGame.java +C:\Users\Leon\MiniGameProject\src\main\java\main.java +C:\Users\Leon\MiniGameProject\src\main\java\Gui\StartGameGui.java +C:\Users\Leon\MiniGameProject\src\main\java\Gui\GameGui.java +C:\Users\Leon\MiniGameProject\src\main\java\Gui\GuiInterface.java diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst index cd8f159..93bde8b 100644 --- a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst +++ b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst @@ -1,5 +1,5 @@ -C:\Users\ozan_\MiniGameProject\src\test\java\Gui\ActionHandlerTest.java -C:\Users\ozan_\MiniGameProject\src\test\java\Gui\GameGuiTest.java -C:\Users\ozan_\MiniGameProject\src\test\java\game\loadNextQuestionTest.java -C:\Users\ozan_\MiniGameProject\src\test\java\game\runGameTest.java -C:\Users\ozan_\MiniGameProject\src\test\java\Gui\guiTest.java +C:\Users\Leon\MiniGameProject\src\test\java\Gui\guiTest.java +C:\Users\Leon\MiniGameProject\src\test\java\game\loadNextQuestionTest.java +C:\Users\Leon\MiniGameProject\src\test\java\Gui\ActionHandlerTest.java +C:\Users\Leon\MiniGameProject\src\test\java\Gui\GameGuiTest.java +C:\Users\Leon\MiniGameProject\src\test\java\game\runGameTest.java