static void startContinuous(void){ // Method for continuing the Continuous mode resetContinuous(); drawGallow(); int i; for (i=0; i<try; i++){ if (i==0){ drawHead(); } else if (i==1){ drawBody(); } else if (i==2){ drawRightArm(); } else if (i==3){ drawLeftArm(); } else if (i==4){ drawRightLeg(); } } static char puc_score[10]; usprintf(puc_score, "Score: %d", score); RIT128x96x4StringDraw(puc_score, 69, 0, 15); displayAlphabet(); drawUnderscore(0, 83); drawHiddenWord(); } static void startClassic(void){ // Method for starting the Classic mode resetClassic(); drawGallow(); static char puc_score[10]; usprintf(puc_score, "Score: %d", score); RIT128x96x4StringDraw(puc_score, 69, 0, 15); displayAlphabet(); drawUnderscore(0, 83); drawHiddenWord(); }
void GPIOFIntHandler(void){ // Method for handling multiple functions for a select button press // Clear the GPIO interrupt GPIOPinIntClear(GPIO_PORTF_BASE, GPIO_PIN_1); // Disable Interrupts GPIOPinIntDisable(GPIO_PORTF_BASE, GPIO_PIN_1); GPIOPinIntDisable(GPIO_PORTE_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3); // Check which state we are in if (state==0){ // This state handles the main menu if (pointer==0){ // Begin Classic Mode state = 1; startClassic(); } else if (pointer==1){ // Begin Continuous Mode state = 3; startClassic(); } else if (pointer==2){ // Show the instructions state = 2; RIT128x96x4Clear(); displayInstructions(); done = 1; } else if (pointer==3){ // Show the high scores state = 2; RIT128x96x4Clear(); displayScores(); done = 1; } else if (pointer==4){ state = 0; initMain(); } } else if (state==1){ // This state handles classic mode // Black out the letter that was selected int idx = position + position2; int pos = 0; char *puc_letter = alpha[idx]; if (idx>12){ pos = position2 * 10; RIT128x96x4StringDraw(puc_letter, pos, 87, 2); } else { pos = position * 10; RIT128x96x4StringDraw(puc_letter, pos, 75, 2); } // Add the letter to the list of selected letters int i; int wrong = 1; int used = 0; // Loop through the list until we find an empty spot to place the letter for (i=0; i<26; i++){ if (strcmp(selected[i],"!")==0){ selected[i] = puc_letter; break; } if (strcmp(selected[i],puc_letter)==0){ wrong = 0; used = 1; break; } } // Check to see if the letter was already used if (!used){ // Check the word to see if a letter matches the one selected. If it // does, we need to display the letters instead of an underscore for (i=0; i<strlen(words[wotd]); i++){ char w_let = words[wotd][i]; static char g[3]; usprintf(g, "%d", w_let); char p_let = *puc_letter; if (w_let==p_let){ wrong = 0; // Display the letter selected RIT128x96x4StringDraw(puc_letter, 10+i*10, 53, 15); correct++; } } } // Check to see if it was a wrong selection if (wrong==1){ // Increment the number of wrong attempts try++; // If the selection was wrong, we need to draw a piece of the hangman if (try==1){ drawHead(); } else if (try==2){ drawBody(); } else if (try==3){ drawRightArm(); } else if (try==4){
void glutDisplay() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); loadGlobalCoord(); glShadeModel(GL_SMOOTH); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glEnable(GL_DEPTH_TEST); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glLightfv(GL_LIGHT0, GL_AMBIENT, AMBIENT_LIGHT); glLightfv(GL_LIGHT0, GL_DIFFUSE, DIFFUSE_LIGHT); glLightfv(GL_LIGHT0, GL_SPECULAR, SPECULAR_LIGHT); glLightfv(GL_LIGHT0, GL_POSITION, LIGHT_POSITION); glEnable(GL_LIGHT1); glLightfv(GL_LIGHT1, GL_AMBIENT, AMBIENT_SUB_LIGHT); glLightfv(GL_LIGHT1, GL_DIFFUSE, DIFFUSE_SUB_LIGHT); glLightfv(GL_LIGHT1, GL_SPECULAR, SPECULAR_LIGHT); glLightfv(GL_LIGHT1, GL_POSITION, SUB_LIGHT_POSITION); glEnable(GL_COLOR_MATERIAL); glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, MATERIAL_AMBIENT); glMaterialfv(GL_FRONT, GL_SPECULAR, MATERIAL_SPECULAR); glMateriali(GL_FRONT, GL_SHININESS, 48); glTranslatef(0, 0, baseTrans); glRotatef(bodyRot, 0, 0, 1); glRotatef(90.0f, 1, 0, 0); glColor3f(1.0, 1.0, 0); // Yellow color GLUquadricObj* body = gluNewQuadric(); gluCylinder(body, 5.5, 7.0, 17, 100, 10); gluDeleteQuadric(body); glPushMatrix(); drawLeftArm(); glPopMatrix(); glPushMatrix(); drawRightArm(); glPopMatrix(); glPushMatrix(); drawLeftLeg(); glPopMatrix(); glPushMatrix(); drawRightLeg(); glPopMatrix(); glPushMatrix(); drawTail(); glPushMatrix(); drawBall(); glPopMatrix(); glPopMatrix(); glPushMatrix(); drawHead(); glPushMatrix(); drawLeftEye(); glPopMatrix(); glPushMatrix(); drawRightEye(); glPopMatrix(); glPushMatrix(); drawLeftCheek(); glPopMatrix(); glPushMatrix(); drawRightCheek(); glPopMatrix(); glPushMatrix(); drawMouse(); glPopMatrix(); glPushMatrix(); drawLeftEar(); glPopMatrix(); glPushMatrix(); drawRightEar(); glPopMatrix(); glPopMatrix(); glutSwapBuffers(); }