From 84e4ea98f07acb5f237ab254d3a979b7cf89ca48 Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Tue, 28 Oct 2014 20:32:39 +0100 Subject: [PATCH] =?UTF-8?q?Wechsel=20auf=20Graphics2D=20mit=20mehr=20Featu?= =?UTF-8?q?res=20f=C3=BCr=20sp=C3=A4ter.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../spacescooter/background/StarBackground.java | 4 ++-- src/de/teamteamteam/spacescooter/entity/Entity.java | 4 ++-- src/de/teamteamteam/spacescooter/entity/Paintable.java | 4 ++-- src/de/teamteamteam/spacescooter/gui/GameFrame.java | 6 +++--- .../teamteamteam/spacescooter/screen/GamePausedScreen.java | 4 ++-- src/de/teamteamteam/spacescooter/screen/GameScreen.java | 4 ++-- src/de/teamteamteam/spacescooter/screen/MainMenuScreen.java | 4 ++-- src/de/teamteamteam/spacescooter/screen/Screen.java | 6 +++--- src/de/teamteamteam/spacescooter/screen/SuperScreen.java | 4 ++-- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/de/teamteamteam/spacescooter/background/StarBackground.java b/src/de/teamteamteam/spacescooter/background/StarBackground.java index 0fa4cc6..f2541a9 100644 --- a/src/de/teamteamteam/spacescooter/background/StarBackground.java +++ b/src/de/teamteamteam/spacescooter/background/StarBackground.java @@ -1,6 +1,6 @@ package de.teamteamteam.spacescooter.background; -import java.awt.Graphics; +import java.awt.Graphics2D; import java.awt.image.BufferedImage; import java.io.IOException; @@ -35,7 +35,7 @@ public class StarBackground extends Background { } } - public void paint(Graphics g) { + public void paint(Graphics2D g) { g.drawImage(StarBackground.img, (0+this.offset), 0, null); g.drawImage(StarBackground.img, (StarBackground.img.getWidth()+this.offset), 0, null); } diff --git a/src/de/teamteamteam/spacescooter/entity/Entity.java b/src/de/teamteamteam/spacescooter/entity/Entity.java index 8e067ee..e8ba908 100644 --- a/src/de/teamteamteam/spacescooter/entity/Entity.java +++ b/src/de/teamteamteam/spacescooter/entity/Entity.java @@ -1,7 +1,7 @@ package de.teamteamteam.spacescooter.entity; import java.awt.Color; -import java.awt.Graphics; +import java.awt.Graphics2D; import java.awt.image.BufferedImage; import de.teamteamteam.spacescooter.utility.GameConfig; @@ -53,7 +53,7 @@ public abstract class Entity implements Updateable, Paintable { this.img = img; } - public void paint(Graphics g) { + public void paint(Graphics2D g) { //DEBUG ONLY if(GameConfig.DEBUG) { g.setColor(new Color(255,0,0)); diff --git a/src/de/teamteamteam/spacescooter/entity/Paintable.java b/src/de/teamteamteam/spacescooter/entity/Paintable.java index 5795edb..f7138f6 100644 --- a/src/de/teamteamteam/spacescooter/entity/Paintable.java +++ b/src/de/teamteamteam/spacescooter/entity/Paintable.java @@ -1,9 +1,9 @@ package de.teamteamteam.spacescooter.entity; -import java.awt.Graphics; +import java.awt.Graphics2D; public interface Paintable { - public void paint(Graphics g); + public void paint(Graphics2D g); } diff --git a/src/de/teamteamteam/spacescooter/gui/GameFrame.java b/src/de/teamteamteam/spacescooter/gui/GameFrame.java index e21da76..3b61a9f 100644 --- a/src/de/teamteamteam/spacescooter/gui/GameFrame.java +++ b/src/de/teamteamteam/spacescooter/gui/GameFrame.java @@ -1,6 +1,6 @@ package de.teamteamteam.spacescooter.gui; -import java.awt.Graphics; +import java.awt.Graphics2D; import java.awt.Toolkit; import java.awt.image.BufferStrategy; import javax.swing.JFrame; @@ -65,11 +65,11 @@ public class GameFrame extends JFrame { * @see http://content.gpwiki.org/index.php/Java:Tutorials:Double_Buffering for details. */ public void draw() { - Graphics bufferedGraphics = null; + Graphics2D bufferedGraphics = null; do { // while bufferStrategy.contentsLost() do { // bufferStrategy.contentsRestored() try { - bufferedGraphics = this.bufferStrategy.getDrawGraphics(); + bufferedGraphics = (Graphics2D) this.bufferStrategy.getDrawGraphics(); this.superScreen.doPaint(bufferedGraphics); diff --git a/src/de/teamteamteam/spacescooter/screen/GamePausedScreen.java b/src/de/teamteamteam/spacescooter/screen/GamePausedScreen.java index b9697a5..bab51b7 100644 --- a/src/de/teamteamteam/spacescooter/screen/GamePausedScreen.java +++ b/src/de/teamteamteam/spacescooter/screen/GamePausedScreen.java @@ -2,7 +2,7 @@ package de.teamteamteam.spacescooter.screen; import java.awt.Color; import java.awt.Font; -import java.awt.Graphics; +import java.awt.Graphics2D; import java.awt.event.KeyEvent; import de.teamteamteam.spacescooter.control.Keyboard; @@ -15,7 +15,7 @@ public class GamePausedScreen extends Screen { } @Override - protected void paint(Graphics g) { + protected void paint(Graphics2D g) { g.setColor(new Color(0,0,120)); g.fillRect(0, 0, GameConfig.windowWidth, GameConfig.windowHeight); g.setColor(new Color(255,255,255)); diff --git a/src/de/teamteamteam/spacescooter/screen/GameScreen.java b/src/de/teamteamteam/spacescooter/screen/GameScreen.java index 63f8dca..5479c1a 100644 --- a/src/de/teamteamteam/spacescooter/screen/GameScreen.java +++ b/src/de/teamteamteam/spacescooter/screen/GameScreen.java @@ -1,6 +1,6 @@ package de.teamteamteam.spacescooter.screen; -import java.awt.Graphics; +import java.awt.Graphics2D; import java.awt.event.KeyEvent; import java.util.Iterator; @@ -25,7 +25,7 @@ public class GameScreen extends Screen { } @Override - protected void paint(Graphics g) { + protected void paint(Graphics2D g) { LinkedList list = this.getEntities(); Iterator i = list.iterator(); while (i.hasNext()) { diff --git a/src/de/teamteamteam/spacescooter/screen/MainMenuScreen.java b/src/de/teamteamteam/spacescooter/screen/MainMenuScreen.java index 59119ee..217eea7 100644 --- a/src/de/teamteamteam/spacescooter/screen/MainMenuScreen.java +++ b/src/de/teamteamteam/spacescooter/screen/MainMenuScreen.java @@ -2,7 +2,7 @@ package de.teamteamteam.spacescooter.screen; import java.awt.Color; import java.awt.Font; -import java.awt.Graphics; +import java.awt.Graphics2D; import java.awt.event.KeyEvent; @@ -16,7 +16,7 @@ public class MainMenuScreen extends Screen { } @Override - public void paint(Graphics g) { + public void paint(Graphics2D g) { g.setColor(new Color(0,0,120)); g.fillRect(0, 0, GameConfig.windowWidth, GameConfig.windowHeight); g.setColor(new Color(255,255,255)); diff --git a/src/de/teamteamteam/spacescooter/screen/Screen.java b/src/de/teamteamteam/spacescooter/screen/Screen.java index f3d4123..56a7e88 100644 --- a/src/de/teamteamteam/spacescooter/screen/Screen.java +++ b/src/de/teamteamteam/spacescooter/screen/Screen.java @@ -1,6 +1,6 @@ package de.teamteamteam.spacescooter.screen; -import java.awt.Graphics; +import java.awt.Graphics2D; import java.util.LinkedList; import de.teamteamteam.spacescooter.entity.Entity; @@ -32,10 +32,10 @@ public abstract class Screen { return new LinkedList(this.entities); } - protected abstract void paint(Graphics g); + protected abstract void paint(Graphics2D g); protected abstract void update(); - public void doPaint(Graphics g) { + public void doPaint(Graphics2D g) { this.paint(g); if(this.overlay != null) this.overlay.doPaint(g); } diff --git a/src/de/teamteamteam/spacescooter/screen/SuperScreen.java b/src/de/teamteamteam/spacescooter/screen/SuperScreen.java index ecaa40e..c1c5468 100644 --- a/src/de/teamteamteam/spacescooter/screen/SuperScreen.java +++ b/src/de/teamteamteam/spacescooter/screen/SuperScreen.java @@ -1,6 +1,6 @@ package de.teamteamteam.spacescooter.screen; -import java.awt.Graphics; +import java.awt.Graphics2D; public class SuperScreen extends Screen { @@ -10,7 +10,7 @@ public class SuperScreen extends Screen { } @Override - public void paint(Graphics g) { + public void paint(Graphics2D g) { //nothing to paint, we're so meta meta. }