view 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
line wrap: on
line source

/*
 * DMLib
 * -- Bitmap font support
 * Programmed and designed by Matti 'ccr' Hamalainen
 * (C) Copyright 2012 Tecnic Software productions (TNSP)
 */
#ifndef DMFONT_H
#define DMFONT_H

#include "dmlib.h"
#include "dmres.h"

#ifdef DM_GFX_TTF_TEXT
#include <SDL_ttf.h>
#endif

#ifdef __cplusplus
extern "C" {
#endif

/* Bitmapped fonts and text
 */
#ifdef DM_GFX_BM_TEXT
typedef struct
{
    int width, height;

    int nglyphs;
    SDL_Surface **glyphs;
} DMBitmapFont;


int dmLoadBitmapFont(DMResource *res, DMBitmapFont **font);

void dmDrawBMTextConst(SDL_Surface *screen, DMBitmapFont *font, int mode, int xc, int yc, const char *str);
void dmDrawBMTextVA(SDL_Surface *screen, DMBitmapFont *font, int mode, int xc, int yc, const char *fmt, va_list ap);
void dmDrawBMText(SDL_Surface *screen, DMBitmapFont *font, int mode, int xc, int yc, const char *fmt, ...);
#endif


/* TTF text drawing
 */
#ifdef DM_GFX_TTF_TEXT
void       dmDrawTTFTextConst(SDL_Surface *screen, TTF_Font *font, SDL_Color col, int x, int y, const char *fmt);
void       dmDrawTTFTextVA(SDL_Surface *screen, TTF_Font *font, SDL_Color col, int x, int y, const char *fmt, va_list ap);
void       dmDrawTTFText(SDL_Surface *screen, TTF_Font *font, SDL_Color col, int x, int y, const char *fmt, ...);
#endif


#ifdef __cplusplus
}
#endif

#endif // DMFONT_H