comparison dmtext_bm.c @ 129:975725e3126d

Cleanup some prototyping code.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 04 Oct 2012 09:39:01 +0300
parents 7160c1d71ade
children b5569c84f00a
comparison
equal deleted inserted replaced
128:afa28947e400 129:975725e3126d
9 9
10 10
11 void dmDrawBMTextConst(SDL_Surface *screen, DMBitmapFont *font, int mode, int xc, int yc, const char *fmt) 11 void dmDrawBMTextConst(SDL_Surface *screen, DMBitmapFont *font, int mode, int xc, int yc, const char *fmt)
12 { 12 {
13 const char *ptr = fmt; 13 const char *ptr = fmt;
14 DMScaledBlitFunc blit = dmGetScaledBlitFunc(font->glyphs[0]->format, screen->format, mode); 14 DMUnscaledBlitFunc blit = NULL;
15 15
16 while (*ptr) 16 while (*ptr)
17 { 17 {
18 int ch = *ptr++;
18 SDL_Surface *glyph; 19 SDL_Surface *glyph;
19 int pos; 20
20 int ch = *ptr++; 21 if (ch >= 0 && ch < font->nglyphs && (glyph = font->glyphs[ch]) != NULL)
21 22 {
22 if (ch == '_') 23 if (blit == NULL)
23 { 24 blit = dmGetUnscaledBlitFunc(glyph->format, screen->format, mode);
24 xc += 4; 25
25 continue; 26 blit(glyph, xc, yc, screen);
26 }
27 else
28 if (ch >= 'A' && ch <= 'Z')
29 pos = ch - 'A' + 256 + 1;
30 else
31 if (ch >= 'a' && ch <= 'z')
32 pos = ch - 'a' + 1;
33 else
34 if (ch >= '0' && ch <= '9')
35 pos = ch - '0' + 48;
36 else
37 pos = ch;
38
39 if (pos >= 0 && pos < font->nglyphs)
40 {
41 glyph = font->glyphs[pos];
42 blit(glyph, xc, yc, glyph->w, glyph->h, screen);
43 xc += glyph->w; 27 xc += glyph->w;
44 } 28 }
45 else 29 else
46 xc += font->width; 30 xc += font->width;
47 } 31 }