annotate dmtext.h @ 60:f28cd66356f6

Initial work for bitmapped fonts and text drawing. Also moved TTF header stuff to dmtext.h.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 01 Oct 2012 09:46:56 +0300
parents
children 3d9da937db69
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
60
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 /*
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 * DMLib
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 * -- Bitmap font support
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 * Programmed and designed by Matti 'ccr' Hamalainen
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 * (C) Copyright 2012 Tecnic Software productions (TNSP)
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 */
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7 #ifndef DMFONT_H
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8 #define DMFONT_H
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 #include "dmlib.h"
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 #include "dmres.h"
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13 #ifdef DM_GFX_TTF_TEXT
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 #include <SDL_ttf.h>
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 #endif
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 #ifdef __cplusplus
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18 extern "C" {
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19 #endif
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21 /* Bitmapped fonts and text
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 */
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23 typedef struct
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24 {
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25 int width, height;
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27 int nglyphs;
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28 SDL_Surface **glyphs;
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29 } DMBitmapFont;
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32 int dmLoadBitmapFont(DMResource *res, DMBitmapFont **font);
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34 void dmDrawBMTextConst(SDL_Surface *screen, DMBitmapFont *font, int mode, int xc, int yc, const char *str);
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 void dmDrawBMTextVA(SDL_Surface *screen, DMBitmapFont *font, int mode, int xc, int yc, const char *fmt, va_list ap);
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36 void dmDrawBMText(SDL_Surface *screen, DMBitmapFont *font, int mode, int xc, int yc, const char *fmt, ...);
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 /* TTF text drawing
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40 */
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41 #ifdef DM_GFX_TTF_TEXT
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42 void dmDrawTTFTextConst(SDL_Surface *screen, TTF_Font *font, SDL_Color col, int x, int y, const char *fmt);
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43 void dmDrawTTFTextVA(SDL_Surface *screen, TTF_Font *font, SDL_Color col, int x, int y, const char *fmt, va_list ap);
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
44 void dmDrawTTFText(SDL_Surface *screen, TTF_Font *font, SDL_Color col, int x, int y, const char *fmt, ...);
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
45 #endif
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48 #ifdef __cplusplus
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49 }
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50 #endif
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
51
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52 #endif // DMFONT_H