home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 February / maximum-cd-2009-02.iso / DiscContents / SMC_1.6_win32.exe / src / video / font.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-07-01  |  2.1 KB  |  75 lines

  1. /***************************************************************************
  2.  * font.h  -  header for the corresponding cpp file
  3.  *
  4.  * Copyright (C) 2006 - 2008 Florian Richter
  5.  ***************************************************************************/
  6. /*
  7.    This program is free software; you can redistribute it and/or modify
  8.    it under the terms of the GNU General Public License as published by
  9.    the Free Software Foundation; either version 3 of the License, or
  10.    (at your option) any later version.
  11.    
  12.    You should have received a copy of the GNU General Public License
  13.    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  14. */
  15.  
  16. #ifndef SMC_FONT_H
  17. #define SMC_FONT_H
  18.  
  19. #include "../core/globals.h"
  20. #include "../video/img_manager.h"
  21.  
  22. /* *** *** *** *** *** *** *** Font Manager class *** *** *** *** *** *** *** *** *** *** */
  23.  
  24. // Deletes an active Font Surface
  25. void Font_Delete_Ref( GL_Surface *surface );
  26.  
  27. class cFont_Manager
  28. {
  29. public:
  30.     cFont_Manager( void );
  31.     ~cFont_Manager( void );
  32.  
  33.     // initialization
  34.     void Init( void );
  35.  
  36.     // Adds an allocated Font surface
  37.     void Add_Ref( GL_Surface *surface );
  38.     // Deletes an active Font Surface
  39.     void Delete_Ref( GL_Surface *surface );
  40.  
  41.     // Renders the given text into a new surface
  42.     GL_Surface *Render_Text( TTF_Font *font, string text, Color color = static_cast<Uint8>(0) );
  43.  
  44.     /* Saves hardware textures in software memory
  45.     */
  46.     void Grab_Textures( void );
  47.  
  48.     /* Loads the saved software textures back into hardware textures
  49.     */
  50.     void Restore_Textures( void );
  51.  
  52.     // TTF loaded fonts
  53.     TTF_Font *font_normal, *font_small, *font_very_small;
  54.  
  55.     // current active loaded font list
  56.     typedef vector<GL_Surface *> ActiveFontList;
  57.     ActiveFontList active_fonts;
  58.  
  59.     // saved software textures only used for reloading
  60.     Saved_Texture_List software_textures;
  61. };
  62.  
  63. /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
  64.  
  65. // Font Handler
  66. namespace SMC
  67. { // work around conflicts caused by lack of namespace use in smc
  68. extern cFont_Manager *pFont;
  69. }
  70.  
  71. /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
  72. using namespace SMC;
  73.  
  74. #endif
  75.