diff options
author | Olivier Gayot <duskcoder@gmail.com> | 2015-01-11 01:42:56 +0100 |
---|---|---|
committer | Olivier Gayot <duskcoder@gmail.com> | 2015-01-11 01:44:54 +0100 |
commit | b37b127792e09cb7148200e0bccf294892e9a889 (patch) | |
tree | f2dcf5e465428fd8aa65d5b738987fc712ed8946 /menuprincipal.c | |
parent | 46c4037c905598cc0e41ac5464492384331aa57c (diff) |
remove or replace a lot of code for the initialization
many structures or positions were not revelant anymore and thus have
been removed.
some positions were not relative to each other
it is sometimes not meaningful to put surfaces in the global scope when
they only need to be used once.
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
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; |