diff --git a/HeatUp/src/de/heatup/resources/fonts/emulogic.ttf b/HeatUp/src/de/heatup/resources/fonts/emulogic.ttf new file mode 100644 index 0000000..99b620c Binary files /dev/null and b/HeatUp/src/de/heatup/resources/fonts/emulogic.ttf differ diff --git a/HeatUp/src/de/heatup/ui/StatusPanelAdder.java b/HeatUp/src/de/heatup/ui/StatusPanelAdder.java index 4978a94..a78d0d0 100644 --- a/HeatUp/src/de/heatup/ui/StatusPanelAdder.java +++ b/HeatUp/src/de/heatup/ui/StatusPanelAdder.java @@ -4,14 +4,12 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.FlowLayout; import java.awt.Font; - +import java.io.File; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JProgressBar; - import de.heatup.logging.Logger; import de.heatup.ui.statusPanel.Score; -import de.heatup.ui.statusPanel.Temperature; import de.heatup.ui.statusPanel.Timer; @@ -35,6 +33,28 @@ public class StatusPanelAdder{ private static JLabel powerUpLabel = new JLabel(/*new ImageIcon("path_to_image.png")*/"powerUpLabel"); private static JLabel labelTime=new JLabel("Time"); private static JLabel timeLabel = new JLabel("123456789"); + private static Font emulogicheading; + private static Font emulogictext; + private static Font ttfBase; + + private static Font implementFont(){ + String fontFileName = "emulogic.ttf"; + File ttf= new File("src/de/heatup/resources/fonts/" + fontFileName); + + try { + ttfBase = Font.createFont(Font.TRUETYPE_FONT, ttf); + + }catch (Exception ex) { + ex.printStackTrace(); + System.err.println(ttf.getAbsolutePath()); + } + Logger.write("Font implemented"); + return ttfBase; + } + + + + public static void raiseMod(){ if (modifier==-1){ @@ -84,12 +104,14 @@ public class StatusPanelAdder{ } } - + if (temping!=0){ + Logger.write("Temperatur: " + tempBar.getValue()); + } if (tempBar.getValue()<=30 && modifier==-1) { } else { tempBar.setValue(tempBar.getValue()+temping); } - Logger.write("Temperatur: " + tempBar.getValue()); + } @@ -99,52 +121,46 @@ public class StatusPanelAdder{ public static void createPanel(){ - - labelTemp.setFont(new Font("emulogic", Font.CENTER_BASELINE, 16)); + implementFont(); + emulogicheading = ttfBase.deriveFont(Font.PLAIN, 16); + emulogictext= ttfBase.deriveFont(Font.PLAIN, 12); + JPanel tempPanel=new JPanel(); + labelTemp.setFont(emulogicheading); labelTemp.setForeground(Color.YELLOW); tempBar= new JProgressBar(30,200); tempBar.setValue(45); - - JPanel tempPanel=new JPanel(); tempPanel.setLayout(new BorderLayout(0,vgap)); tempPanel.add(labelTemp, BorderLayout.NORTH); tempPanel.add(tempBar, BorderLayout.SOUTH); tempPanel.setBackground(Color.BLACK); + - - - labelScore.setFont(new Font("emulogic", Font.CENTER_BASELINE, 16)); - labelScore.setForeground(Color.YELLOW); - - scoreLabel.setFont(new Font("emulogic", Font.CENTER_BASELINE, 12)); - scoreLabel.setForeground(Color.YELLOW); JPanel scorePanel=new JPanel(); + labelScore.setFont(emulogicheading); + labelScore.setForeground(Color.YELLOW); + scoreLabel.setFont(emulogictext); + scoreLabel.setForeground(Color.YELLOW); scorePanel.setLayout(new BorderLayout(0,vgap)); scorePanel.add(labelScore, BorderLayout.NORTH); scorePanel.add(scoreLabel, BorderLayout.SOUTH); scorePanel.setBackground(Color.BLACK); - - labelPowerUp.setFont(new Font("emulogic", Font.CENTER_BASELINE, 16)); - labelPowerUp.setForeground(Color.YELLOW); - - powerUpLabel.setFont(new Font("emulogic", Font.CENTER_BASELINE, 12)); - powerUpLabel.setForeground(Color.YELLOW); - JPanel powerUpPanel=new JPanel(); + labelPowerUp.setFont(emulogicheading); + labelPowerUp.setForeground(Color.YELLOW); + powerUpLabel.setFont(emulogictext); + powerUpLabel.setForeground(Color.YELLOW); powerUpPanel.setLayout(new BorderLayout(0,vgap)); powerUpPanel.add(labelPowerUp, BorderLayout.NORTH); powerUpPanel.add(powerUpLabel, BorderLayout.SOUTH); powerUpPanel.setBackground(Color.BLACK); - - - labelTime.setFont(new Font("emulogic", Font.CENTER_BASELINE, 16)); + JPanel timePanel=new JPanel(); + labelTime.setFont(emulogicheading); labelTime.setSize(100,10); labelTime.setForeground(Color.YELLOW); - timeLabel.setFont(new Font("emulogic", Font.CENTER_BASELINE, 12)); + timeLabel.setFont(emulogictext); timeLabel.setForeground(Color.YELLOW); - JPanel timePanel=new JPanel(); timePanel.setLayout(new BorderLayout(0,vgap)); timePanel.add(labelTime, BorderLayout.NORTH); timePanel.add(timeLabel, BorderLayout.SOUTH); diff --git a/HeatUp/src/de/heatup/ui/statusPanel/Score.java b/HeatUp/src/de/heatup/ui/statusPanel/Score.java index d43b472..2d9a2ba 100644 --- a/HeatUp/src/de/heatup/ui/statusPanel/Score.java +++ b/HeatUp/src/de/heatup/ui/statusPanel/Score.java @@ -10,6 +10,11 @@ public class Score { public int getScore(){ return score; } + public String getScoreS(){ + int score=getScore(); + Integer string= new Integer(score); + return string.toString(); + } //resets score public void resetScore(){ score=0; diff --git a/HeatUp/src/de/heatup/ui/statusPanel/Temperature.java b/HeatUp/src/de/heatup/ui/statusPanel/Temperature.java index b8d5078..cea501f 100644 --- a/HeatUp/src/de/heatup/ui/statusPanel/Temperature.java +++ b/HeatUp/src/de/heatup/ui/statusPanel/Temperature.java @@ -17,31 +17,34 @@ public class Temperature { public int getTemp(){ return valtemp; } + public void setTemp(int a){ + valtemp=a; + } /* * raiseTemp * return true, gameplay goes on * return false, heatup done */ - public boolean raiseTemp(int additional){ + /*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){ + /*public boolean reduceTemp(int reduce){ valtemp-=reduce; if (valtemp