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.ActionWatcher;
|
||||
import de.heatup.ui.actionPanel.HardewareManipulate;
|
||||
import de.heatup.ui.menu.MenuPanel;
|
||||
|
||||
public class KeyBindings extends KeyAdapter {
|
||||
final private static int progressBarTimer = 7;
|
||||
@@ -44,8 +45,17 @@ public class KeyBindings extends KeyAdapter {
|
||||
case KeyEvent.VK_ESCAPE:
|
||||
if ( esc ) {
|
||||
esc = false;
|
||||
MenuPanel.setStartGameLabel("[ Spiel Starten ]");
|
||||
MenuPanel.setShowCreditsLabel("[ Credits anzeigen ]");
|
||||
MenuPanel.setShowTutorialLabel("[ Credits anzeigen ]");
|
||||
MenuPanel.setShowHighscoreLabel("[ Highscore anzeigen ]");
|
||||
|
||||
} else {
|
||||
esc = true;
|
||||
MenuPanel.setStartGameLabel(" weiter mit >>ESC<< ");
|
||||
MenuPanel.setShowCreditsLabel("");
|
||||
MenuPanel.setShowTutorialLabel("");
|
||||
MenuPanel.setShowHighscoreLabel("");
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_A:
|
||||
|
||||
@@ -26,6 +26,7 @@ import de.heatup.objects.StaticObject;
|
||||
import de.heatup.timers.HardwareResetTimers;
|
||||
import de.heatup.ui.actionPanel.ActionControl;
|
||||
import de.heatup.ui.actionPanel.ActionWatcher;
|
||||
import de.heatup.ui.menu.CreditsPanel;
|
||||
import de.heatup.ui.menu.MenuPanel;
|
||||
|
||||
|
||||
@@ -51,6 +52,8 @@ public class Main extends JFrame implements Runnable {
|
||||
private static JPanel leftPanel;
|
||||
private static JPanel rightPanel;
|
||||
private static JPanel actionPanel;
|
||||
private static JPanel creditsPanel;
|
||||
|
||||
|
||||
private static JPanel menuPanel;
|
||||
|
||||
@@ -101,11 +104,15 @@ public class Main extends JFrame implements Runnable {
|
||||
MenuPanel.setMenuPanel();
|
||||
menuPanel = MenuPanel.getMenuPanel();
|
||||
|
||||
CreditsPanel.setCreditsPanel();
|
||||
creditsPanel = CreditsPanel.getCreditsPanel();
|
||||
|
||||
outerPanel.add(statusPanel,BorderLayout.NORTH);
|
||||
outerPanel.add(leftPanel, BorderLayout.WEST);
|
||||
outerPanel.add(rightPanel, BorderLayout.EAST);
|
||||
outerPanel.add(gamePanel,BorderLayout.CENTER);
|
||||
outerPanel.add(actionPanel,BorderLayout.SOUTH);
|
||||
outerPanel.add(creditsPanel, BorderLayout.CENTER);
|
||||
outerPanel.add(menuPanel, BorderLayout.CENTER);
|
||||
|
||||
add(outerPanel);
|
||||
@@ -121,7 +128,6 @@ public class Main extends JFrame implements Runnable {
|
||||
PanelBuilder.actionPanel.setBackground(Color.BLACK);
|
||||
PanelBuilder.statusPanel.setBackground(Color.BLACK);
|
||||
|
||||
|
||||
/*
|
||||
* 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) {
|
||||
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
package de.heatup.ui.menu;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import de.heatup.logging.Logger;
|
||||
import de.heatup.ui.FontLoader;
|
||||
import de.heatup.ui.PanelBuilder;
|
||||
|
||||
public class CreditsPanel {
|
||||
|
||||
@@ -19,11 +24,12 @@ public class CreditsPanel {
|
||||
private static Font emulogic;
|
||||
private static Font emulogicHeadline;
|
||||
private static Font emulogicDivider;
|
||||
private static Font emulogicSmall;
|
||||
private static Font ttfbase;
|
||||
|
||||
// panels and labels
|
||||
private static JPanel headline, divider, divider2, name1, name2, name3, name4, name5;
|
||||
private static JLabel headlineLabel, dividerLabel, dividerLabel2, name1Label, name2Label, name3Label, name4Label, name5Label;
|
||||
private static JPanel headline, divider, divider2, name1, name2, name3, name4, name5, exit;
|
||||
private static JLabel headlineLabel, dividerLabel, dividerLabel2, name1Label, name2Label, name3Label, name4Label, name5Label, exitLabel;
|
||||
|
||||
public CreditsPanel() { }
|
||||
|
||||
@@ -36,6 +42,7 @@ public class CreditsPanel {
|
||||
emulogicHeadline = ttfbase.deriveFont(Font.PLAIN, 28);
|
||||
emulogic = ttfbase.deriveFont(Font.PLAIN, 12);
|
||||
emulogicDivider = ttfbase.deriveFont(Font.PLAIN, 20);
|
||||
emulogicSmall = ttfbase.deriveFont(Font.PLAIN, 10);
|
||||
|
||||
createCredits();
|
||||
}
|
||||
@@ -106,6 +113,26 @@ public class CreditsPanel {
|
||||
name5Label.setFont(emulogic);
|
||||
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);
|
||||
@@ -116,10 +143,11 @@ public class CreditsPanel {
|
||||
credits.add(name4);
|
||||
credits.add(name5);
|
||||
credits.add(divider2);
|
||||
credits.add(exit);
|
||||
}
|
||||
|
||||
public static JPanel getCreditsPanel() {
|
||||
credits.setVisible(false);
|
||||
credits.setVisible(true);
|
||||
return credits;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,10 @@ import java.awt.event.MouseEvent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import sun.security.util.PendingException;
|
||||
import de.heatup.logging.Logger;
|
||||
import de.heatup.ui.FontLoader;
|
||||
import de.heatup.ui.KeyBindings;
|
||||
import de.heatup.ui.Main;
|
||||
import de.heatup.ui.PanelBuilder;
|
||||
import de.heatup.ui.StatusPanelAdder;
|
||||
@@ -38,6 +40,26 @@ public class MenuPanel {
|
||||
/** 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() {
|
||||
|
||||
menuPanel.setPreferredSize(new Dimension(800,600));
|
||||
@@ -71,15 +93,15 @@ public class MenuPanel {
|
||||
start = new JPanel();
|
||||
start.setBackground(Color.BLACK);
|
||||
|
||||
startGame = new JLabel("[ Spiel starten ]");
|
||||
startGame = new JLabel();
|
||||
startGame.setText("[ Spiel starten ]");
|
||||
startGame.setForeground(Color.YELLOW);
|
||||
startGame.setFont(emulogic);
|
||||
|
||||
startGame.addMouseListener(new MouseAdapter() {
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
// @TODO: implement start game
|
||||
if(gameExists == 1) {
|
||||
|
||||
// just a trie
|
||||
// StatusPanel bauen
|
||||
StatusPanelAdder.setPanel(PanelBuilder.statusPanel);
|
||||
StatusPanelAdder.createPanel();
|
||||
@@ -95,13 +117,15 @@ public class MenuPanel {
|
||||
|
||||
PanelBuilder.getOuterPanel().add(PanelBuilder.getGamePanel(),BorderLayout.CENTER);
|
||||
|
||||
// PanelBuilder.getGamePanel().setSize(800, 600);
|
||||
// PanelBuilder.getGamePanel().setVisible(true);
|
||||
|
||||
|
||||
//** game, action, status panel redraw and check visibility */
|
||||
|
||||
Logger.write("Game Started via menu");
|
||||
} else if (gameExists == 2) {
|
||||
if(Main.getPause()) {
|
||||
|
||||
}
|
||||
Logger.write("game already started");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -121,8 +145,7 @@ public class MenuPanel {
|
||||
|
||||
endGame.addMouseListener(new MouseAdapter() {
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
// @TODO: implement end game
|
||||
Logger.write("game ended");
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -163,10 +186,16 @@ public class MenuPanel {
|
||||
|
||||
showCredits.addMouseListener(new MouseAdapter() {
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
// @TODO: implement 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