annotate dmtext.h @ 63:3d9da937db69

More work on the text support.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 01 Oct 2012 10:42:56 +0300
parents f28cd66356f6
children 03375aa0ef2b
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 */
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
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33 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
34
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 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
36 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
37 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
38 #endif
60
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39
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 /* TTF text drawing
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 #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
44 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
45 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
46 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
47 #endif
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48
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 #ifdef __cplusplus
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
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53
f28cd66356f6 Initial work for bitmapped fonts and text drawing. Also moved TTF header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54 #endif // DMFONT_H