From 2c97bd373b4e154746e6196df2afb736af316f1d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?L=C3=A9na=C3=AFg=20Le=20Moigne?=
 <lenaig.le-moigne@insa-rennes.fr>
Date: Sun, 24 Apr 2016 15:31:22 +0200
Subject: [PATCH] =?UTF-8?q?Modifications=20permettant=20de=20s=C3=A9lectio?=
 =?UTF-8?q?nner=20le=20personnage=20en=20jeu=20afin=20de=20le=20diff=C3=A9?=
 =?UTF-8?q?rencier=20des=20autres.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 resources/guerrier_select.bmp | Bin 0 -> 15606 bytes
 src/SDL.c                     |  18 ++++++++++++++++++
 src/controleurSDL.c           |   5 +++++
 src/controleurSDL.h           |   5 ++++-
 4 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 resources/guerrier_select.bmp

diff --git a/resources/guerrier_select.bmp b/resources/guerrier_select.bmp
new file mode 100644
index 0000000000000000000000000000000000000000..c0ede69478f8cf0344233c430c0a073d05df11a3
GIT binary patch
literal 15606
zcmds#yH3S042BPgnVEr+fhS;MVq)Q)8P4mlA~vvU6h-OH_c%dql~dx_-~aXP<NNip
z{Jp^Q8SeN0`{weny#Iv%U+?i=Uclp5bUi(Og<Y}<1yx8SC=`^;+6$rpG(jNTlE?sY
zwwR7FU7EDLm34svM(@7f=Qo<_pMJ_ZLb)pI%Y|sQL6dcNC?{nZxXhI$fihQ?hs#h|
zDkwu`*|<!UC4@3j23&AX!b>w)PFWbTW;RVG0g7egX#xp=f)=s~Wog6^VHW|Hpd^y0
z^y1E$UzR`_H-wU2mj!*=QDm`{(eb<3*=$Ogc`R8(Wfbtu#Jayco_s`Er^=3zyBj$j
zU~m3$WgRHngFQ_t)rK|2=(0AItua$sU=34P%7Rs%c5}gjMcN?+gCSRW3QkB{QlKVN
z27x0H0;bKMJ6Me~jj|dF#m#}%aFuV8E8S`T&)u!y<TVs>jjn8y3(*8AB`Mj1nwV=`
zv;$fAIh}4u^3^qCP{xKmO;z%r6evI-Zp#BpA9x^Tbf~eEaTRd)clj(?vT#B{Nj#b?
zd|6c(oj7@MVGNokc1^7-oicM}xgVN7aQzA9bS7z=9Ab-R6}8nlCUk~58y=-ZGoK`h
zGV?LagA#~yn!!9PE}GK-PH_?GT)R6ZMnQ9J?HbwvT|i&g-1g7{ng&GI(1mpjNUuf<
VYZn$E&_(tt?Xao$vvx;c{{eqnX;1(F

literal 0
HcmV?d00001

diff --git a/src/SDL.c b/src/SDL.c
index 4c30a8f..863d632 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 6c31a89..d83928b 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 41d571d..4388604 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
-- 
GitLab