- Timestamp:
- Jun 2, 2005, 1:21:18 AM (19 years ago)
- Location:
- orxonox/trunk/src/util
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/util/resource_manager.cc
r4463 r4465 167 167 /** 168 168 \brief loads resources 169 \param fileName The fileName of the resource to load 170 \param prio The ResourcePriority of this resource (will only be increased) 169 \param fileName: The fileName of the resource to load 170 \param prio: The ResourcePriority of this resource (will only be increased) 171 \param param1: an additional option to parse (see the constuctors for more help) 172 \param param2: an additional option to parse (see the constuctors for more help) 173 \param param3: an additional option to parse (see the constuctors for more help) 171 174 \returns a pointer to a desired Resource. 172 175 */ … … 201 204 /** 202 205 \brief loads resources 203 \param fileName The fileName of the resource to load 204 \param type The Type of Resource to load (\see ResourceType) 205 \param prio The ResourcePriority of this resource (will only be increased) 206 \param fileName: The fileName of the resource to load 207 \param type: The Type of Resource to load (\see ResourceType) 208 \param prio: The ResourcePriority of this resource (will only be increased) 209 \param param1: an additional option to parse (see the constuctors for more help) 210 \param param2: an additional option to parse (see the constuctors for more help) 211 \param param3: an additional option to parse (see the constuctors for more help) 206 212 \returns a pointer to a desired Resource. 207 213 */ 208 void* ResourceManager::load(const char* fileName, ResourceType type, ResourcePriority prio, void* param1, void* param2, void* param3) 214 void* ResourceManager::load(const char* fileName, ResourceType type, ResourcePriority prio, 215 void* param1, void* param2, void* param3) 209 216 { 210 217 // searching if the resource was loaded before. … … 357 364 /** 358 365 \brief unloads a Resource 359 \param pointer The pointer to free 366 \param pointer: The pointer to free 367 \param prio: the PriorityLevel to unload this resource 360 368 \returns true if successful (pointer found, and deleted), false otherwise 361 362 369 */ 363 370 bool ResourceManager::unload(void* pointer, ResourcePriority prio) … … 374 381 } 375 382 383 /** 384 \brief unloads a Resource 385 \param resource: The resource to unloade 386 \param prio the PriorityLevel to unload this resource 387 */ 376 388 bool ResourceManager::unload(Resource* resource, ResourcePriority prio) 377 389 { … … 441 453 /** 442 454 \brief Searches for a Resource by some information 443 \param fileName The name to look for 455 \param fileName: The name to look for 456 \param type the Type of resource to locate. 457 \param param1: an additional option to parse (see the constuctors for more help) 458 \param param2: an additional option to parse (see the constuctors for more help) 459 \param param3: an additional option to parse (see the constuctors for more help) 444 460 \returns a Pointer to the Resource if found, NULL otherwise. 445 461 */ … … 659 675 660 676 /** 661 \param fileName the Name of the file to check677 \param name the Name of the file to check 662 678 \returns The name of the file, including the HomeDir 663 679 IMPORTANT: this has to be deleted from the outside -
orxonox/trunk/src/util/resource_manager.h
r4462 r4465 20 20 21 21 //! An eumerator for different fileTypes the resourceManager supports 22 typedef enum ResourceType { OBJ, 23 PRIM, 24 MD2, 25 WAV, 26 MP3, 27 OGG, 28 TTF, 29 IMAGE }; 22 typedef enum ResourceType { OBJ, //!< loading .obj file 23 PRIM, //!< loading primitive model 24 MD2, //!< loading md2-file 25 WAV, //!< loading wav 26 MP3, //!< loading mp3 27 OGG, //!< loading ogg 28 TTF, //!< loading a TrueTypeFont 29 IMAGE }; //!< loading an image 30 30 31 31 //! An enumerator for different UNLOAD-types. … … 44 44 struct Resource 45 45 { 46 void* pointer;//!< Pointer to the Resource.47 int count;//!< How many times this Resource has been loaded.46 void* pointer; //!< Pointer to the Resource. 47 int count; //!< How many times this Resource has been loaded. 48 48 49 char* name;//!< Name of the Resource.50 ResourceType type;//!< ResourceType of this Resource.51 ResourcePriority prio;//!< The Priority of this resource. (This will only be increased)49 char* name; //!< Name of the Resource. 50 ResourceType type; //!< ResourceType of this Resource. 51 ResourcePriority prio; //!< The Priority of this resource. (This will only be increased) 52 52 53 53 // more specific 54 float modelSize;55 unsigned int ttfSize;56 unsigned char ttfColorR;57 unsigned char ttfColorG;58 unsigned char ttfColorB;59 char* skinFileName;54 float modelSize; //!< the size of the model (OBJ/PRIM) 55 unsigned int ttfSize; //!< the size of the ttf-font (TTF) 56 unsigned char ttfColorR; //!< red Color (TTF) 57 unsigned char ttfColorG; //!< green Color (TTF) 58 unsigned char ttfColorB; //!< blue Color (TTF) 59 char* skinFileName; //!< skinFileName (MD2) 60 60 }; 61 61 … … 73 73 { 74 74 public: 75 virtual ~ResourceManager(); 76 75 77 static ResourceManager* getInstance(); 76 virtual ~ResourceManager();77 78 78 79 bool setDataDir(const char* dataDir); … … 89 90 bool unload(Resource* resource, ResourcePriority = RP_NO); 90 91 bool unloadAllByPriority(ResourcePriority prio); 91 92 92 93 void debug(void); 94 93 95 94 96 // utility functions of this class … … 102 104 private: 103 105 ResourceManager(); 104 static ResourceManager* singletonRef;105 106 tList<Resource>* resourceList; //!< The List of Resources, that has already been loaded.107 char* dataDir; //!< The Data Directory, where all relevant Data is stored.108 tList<char>* imageDirs; //!< A list of directories in which images are stored.109 110 106 111 107 Resource* locateResourceByInfo(const char* fileName, ResourceType type, void* param1, void* param2, void* param3); 112 Resource* locateResourceByPointer(const void* pointer); 113 108 Resource* locateResourceByPointer(const void* pointer); 109 110 private: 111 static ResourceManager* singletonRef; //!< singleton Reference 112 113 tList<Resource>* resourceList; //!< The List of Resources, that has already been loaded. 114 char* dataDir; //!< The Data Directory, where all relevant Data is stored. 115 tList<char>* imageDirs; //!< A list of directories in which images are stored. 116 114 117 }; 115 118
Note: See TracChangeset
for help on using the changeset viewer.