diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dmtext.h	Mon Oct 01 09:46:56 2012 +0300
@@ -0,0 +1,52 @@
+/*
+ * 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
+ */
+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, ...);
+
+
+/* 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