Mercurial > hg > dmlib
annotate dmtext.h @ 65:03375aa0ef2b
Implement some new functions for bitmapped font handling.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 01 Oct 2012 11:20:56 +0300 |
parents | 3d9da937db69 |
children | e6535609c161 |
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 */ |
63
3d9da937db69
More work on the text support.
Matti Hamalainen <ccr@tnsp.org>
parents:
60
diff
changeset
|
23 #ifdef DM_GFX_BM_TEXT |
60
f28cd66356f6
Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
24 typedef struct |
f28cd66356f6
Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
25 { |
f28cd66356f6
Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
26 int width, height; |
f28cd66356f6
Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
27 |
f28cd66356f6
Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
28 int nglyphs; |
f28cd66356f6
Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
29 SDL_Surface **glyphs; |
f28cd66356f6
Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
30 } DMBitmapFont; |
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 |
65
03375aa0ef2b
Implement some new functions for bitmapped font handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
63
diff
changeset
|
33 DMBitmapFont *dmNewBitmapFont(int nglyphs); |
03375aa0ef2b
Implement some new functions for bitmapped font handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
63
diff
changeset
|
34 int dmFreeBitmapFont(DMBitmapFont *font); |
03375aa0ef2b
Implement some new functions for bitmapped font handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
63
diff
changeset
|
35 int dmLoadBitmapFont(DMResource *res, DMBitmapFont **pfont); |
03375aa0ef2b
Implement some new functions for bitmapped font handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
63
diff
changeset
|
36 int dmCreateBitmapFontFromImage(SDL_Surface *image, int width, int height, DMBitmapFont **pfont); |
60
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 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
|
39 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
|
40 void dmDrawBMText(SDL_Surface *screen, DMBitmapFont *font, int mode, int xc, int yc, const char *fmt, ...); |
63
3d9da937db69
More work on the text support.
Matti Hamalainen <ccr@tnsp.org>
parents:
60
diff
changeset
|
41 #endif |
60
f28cd66356f6
Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
42 |
f28cd66356f6
Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
43 |
f28cd66356f6
Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
44 /* TTF text drawing |
f28cd66356f6
Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
45 */ |
f28cd66356f6
Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
46 #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
|
47 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
|
48 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
|
49 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
|
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 |
f28cd66356f6
Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
53 #ifdef __cplusplus |
f28cd66356f6
Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
54 } |
f28cd66356f6
Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
55 #endif |
f28cd66356f6
Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
56 |
f28cd66356f6
Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
57 #endif // DMFONT_H |