diff --git a/HeatUp/src/de/heatup/testing/GameLoopD.java b/HeatUp/src/de/heatup/testing/GameLoopD.java index 763f26f..b9d3857 100644 --- a/HeatUp/src/de/heatup/testing/GameLoopD.java +++ b/HeatUp/src/de/heatup/testing/GameLoopD.java @@ -1,8 +1,12 @@ package de.heatup.testing; import java.awt.BorderLayout; +import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; import java.awt.GridLayout; import java.awt.Point; @@ -29,6 +33,7 @@ public class GameLoopD extends JFrame implements Runnable { private boolean running = false; private static boolean pause = false; + private boolean fullscreen = true; private Thread thread; @@ -41,18 +46,25 @@ public class GameLoopD extends JFrame implements Runnable { private static JPanel outerPanel; private static JPanel statusPanel; private static JPanel gamePanel; + private static JPanel leftPanel; + private static JPanel rightPanel; private static JPanel actionPanel; public GameLoopD(){ setTitle("HeatUP!"); setDefaultCloseOperation(EXIT_ON_CLOSE); setResizable(false); - + + // For fullscreen + if ( fullscreen) { + setResizable(false); + setUndecorated(true); + } outerPanel = new JPanel(); outerPanel.setLayout(new BorderLayout()); outerPanel.setFocusable(false); - + statusPanel = new JPanel(); statusPanel.setPreferredSize(new Dimension(800,80)); statusPanel.setFocusable(true); @@ -61,13 +73,24 @@ public class GameLoopD extends JFrame implements Runnable { gamePanel.setLayout(null); gamePanel.setPreferredSize(new Dimension(800,600)); gamePanel.setFocusable(false); + gamePanel.setBackground(Color.black); actionPanel = new JPanel(); actionPanel.setLayout(new GridLayout(1,1)); actionPanel.setPreferredSize(new Dimension(800,80)); actionPanel.setFocusable(true); + leftPanel = new JPanel(); + leftPanel.setLayout(null); + leftPanel.setBackground(Color.black); + + rightPanel = new JPanel(); + rightPanel.setLayout(null); + rightPanel.setBackground(Color.black); + outerPanel.add(statusPanel,BorderLayout.NORTH); + outerPanel.add(leftPanel, BorderLayout.WEST); + outerPanel.add(rightPanel, BorderLayout.EAST); outerPanel.add(gamePanel,BorderLayout.CENTER); outerPanel.add(actionPanel,BorderLayout.SOUTH); @@ -87,11 +110,23 @@ public class GameLoopD extends JFrame implements Runnable { player01 = PanelBuilder.player01; - actionPanel.setVisible(true); - outerPanel.setVisible(true); - statusPanel.setVisible(true); - gamePanel.setVisible(true); + //leftPanel.setPreferredSize(new Dimension((this.getWidth()-gamePanel.getWidth()),10)); + + outerPanel.setVisible(true); + gamePanel.setVisible(true); + actionPanel.setVisible(true); + statusPanel.setVisible(true); + + // For fullscreen + if ( fullscreen ) { + GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + GraphicsDevice gd = ge.getDefaultScreenDevice(); + GraphicsConfiguration gc = gd.getDefaultConfiguration(); + gd.setFullScreenWindow(this); + leftPanel.setPreferredSize(new Dimension(((gd.getDisplayMode().getWidth() - (int)gamePanel.getPreferredSize().getWidth())/2), 0)); + rightPanel.setPreferredSize(new Dimension(((gd.getDisplayMode().getWidth() - (int)gamePanel.getPreferredSize().getWidth())/2), 0)); + } }