Wechsel auf Graphics2D mit mehr Features für später.
This commit is contained in:
parent
04e2bcb3f2
commit
84e4ea98f0
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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<Entity> list = this.getEntities();
|
||||
Iterator<Entity> i = list.iterator();
|
||||
while (i.hasNext()) {
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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<Entity>(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);
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue