comparison dmtext.h @ 75:e6535609c161

Initial implementation of loading and saving of bitmap fonts.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 02 Oct 2012 05:51:08 +0300
parents 03375aa0ef2b
children b10884934aca
comparison
equal deleted inserted replaced
74:23ac82365a65 75:e6535609c161
19 #endif 19 #endif
20 20
21 /* Bitmapped fonts and text 21 /* Bitmapped fonts and text
22 */ 22 */
23 #ifdef DM_GFX_BM_TEXT 23 #ifdef DM_GFX_BM_TEXT
24
25 #define DMFONT_MAGIC "DMFONT"
26 #define DMFONT_VERSION 0x0100
27
24 typedef struct 28 typedef struct
25 { 29 {
26 int width, height; 30 int width, height;
27 31
28 int nglyphs; 32 int nglyphs;
31 35
32 36
33 DMBitmapFont *dmNewBitmapFont(int nglyphs); 37 DMBitmapFont *dmNewBitmapFont(int nglyphs);
34 int dmFreeBitmapFont(DMBitmapFont *font); 38 int dmFreeBitmapFont(DMBitmapFont *font);
35 int dmLoadBitmapFont(DMResource *res, DMBitmapFont **pfont); 39 int dmLoadBitmapFont(DMResource *res, DMBitmapFont **pfont);
40 int dmSaveBitmapFont(DMResource *res, DMBitmapFont *font);
36 int dmCreateBitmapFontFromImage(SDL_Surface *image, int width, int height, DMBitmapFont **pfont); 41 int dmCreateBitmapFontFromImage(SDL_Surface *image, int width, int height, DMBitmapFont **pfont);
37 42
38 void dmDrawBMTextConst(SDL_Surface *screen, DMBitmapFont *font, int mode, int xc, int yc, const char *str); 43 void dmDrawBMTextConst(SDL_Surface *screen, DMBitmapFont *font, int mode, int xc, int yc, const char *str);
39 void dmDrawBMTextVA(SDL_Surface *screen, DMBitmapFont *font, int mode, int xc, int yc, const char *fmt, va_list ap); 44 void dmDrawBMTextVA(SDL_Surface *screen, DMBitmapFont *font, int mode, int xc, int yc, const char *fmt, va_list ap);
40 void dmDrawBMText(SDL_Surface *screen, DMBitmapFont *font, int mode, int xc, int yc, const char *fmt, ...); 45 void dmDrawBMText(SDL_Surface *screen, DMBitmapFont *font, int mode, int xc, int yc, const char *fmt, ...);