diff --git a/resources/guerrier_select.bmp b/resources/guerrier_select.bmp new file mode 100644 index 0000000000000000000000000000000000000000..c0ede69478f8cf0344233c430c0a073d05df11a3 Binary files /dev/null and b/resources/guerrier_select.bmp differ diff --git a/src/SDL.c b/src/SDL.c index 4c30a8f7038bb0a78846b5e9f4dbb3162825b2a4..863d6322248bfd8f46996159eabc6856e386d732 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -33,13 +33,17 @@ int main_SDL(char* Map) SDL_Surface* bouton_continuer=NULL; SDL_Surface* bouton_quitter=NULL; SDL_Surface* Case_brillante=NULL; + SDL_Surface* Guerrier_select=NULL; SDL_Rect Position_Case[LARGEUR_CARTE*HAUTEUR_CARTE]; SDL_Rect Position_Perso[NB_PERSO]; SDL_Rect Position_Case_brillante; + SDL_Rect Position_Guerrier_select; SDL_Rect pos_bouton_continuer; SDL_Rect pos_bouton_quitter; int x_case_brillante; int y_case_brillante; + int x_guerrier_select; + int y_guerrier_select; int quitter=0; affichermenu=0; @@ -158,6 +162,14 @@ int main_SDL(char* Map) } SDL_SetColorKey(Case_brillante, SDL_SRCCOLORKEY, SDL_MapRGB(Case_brillante->format, 0, 0, 255)); + Guerrier_select = SDL_LoadBMP("../resources/guerrier_select.bmp"); + if (!Guerrier_select) + { + printf("Unable to load bitmap: %s\n", SDL_GetError()); + return 1; + } + SDL_SetColorKey(Guerrier_select, SDL_SRCCOLORKEY, SDL_MapRGB(Guerrier_select->format, 0, 0, 255)); + for(i=0;i<LARGEUR_CARTE;i+=2) { for(j=0;j<HAUTEUR_CARTE;j++) @@ -243,6 +255,8 @@ int main_SDL(char* Map) } Position_Case_brillante.x=x_case_brillante; Position_Case_brillante.y=y_case_brillante; + Position_Guerrier_select.x=x_guerrier_select; + Position_Guerrier_select.y=y_guerrier_select; SDL_FillRect(ecran,NULL,SDL_MapRGB(ecran->format,0,0,0)); if(affichermenu==0) { @@ -266,9 +280,12 @@ int main_SDL(char* Map) } SDL_BlitSurface(Case_brillante,NULL,ecran,&Position_Case_brillante); + SDL_BlitSurface(Guerrier_select,NULL,ecran,&Position_Guerrier_select); for(i=0;i<NB_PERSO;i++) { SDL_BlitSurface(guerrier,NULL,ecran,&Position_Perso[i]); + x_guerrier_select = get_position_case_x(&Position_Perso[persoactuel()]); + y_guerrier_select = get_position_case_y(&Position_Perso[persoactuel()]); } }else{ SDL_BlitSurface(bouton_continuer,NULL,ecran,&pos_bouton_continuer); @@ -280,6 +297,7 @@ int main_SDL(char* Map) quitter=0; SDL_FreeSurface(guerrier); SDL_FreeSurface(Case_brillante); + SDL_FreeSurface(Guerrier_select); SDL_FreeSurface(plaine); SDL_FreeSurface(mage); SDL_FreeSurface(voleur); diff --git a/src/controleurSDL.c b/src/controleurSDL.c index 6c31a89b0c26885eb54937893cda3964934d9a7b..d83928b8627d5e057e03faea42816e144a9980a0 100644 --- a/src/controleurSDL.c +++ b/src/controleurSDL.c @@ -72,6 +72,10 @@ persosuivant(){ perso_actuel=0; } +int persoactuel(){ +return perso_actuel; +} + void deplacement_personnage(int x, int y) { if(x<LARGEUR_CARTE*LARGEUR_CASE&&y<HAUTEUR_CARTE*HAUTEUR_CASE) @@ -112,6 +116,7 @@ Case* deplacement_brillance(int x,int y) return NULL; } + int get_position_case_y(Case * Case){ return get_y(Case); } diff --git a/src/controleurSDL.h b/src/controleurSDL.h index 41d571d4493d3d7b2e7412035bd698f94e7fd8e8..438860487afbb5375488c4c9abde33f2cdcfc0fb 100644 --- a/src/controleurSDL.h +++ b/src/controleurSDL.h @@ -7,6 +7,7 @@ #ifndef CONTROLEUR_SDL_H_INCLUDED #define CONTROLEUR_SDL_H_INCLUDED + int y_case_cliquee(int x_pixel, int y_pixel); int x_case_cliquee(int x_pixel, int y_pixel); @@ -30,6 +31,8 @@ int get_position_case_y(Case * Case); int get_position_case_x(Case * Case); void persosuivant(); +int persoactuel(); -#endif + +#endif