@@ -53,7 +53,8 @@ public class Game extends Canvas implements Runnable {
5353 private static int fps ;
5454 private static int tps ;
5555 private static int steps ;
56- private static boolean [] devMode = new boolean [2 ];
56+ private static boolean devMode ;
57+ private static boolean closingMode ;
5758
5859 private static JFrame frame ;
5960
@@ -100,7 +101,7 @@ public Game() {
100101 getFrame ().setVisible (true );
101102
102103 setDevMode (false );
103- setDevTime (false );
104+ setClosing (false );
104105 }
105106
106107 public void init () {
@@ -312,7 +313,7 @@ public void render() {
312313 g .drawString ("Press Q to quit" , (getWidth ()/2 )-("Press Q to quit" .length ()*3 ), getHeight () -17 );
313314 g .setColor (Color .YELLOW );
314315 g .drawString (time .getTime (), (getWidth () - 58 ), (getHeight () - 3 ));
315- status (g , isDevMode ());
316+ status (g , isDevMode (), isClosing () );
316317 g .setColor (Color .WHITE );
317318 if (noAudioDevice == true ) {
318319 g .setColor (Color .RED );
@@ -347,7 +348,7 @@ public void render() {
347348 bs .show ();
348349 }
349350
350- private void status (Graphics g , boolean TerminalMode ) {
351+ private void status (Graphics g , boolean TerminalMode , boolean TerminalQuit ) {
351352 if (TerminalMode == true ){
352353 g .setColor (Color .GREEN );
353354 g .drawString ("JavaGame Stats" , 0 , 10 );
@@ -358,6 +359,13 @@ private void status(Graphics g, boolean TerminalMode) {
358359 g .drawString ("Foot Steps: " + steps , 0 , 40 );
359360 g .drawString ("NPC: " + WordUtils .capitalize (String .valueOf (isNpc ())) , 0 , 55 );
360361 }
362+ if (TerminalQuit == true ){
363+ g .setColor (Color .BLACK );
364+ g .fillRect (0 , 0 , getWidth (), getHeight ());
365+ g .setColor (Color .RED );
366+ g .drawString ("Shutting down the Game" , (getWidth ()/2 )-70 , (getHeight ()/2 )-8 );
367+ g .dispose ();
368+ }
361369 }
362370
363371 public static void main (String [] args ) {
@@ -545,19 +553,19 @@ public void setInput(InputHandler input) {
545553 }
546554
547555 public static boolean isDevMode () {
548- return devMode [ 0 ] ;
556+ return devMode ;
549557 }
550558
551559 public static void setDevMode (boolean devMode ) {
552- Game .devMode [ 0 ] = devMode ;
560+ Game .devMode = devMode ;
553561 }
554562
555- public static boolean isDevTime () {
556- return devMode [ 1 ] ;
563+ public static boolean isClosing () {
564+ return closingMode ;
557565 }
558566
559- public static void setDevTime (boolean devTime ) {
560- Game .devMode [ 1 ] = devTime ;
567+ public static void setClosing (boolean closing ) {
568+ Game .closingMode = closing ;
561569 }
562570
563571}
0 commit comments