diff --git a/image/backgroundInEditor.png b/image/backgroundInEditor.png new file mode 100644 index 0000000..599e275 --- /dev/null +++ b/image/backgroundInEditor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e7a0fcf6a587c196bdfc69d2abcc978717d3f2772857d1747200ca2b6ca57cf0 +size 6043 diff --git a/image/backgroundInGame.png b/image/backgroundInGame.png new file mode 100644 index 0000000..5c58040 --- /dev/null +++ b/image/backgroundInGame.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2c587e696368efee2f66f6529e1366a052f6cfc66e0d6c67912575840ae6496b +size 5449 diff --git a/include/display.h b/include/display.h index 02de209..a563167 100644 --- a/include/display.h +++ b/include/display.h @@ -12,6 +12,6 @@ void displayImage (SDL_Renderer *renderer, SDL_Texture *texture, vect pos, void initSDL (dis *display_user); void displayTextSDL(dis *display_user,char *text, vect coor, vect size, int font_size); void screenDisplayGameSDL (char **tab,vect dim_tab, dis *display_user, vect *player_pos, int fov); -void backgroundDisplay(dis *display_user); +void backgroundDisplay(dis *display_user,int bg); #endif // !DISPLAY_H diff --git a/maps/original_2.txt b/maps/original_2.txt index f0e171b..8ff3b18 100644 --- a/maps/original_2.txt +++ b/maps/original_2.txt @@ -1,3 +1,8 @@ -##### -#PCI# -##### +#################### +#I# I############# +#P#### ############# +# C C ######### +# ## ### ######### +### ## ######### +### ############# +#################### \ No newline at end of file diff --git a/maps/original_3.txt b/maps/original_3.txt index 4e031b9..0499e89 100644 --- a/maps/original_3.txt +++ b/maps/original_3.txt @@ -1,5 +1,20 @@ -##### -#PCI# -# C # -#I # -##### +#################### +#I ############# +# ############# +#### ############### +# # ##I # +# C # # ### # # +# # # # # +# ## # C I # # +# ## ## CPC # +# ## C ### +### # I# ##### +## #### ##### +# I # # # +# #### ### # +# #######I###### # +##C######## ## # +# #### ##### +# C # I # +# #### ##### +#################### \ No newline at end of file diff --git a/script/display.c b/script/display.c index c7b381a..fcf1e1f 100644 --- a/script/display.c +++ b/script/display.c @@ -253,13 +253,22 @@ void displayTextSDL (dis *display_user, char *text, vect coor, vect size, /** * \brief Afficher l'arriere plan. * \param display_user Tout les information du display de l'utilisateur utile. + * \param bg quel back ground afficher. */ -void backgroundDisplay(dis *display_user) +void backgroundDisplay(dis *display_user,int bg) { SDL_Surface *img; SDL_Texture *texture; img = IMG_Load("image/background.png"); + if(bg==1) + { + img = IMG_Load("image/backgroundInGame.png"); + } + else if(bg==2) + { + img = IMG_Load("image/backgroundInEditor.png"); + } texture = SDL_CreateTextureFromSurface (display_user->renderer, img); diff --git a/script/function.c b/script/function.c index c381107..4b99cf3 100644 --- a/script/function.c +++ b/script/function.c @@ -565,7 +565,6 @@ int inEditorLoop (char **tab2d, vect *dim_tab, vect *playerPos, vect *targets, { tab2d[row][col] -= 1; } - printf("mtn la case est a %hd \n",tab2d[row][col]); // Met à jour l'affichage screenDisplayGameSDL (tab2d, *dim_tab, display_user, playerPos, fov); } diff --git a/script/main.c b/script/main.c index e0398c5..397e9c7 100644 --- a/script/main.c +++ b/script/main.c @@ -39,7 +39,7 @@ int main () vect pos = {4, 1}; char**menu = generatorMenu("maps", &dim_menu, &pos); - backgroundDisplay(&display_user); + backgroundDisplay(&display_user,0); vect null = {0, 0}; output = inGameLoop (menu, &dim_menu, &pos, &null , 1, &display_user, &score_user, true); @@ -52,9 +52,10 @@ int main () { SDL_RenderClear(display_user.renderer); - backgroundDisplay(&display_user); + if(output == -1) { + backgroundDisplay(&display_user,0); menu = generatorMenu("maps", &dim_menu, &pos); pos.x = 4; pos.y = 1; output = inGameLoop(menu, &dim_menu, &pos, &null, 1, &display_user, &score_user, true); @@ -62,13 +63,12 @@ int main () } else if(output == -2) { - printf("editeur de map"); - //newmap + backgroundDisplay(&display_user,2); output = inEditorLoop(tab2d, &dim, playerPos, targets, nbr_targets, &display_user,&score_user ,num_fichier); } else { - printf("editeur de map : %d" ,output); + backgroundDisplay(&display_user,1); score_user.before = time(NULL); char txt[30] = ""; if(output <= 3)