nouveau niveau + pofinage de lediteur

This commit is contained in:
cyjullien1
2025-01-06 17:13:27 +01:00
parent 13fd66cecb
commit e9b91e0e81
8 changed files with 50 additions and 16 deletions

BIN
image/backgroundInEditor.png LFS Normal file

Binary file not shown.

BIN
image/backgroundInGame.png LFS Normal file

Binary file not shown.

View File

@@ -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

View File

@@ -1,3 +1,8 @@
#####
#PCI#
#####
####################
#I# I#############
#P#### #############
# C C #########
# ## ### #########
### ## #########
### #############
####################

View File

@@ -1,5 +1,20 @@
####################
#I #############
# #############
#### ###############
# # ##I #
# C # # ### # #
# # # # #
#PCI#
# C #
#I #
#####
# ## # C I # #
# ## ## CPC #
# ## C ###
### # I# #####
## #### #####
# I # # #
# #### ### #
# #######I###### #
##C######## ## #
# #### #####
# C # I #
# #### #####
####################

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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)