mirror of
https://github.com/jokerx3/HeatUp
synced 2026-07-27 11:29:46 +02:00
Schrift emulogic implementiert und eingeführt
This commit is contained in:
Binary file not shown.
@@ -4,14 +4,12 @@ import java.awt.BorderLayout;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.FlowLayout;
|
import java.awt.FlowLayout;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
|
import java.io.File;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JProgressBar;
|
import javax.swing.JProgressBar;
|
||||||
|
|
||||||
import de.heatup.logging.Logger;
|
import de.heatup.logging.Logger;
|
||||||
import de.heatup.ui.statusPanel.Score;
|
import de.heatup.ui.statusPanel.Score;
|
||||||
import de.heatup.ui.statusPanel.Temperature;
|
|
||||||
import de.heatup.ui.statusPanel.Timer;
|
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 powerUpLabel = new JLabel(/*new ImageIcon("path_to_image.png")*/"powerUpLabel");
|
||||||
private static JLabel labelTime=new JLabel("Time");
|
private static JLabel labelTime=new JLabel("Time");
|
||||||
private static JLabel timeLabel = new JLabel("123456789");
|
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(){
|
public static void raiseMod(){
|
||||||
if (modifier==-1){
|
if (modifier==-1){
|
||||||
@@ -84,12 +104,14 @@ public class StatusPanelAdder{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (temping!=0){
|
||||||
|
Logger.write("Temperatur: " + tempBar.getValue());
|
||||||
|
}
|
||||||
if (tempBar.getValue()<=30 && modifier==-1) {
|
if (tempBar.getValue()<=30 && modifier==-1) {
|
||||||
} else {
|
} else {
|
||||||
tempBar.setValue(tempBar.getValue()+temping);
|
tempBar.setValue(tempBar.getValue()+temping);
|
||||||
}
|
}
|
||||||
Logger.write("Temperatur: " + tempBar.getValue());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -99,52 +121,46 @@ public class StatusPanelAdder{
|
|||||||
|
|
||||||
|
|
||||||
public static void createPanel(){
|
public static void createPanel(){
|
||||||
|
implementFont();
|
||||||
labelTemp.setFont(new Font("emulogic", Font.CENTER_BASELINE, 16));
|
emulogicheading = ttfBase.deriveFont(Font.PLAIN, 16);
|
||||||
|
emulogictext= ttfBase.deriveFont(Font.PLAIN, 12);
|
||||||
|
JPanel tempPanel=new JPanel();
|
||||||
|
labelTemp.setFont(emulogicheading);
|
||||||
labelTemp.setForeground(Color.YELLOW);
|
labelTemp.setForeground(Color.YELLOW);
|
||||||
tempBar= new JProgressBar(30,200);
|
tempBar= new JProgressBar(30,200);
|
||||||
tempBar.setValue(45);
|
tempBar.setValue(45);
|
||||||
|
|
||||||
JPanel tempPanel=new JPanel();
|
|
||||||
tempPanel.setLayout(new BorderLayout(0,vgap));
|
tempPanel.setLayout(new BorderLayout(0,vgap));
|
||||||
tempPanel.add(labelTemp, BorderLayout.NORTH);
|
tempPanel.add(labelTemp, BorderLayout.NORTH);
|
||||||
tempPanel.add(tempBar, BorderLayout.SOUTH);
|
tempPanel.add(tempBar, BorderLayout.SOUTH);
|
||||||
tempPanel.setBackground(Color.BLACK);
|
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();
|
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.setLayout(new BorderLayout(0,vgap));
|
||||||
scorePanel.add(labelScore, BorderLayout.NORTH);
|
scorePanel.add(labelScore, BorderLayout.NORTH);
|
||||||
scorePanel.add(scoreLabel, BorderLayout.SOUTH);
|
scorePanel.add(scoreLabel, BorderLayout.SOUTH);
|
||||||
scorePanel.setBackground(Color.BLACK);
|
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();
|
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.setLayout(new BorderLayout(0,vgap));
|
||||||
powerUpPanel.add(labelPowerUp, BorderLayout.NORTH);
|
powerUpPanel.add(labelPowerUp, BorderLayout.NORTH);
|
||||||
powerUpPanel.add(powerUpLabel, BorderLayout.SOUTH);
|
powerUpPanel.add(powerUpLabel, BorderLayout.SOUTH);
|
||||||
powerUpPanel.setBackground(Color.BLACK);
|
powerUpPanel.setBackground(Color.BLACK);
|
||||||
|
|
||||||
|
JPanel timePanel=new JPanel();
|
||||||
|
labelTime.setFont(emulogicheading);
|
||||||
labelTime.setFont(new Font("emulogic", Font.CENTER_BASELINE, 16));
|
|
||||||
labelTime.setSize(100,10);
|
labelTime.setSize(100,10);
|
||||||
labelTime.setForeground(Color.YELLOW);
|
labelTime.setForeground(Color.YELLOW);
|
||||||
timeLabel.setFont(new Font("emulogic", Font.CENTER_BASELINE, 12));
|
timeLabel.setFont(emulogictext);
|
||||||
timeLabel.setForeground(Color.YELLOW);
|
timeLabel.setForeground(Color.YELLOW);
|
||||||
JPanel timePanel=new JPanel();
|
|
||||||
timePanel.setLayout(new BorderLayout(0,vgap));
|
timePanel.setLayout(new BorderLayout(0,vgap));
|
||||||
timePanel.add(labelTime, BorderLayout.NORTH);
|
timePanel.add(labelTime, BorderLayout.NORTH);
|
||||||
timePanel.add(timeLabel, BorderLayout.SOUTH);
|
timePanel.add(timeLabel, BorderLayout.SOUTH);
|
||||||
|
|||||||
@@ -10,6 +10,11 @@ public class Score {
|
|||||||
public int getScore(){
|
public int getScore(){
|
||||||
return score;
|
return score;
|
||||||
}
|
}
|
||||||
|
public String getScoreS(){
|
||||||
|
int score=getScore();
|
||||||
|
Integer string= new Integer(score);
|
||||||
|
return string.toString();
|
||||||
|
}
|
||||||
//resets score
|
//resets score
|
||||||
public void resetScore(){
|
public void resetScore(){
|
||||||
score=0;
|
score=0;
|
||||||
|
|||||||
@@ -17,31 +17,34 @@ public class Temperature {
|
|||||||
public int getTemp(){
|
public int getTemp(){
|
||||||
return valtemp;
|
return valtemp;
|
||||||
}
|
}
|
||||||
|
public void setTemp(int a){
|
||||||
|
valtemp=a;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* raiseTemp
|
* raiseTemp
|
||||||
* return true, gameplay goes on
|
* return true, gameplay goes on
|
||||||
* return false, heatup done
|
* return false, heatup done
|
||||||
*/
|
*/
|
||||||
public boolean raiseTemp(int additional){
|
/*public boolean raiseTemp(int additional){
|
||||||
valtemp+=additional;
|
valtemp+=additional;
|
||||||
if(valtemp>max){
|
if(valtemp>max){
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/* reduceTemp
|
/* reduceTemp
|
||||||
* return true; gameplay goes on
|
* return true; gameplay goes on
|
||||||
* return false; game over, temperature too low
|
* return false; game over, temperature too low
|
||||||
*/
|
*/
|
||||||
public boolean reduceTemp(int reduce){
|
/*public boolean reduceTemp(int reduce){
|
||||||
valtemp-=reduce;
|
valtemp-=reduce;
|
||||||
if (valtemp<min){
|
if (valtemp<min){
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user