diff --git a/HeatUp/src/de/heatup/ui/StatusPanelAdder.java b/HeatUp/src/de/heatup/ui/StatusPanelAdder.java new file mode 100644 index 0000000..245efce --- /dev/null +++ b/HeatUp/src/de/heatup/ui/StatusPanelAdder.java @@ -0,0 +1,65 @@ +package de.heatup.ui; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.FlowLayout; + +import javax.swing.ImageIcon; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.SwingConstants; +import javax.swing.border.LineBorder; + +import de.heatup.ui.statusPanel.Score; +import de.heatup.ui.statusPanel.Temperature; +import de.heatup.ui.statusPanel.Timer; + + +public class StatusPanelAdder{ + Temperature temp; + Score score; + Timer timer; + + public int getTemp(){ + return temp.getTemp(); + } + public int getScore(){ + return score.getScore(); + } + public double getTime(){ + return timer.getTime(); + } + + public static void createPanel(){ + JProgressBar tempbar= new JProgressBar(30,90); + tempbar.setValue(45); + //tempbar.setSize(new Dimension(200,50)); + + JLabel scoreLabel= new JLabel("new Score Label"); + scoreLabel.setBorder(new LineBorder(Color.BLACK, 2)); + //scoreLabel.setSize(new Dimension(100,50)); + + JLabel powerUpLabel = new JLabel(/*new ImageIcon("path_to_image.png")*/"powerUpLabel"); + powerUpLabel.setBorder(new LineBorder(Color.BLACK, 1)); + //powerUpLabel.setSize(new Dimension(200,50)); + + JLabel timeLabel = new JLabel(); + timeLabel.setBorder(new LineBorder(Color.BLACK, 2)); + timeLabel.setText("0"); + //timeLabel.setSize(new Dimension(300,24)); //Groesse, + timeLabel.setHorizontalAlignment(SwingConstants.CENTER ); + + + + GameInterface.getStatusPanel().add(timeLabel); + GameInterface.getStatusPanel().add(tempbar); + GameInterface.getStatusPanel().add(scoreLabel); + GameInterface.getStatusPanel().add(powerUpLabel); + } + private static void getStatusPanel(){ + GameInterface.getStatusPanel(); + } +} + diff --git a/HeatUp/src/de/heatup/ui/statusPanel/Score.java b/HeatUp/src/de/heatup/ui/statusPanel/Score.java new file mode 100644 index 0000000..d43b472 --- /dev/null +++ b/HeatUp/src/de/heatup/ui/statusPanel/Score.java @@ -0,0 +1,30 @@ +package de.heatup.ui.statusPanel; + + +public class Score { + private int score; + public Score(){ + score=0; + } + //returns score + public int getScore(){ + return score; + } + //resets score + public void resetScore(){ + score=0; + } + //raises score + public void raiseScore(int additional){ + score+=additional; + } + //reduces score; when score<0, score=0; + public void reduceScore(int reduce){ + score-=reduce; + //when score less than 0 + if (score<0){ + score=0; + } + } + +} diff --git a/HeatUp/src/de/heatup/ui/statusPanel/Temperature.java b/HeatUp/src/de/heatup/ui/statusPanel/Temperature.java new file mode 100644 index 0000000..b8d5078 --- /dev/null +++ b/HeatUp/src/de/heatup/ui/statusPanel/Temperature.java @@ -0,0 +1,47 @@ +package de.heatup.ui.statusPanel; + + +public class Temperature { + private int min; + private int max; + private int valtemp; + + //ggf. f�r Schwierigkeitsgerade min und max zu ver�ndern und startwert!? + public Temperature(int gmin, int gmax, int gtemp){ + this.min=gmin; + this.max=gmax; + this.valtemp=gtemp; + } + + //returns temp + public int getTemp(){ + return valtemp; + } + /* + * raiseTemp + * return true, gameplay goes on + * return false, heatup done + */ + public boolean raiseTemp(int additional){ + valtemp+=additional; + if(valtemp>max){ + return false; + } else { + return true; + } + } + + /* reduceTemp + * return true; gameplay goes on + * return false; game over, temperature too low + */ + public boolean reduceTemp(int reduce){ + valtemp-=reduce; + if (valtemp