Changeset 4597 in orxonox.OLD for orxonox/trunk/src/util/resource_manager.h
- Timestamp:
- Jun 11, 2005, 12:55:48 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/util/resource_manager.h
r4534 r4597 1 /*! 1 /*! 2 2 \file resource_manager.h 3 3 \brief The Resource Manager checks if a file/resource is loaded. 4 4 5 If a file/resource was already loaded the resourceManager will 5 If a file/resource was already loaded the resourceManager will 6 6 return a void pointer to the desired resource. 7 7 Otherwise it will instruct the coresponding resource-loader to load, … … 9 9 10 10 it is possible to compile the resource Manager without some modules by 11 just adding the compile flag -D.... 11 just adding the compile flag -D.... 12 12 (NO_MODEL) 13 13 (NO_AUDIO) … … 23 23 #include "stdlibincl.h" 24 24 25 // FORWARD DEFINITION 25 // FORWARD DEFINITION 26 26 template<class T> class tList; 27 27 28 28 //! An eumerator for different fileTypes the resourceManager supports 29 typedef enum ResourceType { 29 typedef enum ResourceType 30 { 30 31 #ifndef NO_MODEL 31 32 OBJ, //!< loading .obj file … … 46 47 }; 47 48 48 //! An enumerator for different UNLOAD-types. 49 //! An enumerator for different UNLOAD-types. 49 50 /** 50 51 RP_NO: will be unloaded on request … … 53 54 RP_GAME: will be unloaded at the end of the whole Game (when closing orxonox) 54 55 */ 55 typedef enum ResourcePriority { RP_NO = 0, 56 RP_LEVEL = 1, 57 RP_CAMPAIGN = 2, 58 RP_GAME = 4 }; 56 typedef enum ResourcePriority 57 { 58 RP_NO = 0, 59 RP_LEVEL = 1, 60 RP_CAMPAIGN = 2, 61 RP_GAME = 4 62 }; 59 63 60 64 //! A Struct that keeps track about A resource its name its Type, and so on … … 63 67 void* pointer; //!< Pointer to the Resource. 64 68 int count; //!< How many times this Resource has been loaded. 65 69 66 70 char* name; //!< Name of the Resource. 67 71 ResourceType type; //!< ResourceType of this Resource. … … 84 88 //! The ResourceManager is a class, that decides if a file/resource should be loaded 85 89 /** 86 If a file/resource was already loaded the resourceManager will 90 If a file/resource was already loaded the resourceManager will 87 91 return a void pointer to the desired resource. 88 92 Otherwise it will instruct the corresponding resource-loader to load, … … 91 95 It does it by looking, if a desired file has already been loaded. 92 96 */ 93 class ResourceManager : public BaseObject 97 class ResourceManager : public BaseObject 94 98 { 95 99 public: … … 105 109 bool addImageDir(const char* imageDir); 106 110 void* load(const char* fileName, ResourcePriority prio = RP_NO, 107 111 void* param1 = NULL, void* param2 = NULL, void* param3 = NULL); 108 112 void* load(const char* fileName, ResourceType type, ResourcePriority prio = RP_NO, 109 113 void* param1 = NULL, void* param2 = NULL, void* param3 = NULL); 110 114 bool unload(void* pointer, ResourcePriority prio = RP_NO); 111 115 bool unload(Resource* resource, ResourcePriority = RP_NO); 112 116 bool unloadAllByPriority(ResourcePriority prio); 113 117 114 118 void debug(void); 115 119 116 120 117 121 // utility functions of this class … … 127 131 128 132 Resource* locateResourceByInfo(const char* fileName, ResourceType type, void* param1, void* param2, void* param3); 129 Resource* locateResourceByPointer(const void* pointer); 133 Resource* locateResourceByPointer(const void* pointer); 130 134 131 135 private:
Note: See TracChangeset
for help on using the changeset viewer.