@@ -21,6 +21,22 @@ public final class GameWindow extends Canvas{
2121
2222 public static BufferedImage bufferLayer ;
2323
24+ public GameWindow (String frameName ) {
25+ this (GameWindowConstants .DEFAULT_WINDOW_WIDTH ,
26+ GameWindowConstants .DEFAULT_WINDOW_HEIGHT ,
27+ GameWindowConstants .DEFAULT_WINDOW_SCALE ,
28+ frameName );
29+ }
30+
31+ public GameWindow (int width , int height , int scale , String frameName ) {
32+ GameWindow .width = (short )width ;
33+ System .out .println (height );
34+ GameWindow .height = (short )height ;
35+ GameWindow .scale = (byte )scale ;
36+
37+ this .initWindowFrame (frameName );
38+ }
39+
2440 public static short getWindowWidth () {
2541 return width ;
2642 }
@@ -45,22 +61,6 @@ public BufferedImage getBufferedImage() {
4561 return bufferLayer ;
4662 }
4763
48- public GameWindow (String frameName ) {
49- this (GameWindowConstants .DEFAULT_WINDOW_WIDTH ,
50- GameWindowConstants .DEFAULT_WINDOW_HEIGHT ,
51- GameWindowConstants .DEFAULT_WINDOW_SCALE ,
52- frameName );
53- }
54-
55- public GameWindow (int width , int height , int scale , String frameName ) {
56- GameWindow .width = (short )width ;
57- System .out .println (height );
58- GameWindow .height = (short )height ;
59- GameWindow .scale = (byte )scale ;
60-
61- this .initWindowFrame (frameName );
62- }
63-
6464 public void initWindowFrame (String frameName ) {
6565
6666 windowFrame = new JFrame (frameName );
@@ -75,8 +75,6 @@ public void initWindowFrame(String frameName) {
7575
7676 // Centralize the window to the center of the user screen
7777 windowFrame .setLocationRelativeTo (null );
78-
79- windowFrame .setVisible (true );
8078
8179 bufferLayer = new BufferedImage ((int )width ,(int )height , BufferedImage .TYPE_INT_RGB );
8280
@@ -85,6 +83,10 @@ public void initWindowFrame(String frameName) {
8583 //windowFrame.setIconImage(icon);
8684 }
8785
86+ public void toggleFrameVisibility (boolean visibility ) {
87+ windowFrame .setVisible (visibility );
88+ }
89+
8890 public Graphics getWindowLayer () {
8991 BufferStrategy bs = this .getBufferStrategy ();
9092 if ( bs == null ) {
0 commit comments