diff --git a/travail_individuel/Meyer/pave_de_serpents/main b/travail_individuel/Meyer/pave_de_serpents/main index 0aff295c94b235d24b463ae154c3757b6ecb31ac..0130edc9e30a444de3016821db2bb91eb1982ae1 100755 Binary files a/travail_individuel/Meyer/pave_de_serpents/main and b/travail_individuel/Meyer/pave_de_serpents/main differ diff --git a/travail_individuel/Meyer/pave_de_serpents/main.c b/travail_individuel/Meyer/pave_de_serpents/main.c index 5f1e1b21670551a65127ae787f072d75e00f6d92..cbf26667f7b73b16bae5130e0243e23ecf9b2875 100644 --- a/travail_individuel/Meyer/pave_de_serpents/main.c +++ b/travail_individuel/Meyer/pave_de_serpents/main.c @@ -7,6 +7,8 @@ int main(int argc, char **argv) (void)argc; (void)argv; + int vainqueur = 0; + SDL_Window *window = NULL; @@ -20,6 +22,12 @@ int main(int argc, char **argv) int display_width; int display_height; + SDL_Renderer *renderer; + SDL_Rect rect; + + int pale_1_x; + int pale_1_y; + if (SDL_GetDesktopDisplayMode(0, &mode) != 0) { SDL_Log("SDL_GetDesktopDisplayMode failed: %s", SDL_GetError()); @@ -40,7 +48,7 @@ int main(int argc, char **argv) window_x = (display_width - window_width) / 2; window_y = (display_height - window_height) / 2; window = SDL_CreateWindow( - "Course de formes", + "Moulin à serpents", window_x, window_y, // centrage de la fenêtre window_width, window_height, // largeur, hauteur SDL_WINDOW_RESIZABLE); // redimensionnable @@ -53,13 +61,78 @@ int main(int argc, char **argv) exit(EXIT_FAILURE); } - // decompte decollage - SDL_Delay(1000); - SDL_SetWindowTitle(window, "Rocket : 2"); + renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED); /* SDL_RENDERER_SOFTWARE */ + if (renderer == 0) + { + fprintf(stderr, "Erreur d'initialisation de la SDL : %s\n", SDL_GetError()); + + SDL_Quit(); // On referme la SDL + exit(EXIT_FAILURE); + } + + // dessin + /* couleur de fond */ + SDL_SetRenderDrawColor(renderer, 157, 224, 144, 255); + SDL_RenderClear(renderer); + + //sol + SDL_SetRenderDrawColor(renderer, 49, 150, 29, 255); + rect.w = window_width; + rect.h = window_height/3; + rect.x = 0; + rect.y = window_height - window_height/3; + SDL_RenderFillRect(renderer, &rect); + + /* bloc du moulin */ + SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); + rect.w = 150; + rect.h = 250; + rect.x = (window_width - rect.w)/2; + rect.y = window_height - rect.h - 150; + SDL_RenderFillRect(renderer, &rect); + + /*triangle moulin*/ + SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255); + rect.w = 150; + rect.h = 50; + rect.x = (window_width - rect.w)/2; + rect.y = window_height - rect.h - 400; + SDL_RenderFillRect(renderer, &rect); + + //pales du moulin + //pale 1 du moulin + pale_1_x = 50; + pale_1_y = 50; + SDL_SetRenderDrawColor(renderer, 163, 82, 2, 255); + SDL_RenderDrawLine(renderer, + (window_width - rect.w)/2, + window_height - rect.h - 400, + pale_1_x, + pale_1_y); + + + + /* afficher à l'ecran */ + SDL_RenderPresent(renderer); + + + + // départ de la course + /*while (vainqueur == 0) + { + + if (cercle.x > display_width) + { + vainqueur = 1; + } + }*/ + + // ecrire victoire + - //actualise la bete + SDL_Delay(2000); - // explosion de la rocket + // fermer fenetre SDL_DestroyWindow(window); // la fenêtre SDL_Quit(); // la SDL