Main Page   Namespace List   Class Hierarchy   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 
00020 #ifndef __ze_zfont_h__
00021 #define __ze_zfont_h__
00022 
00023 #include "ZE_ZEngine.h"
00024 #include "ZE_ZImage.h"
00025 
00026 #ifdef USE_SDL_TTF
00027 
00028 namespace ZE
00029 {
00030 
00036 class ZFont
00037 {
00038     protected:
00040         ZEngine* rEngine;
00042         TTF_Font *rFont;
00044         std::string rFilename;
00046         std::string rZipname;
00048         SDL_Color rColor;
00050         SDL_Color rBGColor;
00051 
00052     public:
00053 
00055         //Opening and Closing//
00057 
00063         ZFont();
00064 
00072         ZFont(std::string filename, int size);
00073 
00079         virtual ~ZFont();
00080 
00088         void Open(std::string filename, int size);
00089 
00098         void OpenFromZip(std::string zipname, std::string filename, int size);
00099 
00105         void Release();
00106 
00108         //Settings and Drawing//
00110 
00118         void DrawText(std::string text, ZImage &image) const;
00119 
00127         void DrawShadedText(std::string text, ZImage &image) const;
00128 
00138         void SetColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a=255);
00139 
00148         void SetBGColor(Uint8 r, Uint8 g, Uint8 b);
00149 
00158         void SetStyle(bool bold, bool italic, bool underline);
00159 
00166         void Resize(int size);
00167 
00169         //Accessors//
00171 
00178         bool IsLoaded() const;
00179 
00186         bool IsBold() const;
00187 
00194         bool IsItalic() const;
00195 
00202         bool IsUnderlined() const;
00203 
00210         int Height() const;
00211 
00218         int LineSkip() const;
00219 
00227         int StringWidth(std::string text) const;
00228 
00236         int StringHeight(std::string text) const;
00237 };
00238 
00239 }
00240 
00241 #endif //USE_SDL_TTF
00242 
00243 #endif //__ze_zfont_h__

Generated on Sun Oct 5 19:34:45 2003 for ZEngine by doxygen1.3