texture_manager.hh

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_internal.hh"
00012 
00013 #include <FL/Fl_Shared_Image.H>
00014 #include <glib.h>
00015 #include <iostream>
00016 
00018 class TextureManager {
00019 private:
00020     TextureManager( void ) { }
00021 
00022     //try to load filename from relative dir, then install path
00023     Fl_Shared_Image* loadImage( const char* filename );
00024     
00025 public:
00026 
00027     //TODO figure out where to store standard textures
00028     GLuint _stall_texture_id;
00029     
00030     //TODO make this threadsafe
00031     inline static TextureManager& getInstance( void ) { 
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_

Generated on Wed Jul 30 11:36:06 2008 for Stage by  doxygen 1.4.7