void select_slow (void) { pause_flag = 0; draw_pause (0); slow_flag = 1; draw_slow (1); med_flag = 0; draw_med (0); fast_flag = 0; draw_fast (0); }
void game_on(){ SDL_Event event; int v=11,game=1,pause=0,p=0; double teta; score=0; init_cubes(); glEnable(GL_DEPTH_TEST); while(game){ SDL_PollEvent(&event); switch(event.type){ case SDL_QUIT: exit(0); break; case SDL_KEYDOWN: switch(event.key.keysym.sym) { case SDLK_ESCAPE: exit(0); break; default: game=1;break; } break; case SDL_MOUSEBUTTONDOWN: p=1; break; case SDL_MOUSEBUTTONUP: if(p){ p=0; if(pause) pause=0; else pause=1; } break; case SDL_MOUSEMOTION: if((event.motion.x - SCREEN_WIDTH/2)/4.0<22 && (event.motion.x - SCREEN_WIDTH/2)/4.0>-22) teta = -(event.motion.x - SCREEN_WIDTH/2)/4.0; break; default: break; } if(!pause){ score++; if(v<=20 && score%500==0) v+=1; move_cubes(v); draw_sceen(teta); if(check_collision(teta)) game=0; } else{ move_cubes(0); draw_pause(teta); } SDL_Delay(20); } }
void select_slow (void) { hide_mouse (); pause_flag = 0; draw_pause (0); slow_flag = 1; draw_slow (1); med_flag = 0; draw_med (0); fast_flag = 0; draw_fast (0); redraw_mouse (); }
void select_pause (void) { if (pause_flag) { /* unpause it */ if (fast_flag) select_fast (); else if (med_flag) select_medium (); else if (slow_flag) select_slow (); else select_medium (); } else { /* pause it */ pause_flag = 1; draw_pause (1); draw_slow (0); draw_med (0); draw_fast (0); } }