return instead of assert
This commit is contained in:
parent
c679e2bf9a
commit
dadc103aed
2 changed files with 8 additions and 2 deletions
|
@ -17,6 +17,8 @@ int initFont(TTF_Font **, char *, int);
|
|||
*
|
||||
* Renvoie 1 en cas de problème d'écriture sur la surface
|
||||
*
|
||||
* Renvoie 2 en cas de problème de surface avec la SDL
|
||||
*
|
||||
* Renvoie 0 en cas de succès */
|
||||
int writeText(GLuint *, TTF_Font *, char *, SDL_Color);
|
||||
|
||||
|
|
|
@ -27,8 +27,12 @@ int writeText(GLuint *_textTexId, TTF_Font *font, char *text, SDL_Color color) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
assert((s = SDL_CreateRGBSurface(0, d->w, d->h, 32, R_MASK, G_MASK, B_MASK,
|
||||
A_MASK)));
|
||||
if ((s = SDL_CreateRGBSurface(0, d->w, d->h, 32, R_MASK, G_MASK, B_MASK,
|
||||
A_MASK))) {
|
||||
freeFont(font);
|
||||
fprintf(stderr, "Erreur SDL : %s\n", SDL_GetError());
|
||||
return 2;
|
||||
}
|
||||
SDL_BlitSurface(d, NULL, s, NULL);
|
||||
SDL_FreeSurface(d);
|
||||
|
||||
|
|
Reference in a new issue