Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

/include/ZE_ZFont.h

Go to the documentation of this file.
00001 /*******************************************************************************
00002         This file is Part of the ZEngine Library for 2D game development.
00003                    Copyright (C) 2002, 2003 James Turk
00004 
00005                      Licensed under a BSD-style license.
00006 
00007     The maintainer of this library is James Turk (james@conceptofzero.net) 
00008      and the home of this Library is http://www.zengine.sourceforge.net
00009 *******************************************************************************/
00010 
00024 #ifndef __ze_zfont_h__
00025 #define __ze_zfont_h__
00026 
00027 #include "ZE_ZEngine.h"
00028 #include "ZE_ZImage.h"
00029 
00030 #ifdef USE_SDL_TTF
00031 
00032 namespace ZE
00033 {
00034 
00040 class ZFont
00041 {
00042     protected:
00044         ZEngine* rEngine;
00046         TTF_Font *rFont;
00048         string rFilename;
00050         SDL_Color rColor;
00052         SDL_Color rBGColor;
00053 
00054     public:
00055 
00057         //Opening and Closing//
00059 
00065         ZFont();
00066 
00074         ZFont(string filename, int size);
00075 
00081         virtual ~ZFont();
00082 
00090         void Open(string filename, int size);
00091 
00097         void Release();
00098 
00100         //Settings and Drawing//
00102 
00110         void DrawText(string text, ZImage &image) const;
00111 
00119         void DrawShadedText(string text, ZImage &image) const;
00120 
00129         void SetColor(Uint8 r, Uint8 g, Uint8 b);
00130 
00139         void SetBGColor(Uint8 r, Uint8 g, Uint8 b);
00140 
00149         void SetStyle(bool bold, bool italic, bool underline);
00150 
00157         void Resize(int size);
00158 
00160         //Accessors//
00162 
00169         bool IsLoaded() const;
00170 
00177         bool IsBold() const;
00178 
00185         bool IsItalic() const;
00186 
00193         bool IsUnderlined() const;
00194 
00201         int Height() const;
00202 
00209         int LineSkip() const;
00210 
00218         int StringWidth(string text) const;
00219 
00227         int StringHeight(string text) const;
00228 };
00229 
00230 }
00231 
00232 #endif //USE_SDL_TTF
00233 
00234 #endif //__ze_zfont_h__

Generated on Sun Apr 27 17:49:38 2003 for ZEngine by doxygen1.3-rc2