diff --git a/library/Display/Display.c b/library/Display/Display.c index 36da019fd615a00b2d85cf1da4537b41d5d16a24..d8a5b32fd1979d54126c76a48ea7f3d4e4a565ec 100644 --- a/library/Display/Display.c +++ b/library/Display/Display.c @@ -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){ diff --git a/library/Display/Display.h b/library/Display/Display.h index c304190f4c74ba8ea64f56c4c74af53884566471..2fe956b07d8f3efe871d2f7ba1903c97b97f2268 100644 --- a/library/Display/Display.h +++ b/library/Display/Display.h @@ -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. */ diff --git a/library/Display/Display.o b/library/Display/Display.o index f6628b920713b6da0d2dd10fd31bca11c32f563c..db1aa70d1adadf0bddd7dd106101c3e6959a233d 100644 Binary files a/library/Display/Display.o and b/library/Display/Display.o differ diff --git a/library/Sprites/sprites.o b/library/Sprites/sprites.o index b52ea3ebefe689154a5a3a0a5f5135bf17bea7df..653312a1dc4daeb0f67fd0532b4c2ee660ae8145 100644 Binary files a/library/Sprites/sprites.o and b/library/Sprites/sprites.o differ diff --git a/library/World/world.c b/library/World/world.c index f76770313101402ba0375f86277adbfe4c4ec086..2105b30d273261e8b537e997d26b77fa0e9a68e3 100644 --- a/library/World/world.c +++ b/library/World/world.c @@ -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); diff --git a/library/World/world.h b/library/World/world.h index 5c1df510d0224394a1ac82d5e00a843e2d67c3ec..0a5a56bbd2fb5d97d8c80550210823606cf76cbf 100644 --- a/library/World/world.h +++ b/library/World/world.h @@ -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; diff --git a/library/World/world.o b/library/World/world.o index 5fbe69606a5c0baa3bfccc98b79428e8559c6cb7..0093a2f35eb4e398d00509dcfda841039868522b 100644 Binary files a/library/World/world.o and b/library/World/world.o differ diff --git a/library/menu/menu.o b/library/menu/menu.o index 84c315fce363b5059bff8e7a368ef00fceb3c935..b6cbc3e665f91e49dc9a7db7cdebb2712ead74c7 100644 Binary files a/library/menu/menu.o and b/library/menu/menu.o differ diff --git a/library/utility/utility.o b/library/utility/utility.o index 6d8022279078ab3e448c8e8a3e13ec2d6306e722..6609c095ef8dafdbc81576ac568e31b439ea5fff 100644 Binary files a/library/utility/utility.o and b/library/utility/utility.o differ diff --git a/main.c b/main.c index c58cf0270df255896c078f3b9595817909cc76e3..2c228c97a91f2f253d9fc8bb6698ce383c957021 100644 --- a/main.c +++ b/main.c @@ -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; + } } } } diff --git a/main.o b/main.o index 934d1dada2a4d289b2ab2bc031b202faaebc9669..d9f97e4da37988ad1709dea0b0dd7ff05c19176a 100644 Binary files a/main.o and b/main.o differ diff --git a/ressources/exit.png b/ressources/exit.png new file mode 100644 index 0000000000000000000000000000000000000000..9fd354a1b50deb1adcda6332f471c8a046e59949 Binary files /dev/null and b/ressources/exit.png differ diff --git a/sdl2-light.o b/sdl2-light.o index b1fb73d0112d9feb208a755bbcb6b2a0571606ef..3e6a75a3a2e00c9e5611f12a2032bd08bbe0786f 100644 Binary files a/sdl2-light.o and b/sdl2-light.o differ diff --git a/sdl2-ttf-light.o b/sdl2-ttf-light.o index f8e682ac4d9855b2e3eea678d9470fab1084a9f1..e6dbdb53a08901764f1103130b7cfe977b7bcc21 100644 Binary files a/sdl2-ttf-light.o and b/sdl2-ttf-light.o differ diff --git a/spacecorridor.exe b/spacecorridor.exe index cd303255b2cfd0766a46d5773199598f2e5a079f..353addcaac4d315dcadaf3658fad1b03db2ff94b 100644 Binary files a/spacecorridor.exe and b/spacecorridor.exe differ