X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=course%2Fsemester2%2Fpprog%2Fassignment1%2Fmthread%2Fgraphics.c;h=6f043ad8ec19338d523d32519bdd675292a0ae99;hb=19cb61f75ddda901224f7ce2bae0d3934f67d9ee;hp=9fe6655577c4cadb6385df1a8511c086ba1a2fa7;hpb=7a341db1fbf5db94b711135b2a79e852c6fb1bc4;p=matches%2Fhonours.git diff --git a/course/semester2/pprog/assignment1/mthread/graphics.c b/course/semester2/pprog/assignment1/mthread/graphics.c index 9fe66555..6f043ad8 100644 --- a/course/semester2/pprog/assignment1/mthread/graphics.c +++ b/course/semester2/pprog/assignment1/mthread/graphics.c @@ -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); }