From 57f36ea7a8abdfd35f2d986f89d4ebbeeb95e630 Mon Sep 17 00:00:00 2001 From: andreas Date: Tue, 4 Nov 2014 12:01:25 +0100 Subject: [PATCH] Anpassungen Fullscreen auskommentiert. --- .../src/de/heatup/objects/StaticObject.java | 30 ++++++++++--------- HeatUp/src/de/heatup/testing/GameLoop.java | 2 +- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/HeatUp/src/de/heatup/objects/StaticObject.java b/HeatUp/src/de/heatup/objects/StaticObject.java index 0a31fac..af63843 100644 --- a/HeatUp/src/de/heatup/objects/StaticObject.java +++ b/HeatUp/src/de/heatup/objects/StaticObject.java @@ -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,21 +32,21 @@ 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(); - //System.out.println(getDebugInfo()); +// 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) { this.g2d = (Graphics2D)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; } } diff --git a/HeatUp/src/de/heatup/testing/GameLoop.java b/HeatUp/src/de/heatup/testing/GameLoop.java index cfa93b5..c7d1ac9 100644 --- a/HeatUp/src/de/heatup/testing/GameLoop.java +++ b/HeatUp/src/de/heatup/testing/GameLoop.java @@ -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);