mirror of
https://github.com/jokerx3/HeatUp
synced 2026-07-27 08:59:44 +02:00
Merge branch 'master' of https://github.com/jokerx3/prp
This commit is contained in:
@@ -10,6 +10,7 @@ import de.heatup.timers.HardwareResetTimers;
|
|||||||
import de.heatup.ui.actionPanel.ActionControl;
|
import de.heatup.ui.actionPanel.ActionControl;
|
||||||
import de.heatup.ui.actionPanel.ActionWatcher;
|
import de.heatup.ui.actionPanel.ActionWatcher;
|
||||||
import de.heatup.ui.actionPanel.HardewareManipulate;
|
import de.heatup.ui.actionPanel.HardewareManipulate;
|
||||||
|
import de.heatup.ui.menu.MenuPanel;
|
||||||
|
|
||||||
public class KeyBindings extends KeyAdapter {
|
public class KeyBindings extends KeyAdapter {
|
||||||
final private static int progressBarTimer = 7;
|
final private static int progressBarTimer = 7;
|
||||||
@@ -44,8 +45,17 @@ public class KeyBindings extends KeyAdapter {
|
|||||||
case KeyEvent.VK_ESCAPE:
|
case KeyEvent.VK_ESCAPE:
|
||||||
if ( esc ) {
|
if ( esc ) {
|
||||||
esc = false;
|
esc = false;
|
||||||
|
MenuPanel.setStartGameLabel("[ Spiel Starten ]");
|
||||||
|
MenuPanel.setShowCreditsLabel("[ Credits anzeigen ]");
|
||||||
|
MenuPanel.setShowTutorialLabel("[ Credits anzeigen ]");
|
||||||
|
MenuPanel.setShowHighscoreLabel("[ Highscore anzeigen ]");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
esc = true;
|
esc = true;
|
||||||
|
MenuPanel.setStartGameLabel(" weiter mit >>ESC<< ");
|
||||||
|
MenuPanel.setShowCreditsLabel("");
|
||||||
|
MenuPanel.setShowTutorialLabel("");
|
||||||
|
MenuPanel.setShowHighscoreLabel("");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case KeyEvent.VK_A:
|
case KeyEvent.VK_A:
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import de.heatup.objects.StaticObject;
|
|||||||
import de.heatup.timers.HardwareResetTimers;
|
import de.heatup.timers.HardwareResetTimers;
|
||||||
import de.heatup.ui.actionPanel.ActionControl;
|
import de.heatup.ui.actionPanel.ActionControl;
|
||||||
import de.heatup.ui.actionPanel.ActionWatcher;
|
import de.heatup.ui.actionPanel.ActionWatcher;
|
||||||
|
import de.heatup.ui.menu.CreditsPanel;
|
||||||
import de.heatup.ui.menu.MenuPanel;
|
import de.heatup.ui.menu.MenuPanel;
|
||||||
|
|
||||||
|
|
||||||
@@ -51,6 +52,8 @@ public class Main extends JFrame implements Runnable {
|
|||||||
private static JPanel leftPanel;
|
private static JPanel leftPanel;
|
||||||
private static JPanel rightPanel;
|
private static JPanel rightPanel;
|
||||||
private static JPanel actionPanel;
|
private static JPanel actionPanel;
|
||||||
|
private static JPanel creditsPanel;
|
||||||
|
|
||||||
|
|
||||||
private static JPanel menuPanel;
|
private static JPanel menuPanel;
|
||||||
|
|
||||||
@@ -101,11 +104,15 @@ public class Main extends JFrame implements Runnable {
|
|||||||
MenuPanel.setMenuPanel();
|
MenuPanel.setMenuPanel();
|
||||||
menuPanel = MenuPanel.getMenuPanel();
|
menuPanel = MenuPanel.getMenuPanel();
|
||||||
|
|
||||||
|
CreditsPanel.setCreditsPanel();
|
||||||
|
creditsPanel = CreditsPanel.getCreditsPanel();
|
||||||
|
|
||||||
outerPanel.add(statusPanel,BorderLayout.NORTH);
|
outerPanel.add(statusPanel,BorderLayout.NORTH);
|
||||||
outerPanel.add(leftPanel, BorderLayout.WEST);
|
outerPanel.add(leftPanel, BorderLayout.WEST);
|
||||||
outerPanel.add(rightPanel, BorderLayout.EAST);
|
outerPanel.add(rightPanel, BorderLayout.EAST);
|
||||||
outerPanel.add(gamePanel,BorderLayout.CENTER);
|
outerPanel.add(gamePanel,BorderLayout.CENTER);
|
||||||
outerPanel.add(actionPanel,BorderLayout.SOUTH);
|
outerPanel.add(actionPanel,BorderLayout.SOUTH);
|
||||||
|
outerPanel.add(creditsPanel, BorderLayout.CENTER);
|
||||||
outerPanel.add(menuPanel, BorderLayout.CENTER);
|
outerPanel.add(menuPanel, BorderLayout.CENTER);
|
||||||
|
|
||||||
add(outerPanel);
|
add(outerPanel);
|
||||||
@@ -120,8 +127,7 @@ public class Main extends JFrame implements Runnable {
|
|||||||
|
|
||||||
PanelBuilder.actionPanel.setBackground(Color.BLACK);
|
PanelBuilder.actionPanel.setBackground(Color.BLACK);
|
||||||
PanelBuilder.statusPanel.setBackground(Color.BLACK);
|
PanelBuilder.statusPanel.setBackground(Color.BLACK);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* entfernen wenn getter verwendet wird.
|
* entfernen wenn getter verwendet wird.
|
||||||
*/
|
*/
|
||||||
@@ -152,7 +158,9 @@ public class Main extends JFrame implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static boolean getPause() {
|
||||||
|
return pause;
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,18 @@
|
|||||||
package de.heatup.ui.menu;
|
package de.heatup.ui.menu;
|
||||||
|
|
||||||
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.GridLayout;
|
import java.awt.GridLayout;
|
||||||
|
import java.awt.event.MouseAdapter;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
|
import de.heatup.logging.Logger;
|
||||||
import de.heatup.ui.FontLoader;
|
import de.heatup.ui.FontLoader;
|
||||||
|
import de.heatup.ui.PanelBuilder;
|
||||||
|
|
||||||
public class CreditsPanel {
|
public class CreditsPanel {
|
||||||
|
|
||||||
@@ -19,11 +24,12 @@ public class CreditsPanel {
|
|||||||
private static Font emulogic;
|
private static Font emulogic;
|
||||||
private static Font emulogicHeadline;
|
private static Font emulogicHeadline;
|
||||||
private static Font emulogicDivider;
|
private static Font emulogicDivider;
|
||||||
|
private static Font emulogicSmall;
|
||||||
private static Font ttfbase;
|
private static Font ttfbase;
|
||||||
|
|
||||||
// panels and labels
|
// panels and labels
|
||||||
private static JPanel headline, divider, divider2, name1, name2, name3, name4, name5;
|
private static JPanel headline, divider, divider2, name1, name2, name3, name4, name5, exit;
|
||||||
private static JLabel headlineLabel, dividerLabel, dividerLabel2, name1Label, name2Label, name3Label, name4Label, name5Label;
|
private static JLabel headlineLabel, dividerLabel, dividerLabel2, name1Label, name2Label, name3Label, name4Label, name5Label, exitLabel;
|
||||||
|
|
||||||
public CreditsPanel() { }
|
public CreditsPanel() { }
|
||||||
|
|
||||||
@@ -36,6 +42,7 @@ public class CreditsPanel {
|
|||||||
emulogicHeadline = ttfbase.deriveFont(Font.PLAIN, 28);
|
emulogicHeadline = ttfbase.deriveFont(Font.PLAIN, 28);
|
||||||
emulogic = ttfbase.deriveFont(Font.PLAIN, 12);
|
emulogic = ttfbase.deriveFont(Font.PLAIN, 12);
|
||||||
emulogicDivider = ttfbase.deriveFont(Font.PLAIN, 20);
|
emulogicDivider = ttfbase.deriveFont(Font.PLAIN, 20);
|
||||||
|
emulogicSmall = ttfbase.deriveFont(Font.PLAIN, 10);
|
||||||
|
|
||||||
createCredits();
|
createCredits();
|
||||||
}
|
}
|
||||||
@@ -106,6 +113,26 @@ public class CreditsPanel {
|
|||||||
name5Label.setFont(emulogic);
|
name5Label.setFont(emulogic);
|
||||||
name5.add(name5Label);
|
name5.add(name5Label);
|
||||||
|
|
||||||
|
exit = new JPanel();
|
||||||
|
exit.setBackground(Color.BLACK);
|
||||||
|
|
||||||
|
exitLabel = new JLabel("[ zurück zum Menü ]");
|
||||||
|
exitLabel.setForeground(Color.YELLOW);
|
||||||
|
exitLabel.setFont(emulogicSmall);
|
||||||
|
|
||||||
|
exitLabel.addMouseListener(new MouseAdapter() {
|
||||||
|
public void mouseClicked(MouseEvent e) {
|
||||||
|
// @TODO: implement show credits
|
||||||
|
CreditsPanel.getCreditsPanel().setVisible(false);
|
||||||
|
|
||||||
|
PanelBuilder.getOuterPanel().add(MenuPanel.getMenuPanel(), BorderLayout.CENTER);
|
||||||
|
MenuPanel.getMenuPanel().setVisible(true);
|
||||||
|
|
||||||
|
Logger.write("back to menu");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
exit.add(exitLabel);
|
||||||
|
|
||||||
|
|
||||||
credits.add(headline);
|
credits.add(headline);
|
||||||
@@ -116,10 +143,11 @@ public class CreditsPanel {
|
|||||||
credits.add(name4);
|
credits.add(name4);
|
||||||
credits.add(name5);
|
credits.add(name5);
|
||||||
credits.add(divider2);
|
credits.add(divider2);
|
||||||
|
credits.add(exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JPanel getCreditsPanel() {
|
public static JPanel getCreditsPanel() {
|
||||||
credits.setVisible(false);
|
credits.setVisible(true);
|
||||||
return credits;
|
return credits;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,10 @@ import java.awt.event.MouseEvent;
|
|||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
|
import sun.security.util.PendingException;
|
||||||
import de.heatup.logging.Logger;
|
import de.heatup.logging.Logger;
|
||||||
import de.heatup.ui.FontLoader;
|
import de.heatup.ui.FontLoader;
|
||||||
|
import de.heatup.ui.KeyBindings;
|
||||||
import de.heatup.ui.Main;
|
import de.heatup.ui.Main;
|
||||||
import de.heatup.ui.PanelBuilder;
|
import de.heatup.ui.PanelBuilder;
|
||||||
import de.heatup.ui.StatusPanelAdder;
|
import de.heatup.ui.StatusPanelAdder;
|
||||||
@@ -38,6 +40,26 @@ public class MenuPanel {
|
|||||||
/** not in usage yet */
|
/** not in usage yet */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static JLabel getStartGameLabel() {
|
||||||
|
return startGame;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setStartGameLabel(String text) {
|
||||||
|
startGame.setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setShowCreditsLabel(String text) {
|
||||||
|
showCredits.setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setShowTutorialLabel(String text) {
|
||||||
|
showTutorial.setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setShowHighscoreLabel(String text) {
|
||||||
|
showHighscore.setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
public static void setMenuPanel() {
|
public static void setMenuPanel() {
|
||||||
|
|
||||||
menuPanel.setPreferredSize(new Dimension(800,600));
|
menuPanel.setPreferredSize(new Dimension(800,600));
|
||||||
@@ -71,41 +93,43 @@ public class MenuPanel {
|
|||||||
start = new JPanel();
|
start = new JPanel();
|
||||||
start.setBackground(Color.BLACK);
|
start.setBackground(Color.BLACK);
|
||||||
|
|
||||||
startGame = new JLabel("[ Spiel starten ]");
|
startGame = new JLabel();
|
||||||
|
startGame.setText("[ Spiel starten ]");
|
||||||
startGame.setForeground(Color.YELLOW);
|
startGame.setForeground(Color.YELLOW);
|
||||||
startGame.setFont(emulogic);
|
startGame.setFont(emulogic);
|
||||||
|
|
||||||
startGame.addMouseListener(new MouseAdapter() {
|
startGame.addMouseListener(new MouseAdapter() {
|
||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
// @TODO: implement start game
|
if(gameExists == 1) {
|
||||||
|
|
||||||
// just a trie
|
// StatusPanel bauen
|
||||||
// StatusPanel bauen
|
StatusPanelAdder.setPanel(PanelBuilder.statusPanel);
|
||||||
StatusPanelAdder.setPanel(PanelBuilder.statusPanel);
|
StatusPanelAdder.createPanel();
|
||||||
StatusPanelAdder.createPanel();
|
|
||||||
|
|
||||||
// ActionPanel bauen
|
// ActionPanel bauen
|
||||||
ActionControl.setPanel(PanelBuilder.actionPanel);
|
ActionControl.setPanel(PanelBuilder.actionPanel);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PanelBuilder.createGame(1);
|
PanelBuilder.createGame(1);
|
||||||
gameExists = 2;
|
gameExists = 2;
|
||||||
menuPanel.setVisible(false);
|
menuPanel.setVisible(false);
|
||||||
|
|
||||||
PanelBuilder.getOuterPanel().add(PanelBuilder.getGamePanel(),BorderLayout.CENTER);
|
PanelBuilder.getOuterPanel().add(PanelBuilder.getGamePanel(),BorderLayout.CENTER);
|
||||||
|
|
||||||
// PanelBuilder.getGamePanel().setSize(800, 600);
|
//** game, action, status panel redraw and check visibility */
|
||||||
// PanelBuilder.getGamePanel().setVisible(true);
|
|
||||||
|
Logger.write("Game Started via menu");
|
||||||
|
} else if (gameExists == 2) {
|
||||||
//** game, action, status panel redraw and check visibility */
|
if(Main.getPause()) {
|
||||||
|
|
||||||
Logger.write("Game Started via menu");
|
}
|
||||||
|
Logger.write("game already started");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
start.add(startGame);
|
start.add(startGame);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -121,8 +145,7 @@ public class MenuPanel {
|
|||||||
|
|
||||||
endGame.addMouseListener(new MouseAdapter() {
|
endGame.addMouseListener(new MouseAdapter() {
|
||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
// @TODO: implement end game
|
System.exit(0);
|
||||||
Logger.write("game ended");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -163,10 +186,16 @@ public class MenuPanel {
|
|||||||
|
|
||||||
showCredits.addMouseListener(new MouseAdapter() {
|
showCredits.addMouseListener(new MouseAdapter() {
|
||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
// @TODO: implement show credits
|
|
||||||
menuPanel.setVisible(false);
|
|
||||||
|
|
||||||
Logger.write("show credits");
|
if(gameExists == 1) {
|
||||||
|
|
||||||
|
menuPanel.setVisible(false);
|
||||||
|
PanelBuilder.getOuterPanel().add(CreditsPanel.getCreditsPanel(), BorderLayout.CENTER);
|
||||||
|
|
||||||
|
Logger.write("show credits");
|
||||||
|
} else if(gameExists == 2) {
|
||||||
|
Logger.write("cant show credits while game is running");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user