Skip to content
Snippets Groups Projects
Commit f3edd5fb authored by Samibenzid's avatar Samibenzid
Browse files

Ajout d'un moyen pour retourner

au menu de base dans le shop
parent 8f71094c
No related branches found
No related tags found
No related merge requests found
......@@ -6,11 +6,11 @@
void init_ressource(SDL_Renderer *renderer, ressources_t *textures){
textures->bmenu = load_image( "ressources/image-menu.bmp",renderer);
textures->bshop = load_image( "ressources/Elements/shop.png",renderer);
textures->ship = load_image( "ressources/spaceship.bmp",renderer);
textures->background = load_image( "ressources/Elements/backgrounds/1.png",renderer);
textures->background2 = load_image( "ressources/Elements/backgrounds/3.png",renderer);
textures->background3 = load_image( "ressources/Elements/backgrounds/2.png",renderer);
textures->ship = load_image( "ressources/Elements/Ship_1.png",renderer);
textures->exit_shp = load_image( "ressources/exit.png",renderer);
textures->finishLine = load_image( "ressources/finish_line.bmp",renderer);
textures->font = load_font("ressources/font/arial.ttf", 14);
......@@ -143,6 +143,7 @@ void inshop(SDL_Renderer *renderer, world_t *world, ressources_t *textures){
apply_text(renderer, (SCREEN_WIDTH-90)-(25*number_of_numbers(world->money)), 20, 25*number_of_numbers(world->money), 50, world->coin_menu_str, textures->font, textures->color);
apply_sprite(renderer, textures->exit_shp, world->exit_shp , world);
}
void ingame(SDL_Renderer *renderer, world_t *world,ressources_t *textures){
......
......@@ -39,6 +39,7 @@ struct ressources_s{
SDL_Texture* background2; /*!< Texture liée à l'image du fond de l'écran. (effet parallax) */
SDL_Texture* background3; /*!< Texture liée à l'image du fond de l'écran. (effet parallax) */
SDL_Texture* ship; /*!< Texture liée à l'image du vaisseau. */
SDL_Texture* exit_shp;
SDL_Texture* meteorite; /*!< Texture liée à l'image du météorite. */
SDL_Texture* e_rotate; /*!< Texture liée à l'image de l'élément de rotation. */
......
No preview for this file type
No preview for this file type
......@@ -118,6 +118,7 @@ void init_shop(world_t * world){
world->ship2 = init_btn(287,143, 191, 139);
world->ship3 = init_btn(491,138, 191, 139);
world->ship4 = init_btn(290,308, 191, 139);
world->exit_shp = init_btn(670,500,100,100);
world->Spr_ship = malloc(sizeof(sprite_t*)*4);
world->Spr_ship[0] = init_sprite(world->Spr_ship[0], 74,145, 191, 139, 'x', 0);
......
......@@ -48,6 +48,7 @@ struct world_s{
btn_t *ship2;
btn_t *ship3;
btn_t *ship4;
btn_t *exit_shp;
sprite_t *BarreProgression;
sprite_t *vaisseauMini;
......@@ -55,6 +56,7 @@ struct world_s{
sprite_t *soleil;
sprite_t *air;
sprite_t *coins;
sprite_t *exit_shop;
sprite_t **Spr_ship;
int *shopPrice;
......
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -104,6 +104,10 @@ void handle_events(SDL_Event *event,world_t *world){
world->money -= world->shopPrice[3];
modify_str(world->coins_str, int_to_str(world->money));
}
if (collidePoint(world->exit_shp, world->mouseX, world->mouseY)){
printf("exit");
world->gamestate=1;
}
}
}
}
......
No preview for this file type
ressources/exit.png

66 KiB

No preview for this file type
No preview for this file type
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment