diff options
Diffstat (limited to 'menuprincipal.c')
-rw-r--r-- | menuprincipal.c | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/menuprincipal.c b/menuprincipal.c index 51d4732..76dff2f 100644 --- a/menuprincipal.c +++ b/menuprincipal.c @@ -5,12 +5,28 @@ #include "prototypes.h" #include "constantes.h" +static void Fchangersurlignage(int Vmode, SURFACES *surfaces) +{ + SDL_Surface *surf; + + if (Vmode == 0) + surf = surfaces->Pmenujouer; + else if (Vmode == 1) + surf = surfaces->Pmenuoptions; + else if (Vmode == 2) + surf = surfaces->Pmenuquitter; + + SDL_BlitSurface(surf, NULL, surfaces->screen, NULL); + + SDL_Flip(surfaces->screen); +} + void Fmenuprincipal (SURFACES *surfaces, POSITIONS *positions) { int continuer = 1; SDL_Event event; int Vmode = 0; - SDL_BlitSurface (surfaces->Pmenujouer,NULL,surfaces->Pecran,&positions->Vpositionmenu); + SDL_BlitSurface(surfaces->Pmenujouer, NULL, surfaces->screen, NULL); SDL_Flip (surfaces->Pecran); while (continuer) { @@ -26,12 +42,12 @@ void Fmenuprincipal (SURFACES *surfaces, POSITIONS *positions) if (Vmode < 2) { Vmode++; - Fchangersurlignage (Vmode,surfaces,positions); + Fchangersurlignage(Vmode, surfaces); } else { Vmode = 0; - Fchangersurlignage (Vmode,surfaces,positions); + Fchangersurlignage(Vmode, surfaces); } break; case SDLK_UP: @@ -39,12 +55,12 @@ void Fmenuprincipal (SURFACES *surfaces, POSITIONS *positions) if (Vmode > 0) { Vmode--; - Fchangersurlignage (Vmode,surfaces,positions); + Fchangersurlignage(Vmode, surfaces); } else { Vmode = 2; - Fchangersurlignage (Vmode,surfaces,positions); + Fchangersurlignage(Vmode, surfaces); } break; case SDLK_RETURN: @@ -53,7 +69,7 @@ void Fmenuprincipal (SURFACES *surfaces, POSITIONS *positions) Vmode = 0; if (continuer) { - SDL_BlitSurface (surfaces->Pmenujouer,NULL,surfaces->Pecran,&positions->Vpositionmenu); + SDL_BlitSurface(surfaces->Pmenujouer, NULL, surfaces->screen, NULL); SDL_Flip (surfaces->Pecran); } break; @@ -65,17 +81,6 @@ void Fmenuprincipal (SURFACES *surfaces, POSITIONS *positions) } } -void Fchangersurlignage (int Vmode, SURFACES *surfaces, POSITIONS *positions) -{ - if (Vmode == 0) - SDL_BlitSurface (surfaces->Pmenujouer,NULL,surfaces->Pecran,&positions->Vpositionmenu); - else if (Vmode == 1) - SDL_BlitSurface (surfaces->Pmenuoptions,NULL,surfaces->Pecran,&positions->Vpositionmenu); - else if (Vmode == 2) - SDL_BlitSurface (surfaces->Pmenuquitter,NULL,surfaces->Pecran,&positions->Vpositionmenu); - SDL_Flip (surfaces->Pecran); -} - int Fentrermode (int Vmode, SURFACES *surfaces, POSITIONS *positions) { int continuer = 1; |