font_gfxdraw added fro drawing with the gfx engine

origin
stpohle 22 years ago
parent fc002a8d15
commit 3ebf72b4d7

@ -1,4 +1,4 @@
/* $Id: font.c,v 1.8 2003/07/27 13:29:25 stpohle Exp $ */ /* $Id: font.c,v 1.9 2003/08/29 21:26:47 stpohle Exp $ */
// Using Fonts in SDL // Using Fonts in SDL
#include <string.h> #include <string.h>
@ -35,6 +35,32 @@ font_draw (int x, int y, char *text, int size)
}; };
void
font_gfxdraw (int x, int y, char *text, int size, int ypos)
{
int i,
c;
SDL_Rect src,
dest;
src.y = 0;
dest.w = src.w = font[size].size.x;
dest.h = src.h = font[size].size.y;
dest.x = x;
dest.y = y;
for (i = 0; text[i] != 0; i++) {
c = text[i];
src.x = font[size].size.x * (c & 15);
src.y = font[size].size.y * ((c & 240) >> 4);
gfx_blit (font[size].image, &src, gfx.screen, &dest, y);
dest.x += font[size].size.x;
}
font_lastsize = font[size].size;
};
void font_load () { void font_load () {
int i; int i;

@ -15,6 +15,7 @@ extern _font font[3];
extern void font_setcolor (unsigned char r, unsigned char g, unsigned char b, int size); extern void font_setcolor (unsigned char r, unsigned char g, unsigned char b, int size);
extern void font_draw (int x, int y, char *text, int size); extern void font_draw (int x, int y, char *text, int size);
extern void font_gfxdraw (int x, int y, char *text, int size, int ypos);
extern void font_drawbold (int x, int y, char *text, int size, int bold); extern void font_drawbold (int x, int y, char *text, int size, int bold);
extern void font_load (); extern void font_load ();
extern void font_free (); extern void font_free ();

Loading…
Cancel
Save