Parallel Programming - Finished(?) pthread version
[matches/honours.git] / course / semester2 / pprog / assignment1 / mthread / graphics.c
index 9fe6655..6f043ad 100644 (file)
@@ -87,6 +87,25 @@ void Graphics_Run(int argc, char ** argv)
  */
 void Graphics_Display() 
 {
+       //Check whether the runstate has been set to quit the program
+       switch (runstate)
+       {
+               case RUN:
+                       break;
+               case QUIT:
+                       exit(EXIT_SUCCESS);
+                       break;
+               case QUIT_ERROR:
+                       exit(EXIT_FAILURE);
+                       break;
+       }
+
+       //Check if window exists, quit if it doesn't
+       if (glutGetWindow() == 0)
+       {
+               exit(EXIT_SUCCESS);
+       }
+
 
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        glMatrixMode(GL_MODELVIEW);
@@ -113,7 +132,6 @@ void Graphics_Keyboard(unsigned char theKey, int mouseX, int mouseY)
 {
        if (theKey == 'x' || theKey == 'X') 
        {
-               printf("Kill recieved\n");
                exit(EXIT_SUCCESS);
        }
 

UCC git Repository :: git.ucc.asn.au