1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
extern void aff_choix_barre_action(SDL_Window *window, SDL_Renderer *renderer){
SDL_Texture *barre_choix_action = NULL;
SDL_Texture *bouton_croix_rouge = NULL;
ajout_texture_non_centre(barre_choix_action, "img/barre_action.png", renderer, window, 350, 450);
ajout_texture_non_centre(bouton_croix_rouge, "img/bouton_croix_rouge.png", renderer, window, 350, 390);
SDL_RenderPresent(renderer);
SDL_bool program_launched = SDL_TRUE;
while(program_launched){
SDL_Event event;//Créer un évènement
while(SDL_PollEvent(&event)){//Prend n'importe quels évènements
switch (event.type) {
case SDL_MOUSEBUTTONDOWN:
if((event.button.x > 350 && event.button.x < 400)&&(event.button.y > 390 && event.button.y < 440)){//si on appuie sur la zone du bouton rouge
//Effacer la texture visuellement
printf("On sort de la boucle.\n");//test
program_launched = SDL_FALSE;//On quitte la fonction
}
break;
default:
printf("On reste dans la boucle.\n");//test
continue;
}
}
}
SDL_DestroyTexture(bouton_croix_rouge);
SDL_DestroyTexture(barre_choix_action);
SDL_RenderPresent(renderer);
printf("Destruction et mise à jour du rendu de la barre d'action.\n");
} |
Partager