Skip to content

Commit

Permalink
Optimization: replace TTF Fonts in parchments with graphics
Browse files Browse the repository at this point in the history
 create mode 100644 graphics/pergamino1.png
 create mode 100644 graphics/pergamino2.png
 create mode 100644 graphics/pergamino3.png
 create mode 100644 graphics/pergamino4.png
 create mode 100644 graphics/pergamino5.png
 create mode 100644 graphics/pergamino6.png
  • Loading branch information
nevat committed Aug 24, 2014
1 parent 647077d commit b1ce2a5
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 41 deletions.
Binary file added graphics/pergamino1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added graphics/pergamino2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added graphics/pergamino3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added graphics/pergamino4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added graphics/pergamino5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added graphics/pergamino6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions src/comun.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
#define RUTA_GRA_FUENTES "graphics/fonts.png"
#define RUTA_GRA_TEMP "graphics/temp.png"
#define RUTA_GRA_PERGAMINO "graphics/pergamino.png"
#define RUTA_GRA_PERGAMINO1 "graphics/pergamino1.png"
#define RUTA_GRA_PERGAMINO2 "graphics/pergamino2.png"
#define RUTA_GRA_PERGAMINO3 "graphics/pergamino3.png"
#define RUTA_GRA_PERGAMINO4 "graphics/pergamino4.png"
#define RUTA_GRA_PERGAMINO5 "graphics/pergamino5.png"
#define RUTA_GRA_PERGAMINO6 "graphics/pergamino6.png"
#define RUTA_GRA_PERGAMINO_ROJO "graphics/pergaminorojo.png"
#define RUTA_GRA_PERGAMINO_AZUL "graphics/pergaminoazul.png"
#define RUTA_GRA_TITLE_MD "graphics/titlemd.png"
Expand Down Expand Up @@ -81,6 +87,12 @@
#define RUTA_GRA_FUENTES "/usr/share/abbaye/graphics/fonts.png"
#define RUTA_GRA_TEMP "/usr/share/abbaye/graphics/temp.png"
#define RUTA_GRA_PERGAMINO "/usr/share/abbaye/graphics/pergamino.png"
#define RUTA_GRA_PERGAMINO1 "/usr/share/abbaye/graphics/pergamino1.png"
#define RUTA_GRA_PERGAMINO2 "/usr/share/abbaye/graphics/pergamino2.png"
#define RUTA_GRA_PERGAMINO3 "/usr/share/abbaye/graphics/pergamino3.png"
#define RUTA_GRA_PERGAMINO4 "/usr/share/abbaye/graphics/pergamino4.png"
#define RUTA_GRA_PERGAMINO5 "/usr/share/abbaye/graphics/pergamino5.png"
#define RUTA_GRA_PERGAMINO6 "/usr/share/abbaye/graphics/pergamino6.png"
#define RUTA_GRA_PERGAMINO_ROJO "/usr/share/abbaye/graphics/pergaminorojo.png"
#define RUTA_GRA_PERGAMINO_AZUL "/usr/share/abbaye/graphics/pergaminoazul.png"
#define RUTA_GRA_TITLE_MD "/usr/share/abbaye/graphics/titlemd.png"
Expand Down
52 changes: 11 additions & 41 deletions src/pantallas.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,57 +271,27 @@ void mostrarpergamino (SDL_Surface *ventana, int *pergamino) {

SDL_Surface *pergamin = NULL;
SDL_Surface *temp = NULL;
TTF_Font *fuente = NULL;
SDL_Surface *marcador = NULL;
SDL_Color fgcolor = {0,0,0};
SDL_Rect desmarcador = {0,0,0,0};
int alto = 0;
int ancho = 0;
char renglon1[18];
char renglon2[20];

fuente = TTF_OpenFont(RUTA_FON_VENICE_CLASSIC, 18);
temp = IMG_Load(RUTA_GRA_PERGAMINO);
pergamin = SDL_DisplayFormat(temp);
SDL_FreeSurface(temp);

SDL_BlitSurface (pergamin, NULL, ventana, NULL);
SDL_FreeSurface(pergamin);

switch (*pergamino) {
case 3: sprintf (renglon1, "Twelve crosses");
sprintf (renglon2, "against the devil");
case 3: temp = IMG_Load(RUTA_GRA_PERGAMINO1);
break;
case 8: sprintf (renglon1, "Twelve brothers");
sprintf (renglon2, "hid and died here");
case 8: temp = IMG_Load(RUTA_GRA_PERGAMINO2);
break;
case 12: sprintf (renglon1, "Four brothers");
sprintf (renglon2, "changed their faith");
case 12: temp = IMG_Load(RUTA_GRA_PERGAMINO3);
break;
case 14: sprintf (renglon1, "An invisible path");
sprintf (renglon2, "over a wood bridge");
case 14: temp = IMG_Load(RUTA_GRA_PERGAMINO4);
break;
case 16: sprintf (renglon1, "Jump to death");
sprintf (renglon2, "and prove your faith");
case 16: temp = IMG_Load(RUTA_GRA_PERGAMINO5);
break;
case 21: sprintf (renglon1, "Glide through");
sprintf (renglon2, "the beast cage");
case 21: temp = IMG_Load(RUTA_GRA_PERGAMINO6);
break;
}

marcador = TTF_RenderText_Blended(fuente, renglon1, fgcolor);
TTF_SizeText(fuente, renglon1, &ancho, &alto);
desmarcador.x = 127 - (ancho / 2);
desmarcador.y = 81 - alto;
SDL_BlitSurface(marcador, NULL, ventana, &desmarcador);
SDL_FreeSurface (marcador);
marcador = TTF_RenderText_Blended(fuente, renglon2, fgcolor);
TTF_SizeText(fuente, renglon2, &ancho, &alto);
desmarcador.x = 127 - (ancho / 2);
desmarcador.y = 85;
SDL_BlitSurface(marcador, NULL, ventana, &desmarcador);
SDL_FreeSurface (marcador);
TTF_CloseFont(fuente);
pergamin = SDL_DisplayFormat(temp);
SDL_FreeSurface(temp);

SDL_BlitSurface (pergamin, NULL, ventana, NULL);
SDL_FreeSurface(pergamin);

}

Expand Down

0 comments on commit b1ce2a5

Please sign in to comment.