Anpassungen Fullscreen auskommentiert.

This commit is contained in:
andreas
2014-11-04 12:01:25 +01:00
parent 24ac9f03b9
commit 57f36ea7a8
2 changed files with 17 additions and 15 deletions
+14 -12
View File
@@ -10,6 +10,8 @@ import java.io.IOException;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import javax.swing.JComponent; import javax.swing.JComponent;
import de.heatup.cfg.Config;
/* /*
* Draft for static objects * Draft for static objects
*/ */
@@ -30,19 +32,19 @@ public class StaticObject extends JComponent {
private int staticObjectHeight; private int staticObjectHeight;
public StaticObject(char staticObjectType, Point location, int staticObjectWidth, 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.staticObjectType = staticObjectType;
this.location = location; this.location = location;
this.staticObjectWidth = staticObjectWidth; this.staticObjectWidth = staticObjectWidth;
this.staticObjectHeight = staticObjectHeight; this.staticObjectHeight = staticObjectHeight;
loadBufferedImage(); loadBufferedImage();
setAutoBounds(location.x, location.y); setAutoBounds(location.x, location.y);
autoRescale(); // autoRescale();
// System.out.println(getDebugInfo()); // System.out.println(getDebugInfo());
} }
public StaticObject(char staticObjectType, Point location) { public StaticObject(char staticObjectType, Point location) {
this(staticObjectType, location, 25, 25); this(staticObjectType, location, Config.singleTilePixels, Config.singleTilePixels);
} }
public void paintComponent(Graphics g) { public void paintComponent(Graphics g) {
@@ -55,10 +57,10 @@ public class StaticObject extends JComponent {
//g2d.rotate(0.2, 10, 10); //g2d.rotate(0.2, 10, 10);
// TODO: Check if we can store a rescaled image in bf1??? // TODO: Check if we can store a rescaled image in bf1???
if ( doRescale ) { // if ( doRescale ) {
//System.out.println("hit"); // System.out.println("Hit: " + rescaleFactorX + " " + rescaleFactorY);
g2d.scale(rescaleFactorX, rescaleFactorY); // g2d.scale(rescaleFactorX, rescaleFactorY);
} // }
g2d.drawImage(bf1, 0, 0, this); g2d.drawImage(bf1, 0, 0, this);
g2d.finalize(); g2d.finalize();
@@ -77,12 +79,12 @@ public class StaticObject extends JComponent {
// Calculate factor new/original // Calculate factor new/original
// Rescale image using factor // Rescale image using factor
// Save new bf in bf1 ??? // Save new bf in bf1 ???
this.rescaleFactorX = this.staticObjectWidth / this.bf1.getWidth(); this.rescaleFactorX = (double)this.staticObjectWidth / (double)this.bf1.getWidth();
this.rescaleFactorY = this.staticObjectHeight / this.bf1.getHeight(); 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; this.doRescale = true;
} }
@@ -105,7 +107,7 @@ public class StaticObject extends JComponent {
} }
public String getDebugInfo() { 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; return info;
} }
} }
+1 -1
View File
@@ -26,7 +26,7 @@ public class GameLoop {
//dynO3.setRescale(1.5,3.5); //dynO3.setRescale(1.5,3.5);
Config.setGamePanelWidth(850); // Config.setGamePanelWidth(900);
MapEngine me = new MapEngine(1); MapEngine me = new MapEngine(1);
for (StaticObject currentStaticObject : me.getAllMapObjects()) { for (StaticObject currentStaticObject : me.getAllMapObjects()) {
GameInterface.getGamePanel().add(currentStaticObject); GameInterface.getGamePanel().add(currentStaticObject);