A lot of improvements for the RPI. Uses images cached on the gpu.
This commit is contained in:
@@ -6,7 +6,8 @@ import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.Transparency;
|
||||
import java.awt.image.VolatileImage;
|
||||
|
||||
import model.gameState.PlayState;
|
||||
|
||||
@@ -16,7 +17,7 @@ public class InfoPanel {
|
||||
private int lifePercent;
|
||||
private int upgradeScore = 0;
|
||||
private int x, y;
|
||||
private BufferedImage infoPanel;
|
||||
private VolatileImage infoPanel;
|
||||
|
||||
public InfoPanel(int x, int y){
|
||||
this.x = x;
|
||||
@@ -40,7 +41,7 @@ public class InfoPanel {
|
||||
}
|
||||
|
||||
private void generateInfoPanel(){
|
||||
infoPanel = new BufferedImage(1280, 1024, BufferedImage.TYPE_INT_ARGB);
|
||||
infoPanel = Images.initVolatileImage(256, 1024, Transparency.OPAQUE);
|
||||
Graphics2D g2 = infoPanel.createGraphics();
|
||||
RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
g2.setRenderingHints(rh);
|
||||
@@ -57,11 +58,11 @@ public class InfoPanel {
|
||||
|
||||
g2.setColor(Color.YELLOW);
|
||||
g2.fillRect(25, 1000 - 7 * upgradeScore, 200, 0 + 7 * upgradeScore);
|
||||
g2.dispose();
|
||||
infoPanel.createGraphics();
|
||||
infoPanel = Images.toCompatibleImage(infoPanel);
|
||||
}
|
||||
|
||||
public void draw(Graphics2D g2){
|
||||
g2.drawImage(infoPanel, 0, 0, 1280,1024,null);
|
||||
g2.drawImage(infoPanel, 0, 0, 256,1024,null);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user