diff options
author | Olivier Gayot <duskcoder@gmail.com> | 2015-01-08 18:52:14 +0100 |
---|---|---|
committer | Olivier Gayot <duskcoder@gmail.com> | 2015-01-08 18:52:14 +0100 |
commit | d75f0dfb7a040ff88c39e01fa639ff74300f11a2 (patch) | |
tree | 7ac20d9c89778c353e355731dd74bde59646aca1 | |
parent | c6f994c51f29770be493ac3aaf76f71fccc4269f (diff) |
blit the background only once (no need for a weird function)
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
-rw-r--r-- | blits.c | 10 | ||||
-rw-r--r-- | jouer.c | 7 | ||||
-rw-r--r-- | main.c | 3 | ||||
-rw-r--r-- | prototypes.h | 1 |
4 files changed, 4 insertions, 17 deletions
@@ -289,13 +289,3 @@ void Fblitterpmcible (SURFACES *surfaces,POSITIONS *positions, const struct char SDL_BlitSurface (surfaces->Ppmcible,NULL,surfaces->Pecran,&positions->Vpositionpmcible); TTF_CloseFont (police); } - -void Fblitterfond(SURFACES* surfaces) -{ - SDL_Rect position; - position.x=0; - position.y=0; - surfaces->Pfondjeu=IMG_Load("images/jeu/textures/background.jpg"); - SDL_BlitSurface(surfaces->Pfondjeu,NULL,surfaces->Pecran,&position); - SDL_Flip(surfaces->Pecran); -} @@ -246,12 +246,7 @@ int Fjouer (SURFACES *surfaces, POSITIONS *positions, struct team_t *t1, struct unsigned int gagne,perdu; - if(surfaces->Pfondjeu!=NULL) - { - SDL_FreeSurface(surfaces->Pfondjeu); - surfaces->Pfondjeu=NULL; - } - Fblitterfond(surfaces); // on blit le fond du jeu + SDL_BlitSurface(surfaces->background, NULL, surfaces->Pecran, NULL); /* compute whether the allies or the enemies should begin */ playing_team = (rand() % 2) ? t1 : t2; @@ -243,6 +243,9 @@ int Fchargerimages (SURFACES *surfaces) for (i = 0;i < 5;i++) surfaces->Tennemi[i] = surfaces->Pgobelin; + LOAD_IMAGE(background, "images/jeu/textures/background.jpg"); + surfaces->Pfondjeu = surfaces->background; + #undef LOAD_IMAGE //définition de la transparence alpha dans les surfaces diff --git a/prototypes.h b/prototypes.h index 582bfee..089b5f4 100644 --- a/prototypes.h +++ b/prototypes.h @@ -37,7 +37,6 @@ void blit_character_affinities(SURFACES *, POSITIONS *, const struct character_t void update_list_entries(SURFACES *surfaces, POSITIONS *positions, const struct entry_t *entries, int cnt, int selected); void Fblitterpvcible (SURFACES *surfaces,POSITIONS *positions, const struct character_t *); void Fblitterpmcible (SURFACES *surfaces,POSITIONS *positions, const struct character_t *); -void Fblitterfond(SURFACES* surfaces); Uint32 obtenirPixel(SDL_Surface *surface, int x, int y); void definirPixel(SDL_Surface *surface, int x, int y, Uint32 pixel); |