Skip to content

Commit b1ce2a5

Browse files
committed
Optimization: replace TTF Fonts in parchments with graphics
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
1 parent 647077d commit b1ce2a5

8 files changed

+23
-41
lines changed

graphics/pergamino1.png

624 Bytes
Loading

graphics/pergamino2.png

626 Bytes
Loading

graphics/pergamino3.png

657 Bytes
Loading

graphics/pergamino4.png

684 Bytes
Loading

graphics/pergamino5.png

672 Bytes
Loading

graphics/pergamino6.png

619 Bytes
Loading

src/comun.h

+12
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818
#define RUTA_GRA_FUENTES "graphics/fonts.png"
1919
#define RUTA_GRA_TEMP "graphics/temp.png"
2020
#define RUTA_GRA_PERGAMINO "graphics/pergamino.png"
21+
#define RUTA_GRA_PERGAMINO1 "graphics/pergamino1.png"
22+
#define RUTA_GRA_PERGAMINO2 "graphics/pergamino2.png"
23+
#define RUTA_GRA_PERGAMINO3 "graphics/pergamino3.png"
24+
#define RUTA_GRA_PERGAMINO4 "graphics/pergamino4.png"
25+
#define RUTA_GRA_PERGAMINO5 "graphics/pergamino5.png"
26+
#define RUTA_GRA_PERGAMINO6 "graphics/pergamino6.png"
2127
#define RUTA_GRA_PERGAMINO_ROJO "graphics/pergaminorojo.png"
2228
#define RUTA_GRA_PERGAMINO_AZUL "graphics/pergaminoazul.png"
2329
#define RUTA_GRA_TITLE_MD "graphics/titlemd.png"
@@ -81,6 +87,12 @@
8187
#define RUTA_GRA_FUENTES "/usr/share/abbaye/graphics/fonts.png"
8288
#define RUTA_GRA_TEMP "/usr/share/abbaye/graphics/temp.png"
8389
#define RUTA_GRA_PERGAMINO "/usr/share/abbaye/graphics/pergamino.png"
90+
#define RUTA_GRA_PERGAMINO1 "/usr/share/abbaye/graphics/pergamino1.png"
91+
#define RUTA_GRA_PERGAMINO2 "/usr/share/abbaye/graphics/pergamino2.png"
92+
#define RUTA_GRA_PERGAMINO3 "/usr/share/abbaye/graphics/pergamino3.png"
93+
#define RUTA_GRA_PERGAMINO4 "/usr/share/abbaye/graphics/pergamino4.png"
94+
#define RUTA_GRA_PERGAMINO5 "/usr/share/abbaye/graphics/pergamino5.png"
95+
#define RUTA_GRA_PERGAMINO6 "/usr/share/abbaye/graphics/pergamino6.png"
8496
#define RUTA_GRA_PERGAMINO_ROJO "/usr/share/abbaye/graphics/pergaminorojo.png"
8597
#define RUTA_GRA_PERGAMINO_AZUL "/usr/share/abbaye/graphics/pergaminoazul.png"
8698
#define RUTA_GRA_TITLE_MD "/usr/share/abbaye/graphics/titlemd.png"

src/pantallas.c

+11-41
Original file line numberDiff line numberDiff line change
@@ -271,57 +271,27 @@ void mostrarpergamino (SDL_Surface *ventana, int *pergamino) {
271271

272272
SDL_Surface *pergamin = NULL;
273273
SDL_Surface *temp = NULL;
274-
TTF_Font *fuente = NULL;
275-
SDL_Surface *marcador = NULL;
276-
SDL_Color fgcolor = {0,0,0};
277-
SDL_Rect desmarcador = {0,0,0,0};
278-
int alto = 0;
279-
int ancho = 0;
280-
char renglon1[18];
281-
char renglon2[20];
282-
283-
fuente = TTF_OpenFont(RUTA_FON_VENICE_CLASSIC, 18);
284-
temp = IMG_Load(RUTA_GRA_PERGAMINO);
285-
pergamin = SDL_DisplayFormat(temp);
286-
SDL_FreeSurface(temp);
287-
288-
SDL_BlitSurface (pergamin, NULL, ventana, NULL);
289-
SDL_FreeSurface(pergamin);
290274

291275
switch (*pergamino) {
292-
case 3: sprintf (renglon1, "Twelve crosses");
293-
sprintf (renglon2, "against the devil");
276+
case 3: temp = IMG_Load(RUTA_GRA_PERGAMINO1);
294277
break;
295-
case 8: sprintf (renglon1, "Twelve brothers");
296-
sprintf (renglon2, "hid and died here");
278+
case 8: temp = IMG_Load(RUTA_GRA_PERGAMINO2);
297279
break;
298-
case 12: sprintf (renglon1, "Four brothers");
299-
sprintf (renglon2, "changed their faith");
280+
case 12: temp = IMG_Load(RUTA_GRA_PERGAMINO3);
300281
break;
301-
case 14: sprintf (renglon1, "An invisible path");
302-
sprintf (renglon2, "over a wood bridge");
282+
case 14: temp = IMG_Load(RUTA_GRA_PERGAMINO4);
303283
break;
304-
case 16: sprintf (renglon1, "Jump to death");
305-
sprintf (renglon2, "and prove your faith");
284+
case 16: temp = IMG_Load(RUTA_GRA_PERGAMINO5);
306285
break;
307-
case 21: sprintf (renglon1, "Glide through");
308-
sprintf (renglon2, "the beast cage");
286+
case 21: temp = IMG_Load(RUTA_GRA_PERGAMINO6);
309287
break;
310288
}
311289

312-
marcador = TTF_RenderText_Blended(fuente, renglon1, fgcolor);
313-
TTF_SizeText(fuente, renglon1, &ancho, &alto);
314-
desmarcador.x = 127 - (ancho / 2);
315-
desmarcador.y = 81 - alto;
316-
SDL_BlitSurface(marcador, NULL, ventana, &desmarcador);
317-
SDL_FreeSurface (marcador);
318-
marcador = TTF_RenderText_Blended(fuente, renglon2, fgcolor);
319-
TTF_SizeText(fuente, renglon2, &ancho, &alto);
320-
desmarcador.x = 127 - (ancho / 2);
321-
desmarcador.y = 85;
322-
SDL_BlitSurface(marcador, NULL, ventana, &desmarcador);
323-
SDL_FreeSurface (marcador);
324-
TTF_CloseFont(fuente);
290+
pergamin = SDL_DisplayFormat(temp);
291+
SDL_FreeSurface(temp);
292+
293+
SDL_BlitSurface (pergamin, NULL, ventana, NULL);
294+
SDL_FreeSurface(pergamin);
325295

326296
}
327297

0 commit comments

Comments
 (0)