aboutsummaryrefslogtreecommitdiff
path: root/saga/font.h
diff options
context:
space:
mode:
authorEugene Sandulenko2004-08-03 00:06:18 +0000
committerEugene Sandulenko2004-08-03 00:06:18 +0000
commitfe1ab79beeec83d156572c12a8f3e1cb874d7d7d (patch)
tree8e0d76681289fa5caa7ba3d67a3cfb4baea0693d /saga/font.h
parent8585d77d34317412dbacbac058d704b98b8a0a78 (diff)
downloadscummvm-rg350-fe1ab79beeec83d156572c12a8f3e1cb874d7d7d.tar.gz
scummvm-rg350-fe1ab79beeec83d156572c12a8f3e1cb874d7d7d.tar.bz2
scummvm-rg350-fe1ab79beeec83d156572c12a8f3e1cb874d7d7d.zip
Move FONT_* to class.
svn-id: r14449
Diffstat (limited to 'saga/font.h')
-rw-r--r--saga/font.h53
1 files changed, 39 insertions, 14 deletions
diff --git a/saga/font.h b/saga/font.h
index a3e5843f84..ac3439bbc6 100644
--- a/saga/font.h
+++ b/saga/font.h
@@ -26,6 +26,8 @@
#ifndef SAGA_FONT_H__
#define SAGA_FONT_H__
+#include "saga/gfx.h"
+
namespace Saga {
#define R_FONT_SHOWUNDEFINED 1 // Define to draw undefined characters * as ?'s
@@ -46,6 +48,20 @@ namespace Saga {
#define SAGA_FONT_HEADER_LEN 6
+enum FONT_ID {
+ SMALL_FONT_ID,
+ MEDIUM_FONT_ID,
+ BIG_FONT_ID
+};
+
+enum FONT_EFFECT_FLAGS {
+ FONT_NORMAL = 0x00,
+ FONT_OUTLINE = 0x01,
+ FONT_SHADOW = 0x02,
+ FONT_BOLD = 0x04,
+ FONT_CENTERED = 0x08
+};
+
struct R_FONT_HEADER {
int c_height;
int c_width;
@@ -80,23 +96,32 @@ struct R_FONT {
size_t res_len;
};
-struct R_FONT_MODULE {
- int init;
- R_RSCFILE_CONTEXT *font_ctxt;
+class Font {
+ public:
+ Font(SagaEngine *vm);
+ ~Font(void);
+ int draw(int font_id, R_SURFACE *ds, const char *draw_str, size_t draw_str_len,
+ int text_x, int text_y, int color, int effect_color, int flags);
+ int getStringWidth(int font_id, const char *test_str, size_t test_str_ct, int flags);
+ int getHeight(int font_id);
- int n_fonts;
- R_FONT **fonts;
+ private:
- int err_n;
- const char *err_str;
-};
+ int loadFont(uint32 font_rn, int font_id);
+ R_FONT_STYLE *createOutline(R_FONT_STYLE * src_font);
+ int outFont(R_FONT_STYLE *font, R_SURFACE * ds, const char *draw_str, size_t draw_str_ct,
+ int text_x, int text_y, int color);
+ int getByteLen(int num_bits);
+
+ static const int _charMap[256];
+ SagaEngine *_vm;
-int FONT_Load(uint32 font_rn, int font_id);
-static R_FONT_STYLE *FONT_CreateOutline(R_FONT_STYLE * src_font);
-int FONT_Out(R_FONT_STYLE *font, R_SURFACE * ds, const char *draw_str, size_t draw_str_ct,
- int text_x, int text_y, int color);
-static int GetByteLen(int num_bits);
-extern int CharMap[];
+ bool _initialized;
+ R_RSCFILE_CONTEXT *_font_ctxt;
+
+ int _n_fonts;
+ R_FONT **_fonts;
+};
} // End of namespace Saga