texture_manager.hh

Go to the documentation of this file.
00001 /*
00002  *  texture_manager.hh
00003  *  Stage
00004  *
00005  * Singleton class for loading textures
00006  *
00007  */
00008 #ifndef _TEXTURE_MANAGER_H_
00009 #define _TEXTURE_MANAGER_H_
00010 
00011 #include "stage.hh"
00012 
00013 #include <FL/Fl_Shared_Image.H>
00014 #include <iostream>
00015 
00016 namespace Stg
00017 {
00019   class TextureManager {
00020   private:
00021      TextureManager( void ) { }
00022      
00023      //try to load filename from relative dir, then install path
00024      Fl_Shared_Image* loadImage( const char* filename );
00025      
00026   public:
00027      
00028      //TODO figure out where to store standard textures
00029      GLuint _stall_texture_id;
00030      GLuint _mains_texture_id;
00031      
00032      //TODO make this threadsafe
00033      inline static TextureManager& getInstance( void ) { 
00034         static TextureManager* the_instance = NULL;
00035         //TODO add a lock here
00036         if( the_instance == NULL ) {
00037           the_instance = new TextureManager;
00038         }
00039         return *the_instance;
00040      }
00041      
00043      GLuint loadTexture( const char *filename );
00044      
00045   };
00046 }
00047 #endif //_TEXTURE_MANAGER_H_

Generated on Tue Oct 20 15:42:05 2009 for Stage by  doxygen 1.6.1