Browse Source

Add DarkSoulsBtn to Gui

master
Leon Montag 2 years ago
parent
commit
8b63085575
  1. 7
      src/main/java/Gui/StartGameGui.java
  2. 5
      src/main/java/Gui/gui.java
  3. 5
      src/main/java/game/StartDarkSoulsGame.java
  4. 2
      src/test/java/Gui/guiTest.java
  5. 19
      target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
  6. 10
      target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst

7
src/main/java/Gui/StartGameGui.java

@ -3,6 +3,7 @@ package Gui;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import game.StartDarkSoulsGame;
import game.runGame; import game.runGame;
public class StartGameGui implements ActionListener { public class StartGameGui implements ActionListener {
@ -10,7 +11,11 @@ public class StartGameGui implements ActionListener {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
gui.Panel.setVisible(false); gui.Panel.setVisible(false);
startGame();
if(e.getSource() == gui.StartBtn) {
startGame();
} else {
new StartDarkSoulsGame();
}
} }
public void startGame() { public void startGame() {

5
src/main/java/Gui/gui.java

@ -12,7 +12,7 @@ import javax.swing.JPanel;
public class gui implements GuiInterface { public class gui implements GuiInterface {
public static JFrame Frame; public static JFrame Frame;
public static JButton StartBtn, CloseBtn;
public static JButton StartBtn, CloseBtn, StartDarkSoulsBtn;
public static JPanel Panel; public static JPanel Panel;
public static JLabel Label; public static JLabel Label;
public static int width = 800, height = 600; public static int width = 800, height = 600;
@ -37,6 +37,8 @@ public class gui implements GuiInterface {
public void createButtons() { public void createButtons() {
StartBtn = new JButton("Starte Spiel"); StartBtn = new JButton("Starte Spiel");
StartBtn.addActionListener(new StartGameGui()); StartBtn.addActionListener(new StartGameGui());
StartDarkSoulsBtn = new JButton("Starte Dark Souls 4");
StartDarkSoulsBtn.addActionListener(new StartGameGui());
CloseBtn = new JButton("Schliessen"); CloseBtn = new JButton("Schliessen");
CloseBtn.addActionListener(new ActionHandler()); CloseBtn.addActionListener(new ActionHandler());
@ -58,6 +60,7 @@ public class gui implements GuiInterface {
Label.setFont(new Font("Serif", Font.BOLD, 28)); Label.setFont(new Font("Serif", Font.BOLD, 28));
Panel.add(Label, gbc); Panel.add(Label, gbc);
Panel.add(StartBtn, gbc); Panel.add(StartBtn, gbc);
Panel.add(StartDarkSoulsBtn, gbc);
Panel.add(CloseBtn, gbc); Panel.add(CloseBtn, gbc);
Frame.add(Panel); Frame.add(Panel);
Frame.setVisible(true); Frame.setVisible(true);

5
src/main/java/game/StartDarkSoulsGame.java

@ -0,0 +1,5 @@
package game;
public class StartDarkSoulsGame {
}

2
src/test/java/Gui/guiTest.java

@ -42,7 +42,7 @@ class guiTest {
@Test @Test
public void testCreatePanel() { public void testCreatePanel() {
// arrange // arrange
int NumPanels = 3;
int NumPanels = 4;
// act // act
int TargetNumPanels = gui.Panel.getComponents().length; int TargetNumPanels = gui.Panel.getComponents().length;

19
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

10
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
Loading…
Cancel
Save