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   public:
00024         
00025         //TODO figure out where to store standard textures
00026         GLuint _stall_texture_id;
00027         GLuint _mains_texture_id;
00028         
00029         //TODO make this threadsafe
00030         static TextureManager& getInstance( void ) 
00031         { 
00032             static TextureManager* the_instance = NULL;
00033             //TODO add a lock here
00034             if( the_instance == NULL ) {
00035                 the_instance = new TextureManager;
00036             }
00037             return *the_instance;
00038         }
00039         
00041         GLuint loadTexture( const char *filename );
00042         
00043   };
00044 }
00045 #endif //_TEXTURE_MANAGER_H_