mirror of
https://github.com/jokerx3/HeatUp
synced 2026-07-27 10:19:46 +02:00
Anpassungen Fullscreen auskommentiert.
This commit is contained in:
@@ -10,6 +10,8 @@ import java.io.IOException;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.JComponent;
|
||||
|
||||
import de.heatup.cfg.Config;
|
||||
|
||||
/*
|
||||
* Draft for static objects
|
||||
*/
|
||||
@@ -30,19 +32,19 @@ public class StaticObject extends JComponent {
|
||||
private int staticObjectHeight;
|
||||
|
||||
public StaticObject(char staticObjectType, Point location, int staticObjectWidth, int staticObjectHeight) {
|
||||
System.out.println("Object Type: " + staticObjectType + "\t" +staticObjectHeight + " h:w " + staticObjectWidth);
|
||||
// System.out.println("Object Type: " + staticObjectType + "\t" +staticObjectHeight + " h:w " + staticObjectWidth);
|
||||
this.staticObjectType = staticObjectType;
|
||||
this.location = location;
|
||||
this.staticObjectWidth = staticObjectWidth;
|
||||
this.staticObjectHeight = staticObjectHeight;
|
||||
loadBufferedImage();
|
||||
setAutoBounds(location.x, location.y);
|
||||
autoRescale();
|
||||
// autoRescale();
|
||||
// System.out.println(getDebugInfo());
|
||||
}
|
||||
|
||||
public StaticObject(char staticObjectType, Point location) {
|
||||
this(staticObjectType, location, 25, 25);
|
||||
this(staticObjectType, location, Config.singleTilePixels, Config.singleTilePixels);
|
||||
}
|
||||
|
||||
public void paintComponent(Graphics g) {
|
||||
@@ -55,10 +57,10 @@ public class StaticObject extends JComponent {
|
||||
//g2d.rotate(0.2, 10, 10);
|
||||
|
||||
// TODO: Check if we can store a rescaled image in bf1???
|
||||
if ( doRescale ) {
|
||||
//System.out.println("hit");
|
||||
g2d.scale(rescaleFactorX, rescaleFactorY);
|
||||
}
|
||||
// if ( doRescale ) {
|
||||
// System.out.println("Hit: " + rescaleFactorX + " " + rescaleFactorY);
|
||||
// g2d.scale(rescaleFactorX, rescaleFactorY);
|
||||
// }
|
||||
|
||||
g2d.drawImage(bf1, 0, 0, this);
|
||||
g2d.finalize();
|
||||
@@ -77,12 +79,12 @@ public class StaticObject extends JComponent {
|
||||
// Calculate factor new/original
|
||||
// Rescale image using factor
|
||||
// Save new bf in bf1 ???
|
||||
this.rescaleFactorX = this.staticObjectWidth / this.bf1.getWidth();
|
||||
this.rescaleFactorY = this.staticObjectHeight / this.bf1.getHeight();
|
||||
this.rescaleFactorX = (double)this.staticObjectWidth / (double)this.bf1.getWidth();
|
||||
this.rescaleFactorY = (double)this.staticObjectHeight / (double)this.bf1.getHeight();
|
||||
|
||||
System.out.println("Object: " + this.staticObjectType + "\tBuffered Image: Height: " + this.bf1.getHeight() + "\t Width: " + this.bf1.getWidth() + "\tStatic Object: Height: " + this.staticObjectHeight + "\t Width: " + this.staticObjectWidth);
|
||||
//System.out.println("Object: " + this.staticObjectType + "\tBuffered Image: Height: " + this.bf1.getHeight() + "\t Width: " + this.bf1.getWidth() + "\tStatic Object: Height: " + this.staticObjectHeight + "\t Width: " + this.staticObjectWidth);
|
||||
|
||||
if (this.rescaleFactorX != 1 && this.rescaleFactorY != 1 ) {
|
||||
if (this.rescaleFactorX != 1 || this.rescaleFactorY != 1 ) {
|
||||
this.doRescale = true;
|
||||
}
|
||||
|
||||
@@ -105,7 +107,7 @@ public class StaticObject extends JComponent {
|
||||
}
|
||||
|
||||
public String getDebugInfo() {
|
||||
String info = "Debug: " + "Rescale? " + this.doRescale + "\tScale X:" + this.rescaleFactorX + "\tScale Y: " + this.rescaleFactorY + "\tH: " + this.staticObjectHeight + "\tW: " + this.staticObjectWidth + "\tStaticObjectType: " + this.staticObjectType + "\tX : " + this.location.x + "\tY :" + this.location.y;
|
||||
String info = "Debug: " + "Rescale? " + this.doRescale + "\tScale X:" + this.rescaleFactorX + "\tScale Y: " + this.rescaleFactorY + "\tsH: " + this.staticObjectHeight + "\tsW: " + this.staticObjectWidth + "\tStaticObjectType: " + this.staticObjectType + "\tbW : " + this.bf1.getWidth() + "\tbH :" + this.bf1.getHeight();
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class GameLoop {
|
||||
|
||||
//dynO3.setRescale(1.5,3.5);
|
||||
|
||||
Config.setGamePanelWidth(850);
|
||||
// Config.setGamePanelWidth(900);
|
||||
MapEngine me = new MapEngine(1);
|
||||
for (StaticObject currentStaticObject : me.getAllMapObjects()) {
|
||||
GameInterface.getGamePanel().add(currentStaticObject);
|
||||
|
||||
Reference in New Issue
Block a user