/* ** main.c - Rotagon ** ** 2014 - Frank Villaro-Dixon */ #include #include #include #include "SDL/SDL.h" #include "game.h" #include "sdl.h" #include "obs.h" #include "music.h" #include "patterns.h" int main() { struct s_game ga; start: init_game(&ga); init_music(&ga); init_SDL(&ga); struct s_obstacle a = create_obstacle(SHAPE_THICK, 2, 1, -1); add_obstacle(&ga, a); while(1) { SDL_FillRect(ga.screen, NULL, 0); if(did_have_beat(&ga)) { ga.sexual_pulsation = 60; puts("Pulse"); } /* if(!(ga.counter % 28)) { add_random_obstacle(&ga); } */ if(get_max_obs_dist(&ga) < SCREEN_DIAGONAL) add_pattern(&ga); update_obstacles(&ga); draw_game(&ga); SDL_Flip(ga.screen); if(check_collisions(&ga)) { puts("PERDU, connard !"); SDL_Delay(2000); goto start; } get_keys(&ga); SDL_Delay(3); ga.counter++; ga.general_rotation = ga.counter*3; // ga.sexual_pulsation = 0.3 * fabs(cos(ga.counter*M_PI/45)) + 1 + // 0.3 * fabs(sin(ga.counter*M_PI/90)); if(!(ga.counter % 10)) change_game_color(&ga); ga.sexual_pulsation -= 2; if(ga.sexual_pulsation < 0) ga.sexual_pulsation = 0; } return EXIT_SUCCESS; }