diff options
author | Olivier Gayot <duskcoder@gmail.com> | 2015-01-10 20:03:11 +0100 |
---|---|---|
committer | Olivier Gayot <duskcoder@gmail.com> | 2015-01-10 20:03:11 +0100 |
commit | 843026b1346d085c699dfe5049e104dca420b934 (patch) | |
tree | 428337e063b132a4e017c85eaaee4fdfd0a4a3ee /menuchoixpersos.c | |
parent | f508e7191bd2f3eb7616e315e7e0d4a4b94c7914 (diff) |
do not handle font I/O inside the game.
the fonts (actually the font) is opened at startup and closed at
shutdown.
This fixes possible crashes during the game if a font file is
removed/moved.
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
Diffstat (limited to 'menuchoixpersos.c')
-rw-r--r-- | menuchoixpersos.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/menuchoixpersos.c b/menuchoixpersos.c index 176ec45..66ae603 100644 --- a/menuchoixpersos.c +++ b/menuchoixpersos.c @@ -8,6 +8,8 @@ #include <SDL/SDL_ttf.h> #include "players.h" +#include "rpg.h" + static void init_team_players(struct team_t *team, bool left, const enum character_class_t *classes, SURFACES *surfaces) { @@ -157,7 +159,6 @@ struct team_t *new_enemy_team(SURFACES *surfaces, const struct team_t *ally_team void Fmenuchoixpersos (SURFACES *surfaces, POSITIONS *positions) { - TTF_Font *police = NULL; int Vchoix = CLASS_PALADIN; SDL_Color vert; bool continuer = true; @@ -171,8 +172,6 @@ void Fmenuchoixpersos (SURFACES *surfaces, POSITIONS *positions) vert.g = 189; vert.b = 31; - police = TTF_OpenFont ("TIMESI.TTF",36); - /* loop until we have actually chosen our three characters */ while (Vnbperso < 3) { static const char *strings[] = { @@ -193,7 +192,7 @@ void Fmenuchoixpersos (SURFACES *surfaces, POSITIONS *positions) } /* display the string associated with the current character number (aka Please choose ...) */ - surfaces->Ptextechoixmenu = TTF_RenderText_Blended (police, strings[Vnbperso], vert); + surfaces->Ptextechoixmenu = TTF_RenderText_Blended(rpg_g.font, strings[Vnbperso], vert); positions->Vpositiontextemenu.x=XWIN/2-surfaces->Ptextechoixmenu->w/2; SDL_BlitSurface (surfaces->Ptextechoixmenu,NULL,surfaces->Pecran,&positions->Vpositiontextemenu); @@ -243,7 +242,7 @@ void Fmenuchoixpersos (SURFACES *surfaces, POSITIONS *positions) } } } - TTF_CloseFont (police); + SDL_Flip(surfaces->Pecran); ally_team = new_ally_team(surfaces, chr_classes, 3); enemy_team = new_enemy_team(surfaces, ally_team); |