Only full screen on rpi & enabled AA
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package main;
|
||||
|
||||
import java.awt.GraphicsDevice;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
|
||||
@@ -48,6 +50,13 @@ public class Window extends JFrame {
|
||||
if(ON_RASP) //TODO REMOVE
|
||||
{
|
||||
led = new LedHandler();
|
||||
GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||
GraphicsDevice[] devices = graphicsEnvironment.getScreenDevices();
|
||||
if (!devices[0].isFullScreenSupported ())
|
||||
{
|
||||
throw new UnsupportedOperationException ("Fullscreen mode is unsupported.");
|
||||
}
|
||||
devices[0].setFullScreenWindow(this);
|
||||
}
|
||||
|
||||
ButtonHandler bth = new ButtonHandler(led);
|
||||
|
||||
+7
-2
@@ -3,6 +3,7 @@ package view;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
@@ -27,7 +28,7 @@ public class GameView extends JPanel implements ActionListener{
|
||||
{
|
||||
this.led=led;
|
||||
this.gsm = gsm;
|
||||
t = new Timer(1000/30, this);
|
||||
t = new Timer(1000/60, this);
|
||||
t.start();
|
||||
setPreferredSize(new Dimension(1280,1024));
|
||||
}
|
||||
@@ -40,8 +41,12 @@ public class GameView extends JPanel implements ActionListener{
|
||||
public void paintComponent(Graphics g)
|
||||
{
|
||||
super.paintComponent(g);
|
||||
Graphics2D g2d = (Graphics2D) g;
|
||||
|
||||
Graphics2D g2d = (Graphics2D) g;
|
||||
RenderingHints rh = new RenderingHints(
|
||||
RenderingHints.KEY_ANTIALIASING,
|
||||
RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
g2d.setRenderingHints(rh);
|
||||
gsm.currentState.draw(g2d);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user