00001 #ifndef _Font_H_
00002 #define _Font_H_
00003
00004 #include <string.h>
00005 #include "Entity2D.h"
00006 #include "renderer.h"
00007 #include "TextureManager.h"
00008
00009
00010
00011 namespace zak {
00012
00062 class ZAKENGINE_API Font : public Entity2D {
00063 private:
00064 TexVertex *_pVertex;
00065 Texture *_pTexture;
00066 char *_pszText;
00067 int _iTextLenght;
00068 int _fontWidth;
00069 int _fontHeight;
00070 int _fontSideCount;
00071 float _spacing;
00072 int _set;
00073
00074 DWORD _magFilter;
00075 DWORD _minFilter;
00076
00077 static void ConstructArray(vector<Font> *self) {
00078 new(self) vector<Font>();
00079 }
00080
00081 static void ConstructArray(int length, vector<Font> *self) {
00082 new(self) vector<Font>(length);
00083 }
00084
00085 static void DestructArray(vector<Font> *self) {
00086 self->~vector();
00087 }
00088
00089
00090 static void Constructor(Font *spr){
00091 new(spr) Font();
00092 }
00093 static void Destructor(Font *spr){
00094 spr->~Font();
00095 }
00096
00097 bool Load(const string &filename) {
00098 return LoadIni(filename.c_str());
00099 }
00100
00101 bool Load(const char *pszImageFilename, unsigned int uiColorKey, bool persist = false);
00102
00103 void SetTextStr(const string &text){ SetText(text.c_str()); }
00104
00105 public:
00106
00111 void ShowSet(int set) { if (set <= 1 && set >= 0) _set = set; }
00112
00119 void SetText(const char *psz_Text,...);
00120
00124 void Draw();
00125
00131 bool LoadIni(const char *pszFilename);
00132
00137 bool Unload();
00138
00139
00140 static bool RegisterFont(char *className=NULL);
00141
00145 Font();
00146
00150 ~Font();
00151 };
00152
00153 }
00154
00155 #endif // _Font_H_