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 
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         SDL_Color rColor;
00048         SDL_Color rBGColor;
00049 
00050     public:
00051 
00053         //Opening and Closing//
00055 
00061         ZFont();
00062 
00070         ZFont(std::string filename, int size);
00071 
00077         virtual ~ZFont();
00078 
00086         void Open(std::string filename, int size);
00087 
00093         void Release();
00094 
00096         //Settings and Drawing//
00098 
00106         void DrawText(std::string text, ZImage &image) const;
00107 
00115         void DrawShadedText(std::string text, ZImage &image) const;
00116 
00126         void SetColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a=255);
00127 
00136         void SetBGColor(Uint8 r, Uint8 g, Uint8 b);
00137 
00146         void SetStyle(bool bold, bool italic, bool underline);
00147 
00154         void Resize(int size);
00155 
00157         //Accessors//
00159 
00166         bool IsLoaded() const;
00167 
00174         bool IsBold() const;
00175 
00182         bool IsItalic() const;
00183 
00190         bool IsUnderlined() const;
00191 
00198         int Height() const;
00199 
00206         int LineSkip() const;
00207 
00215         int StringWidth(std::string text) const;
00216 
00224         int StringHeight(std::string text) const;
00225 };
00226 
00227 }
00228 
00229 #endif //USE_SDL_TTF
00230 
00231 #endif //__ze_zfont_h__

Generated on Sun Jun 29 14:13:51 2003 for ZEngine by doxygen1.3