- Timestamp:
- Jan 21, 2006, 5:48:00 PM (19 years ago)
- Location:
- trunk/src/util/loading
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/util/loading/resource_manager.cc
r6645 r6646 1008 1008 const char* ResourceManager::ResourceTypeToChar(ResourceType type) 1009 1009 { 1010 switch (type) 1011 { 1010 return ResourceManager::resourceNames[type]; 1011 } 1012 1013 /** 1014 * @brief converts a String into a ResourceType (good for loading) 1015 * @param resourceType the name of the Type 1016 * @returns the Number of the Type, or 0 (defautl) if not found. 1017 */ 1018 ResourceType ResourceManager::stringToResourceType(const char* resourceType) 1019 { 1020 assert(resourceType != NULL); 1021 for (unsigned int i = 0; i < RESOURCE_TYPE_SIZE; i++) 1022 if (!strcmp(resourceType, ResourceManager::resourceNames[i])) 1023 return (ResourceType)i; 1024 return (ResourceType)0; 1025 } 1026 1027 /** 1028 * The Names of the ResourceTypes 1029 */ 1030 const char* ResourceManager::resourceNames[] = 1031 { 1012 1032 #ifndef NO_MODEL 1013 case OBJ: 1014 return "ObjectModel"; 1015 break; 1016 case PRIM: 1017 return "PrimitiveModel"; 1018 break; 1019 case MD2: 1020 return "MD2-Data"; 1021 break; 1033 "ObjectModel", 1034 "PrimitiveModel", 1035 "MD2-Data", 1022 1036 #endif 1023 1037 #ifndef NO_TEXTURES 1024 case IMAGE: 1025 return "ImageFile (Texture)"; 1026 break; 1038 "Texture", 1027 1039 #endif 1028 1040 #ifndef NO_AUDIO 1029 case WAV: 1030 return "SoundFile"; 1031 break; 1032 case OGG: 1033 return "MusicFile"; 1034 break; 1041 "Sound", 1042 "Music", 1035 1043 #endif 1036 1044 #ifndef NO_TEXT 1037 case TTF: 1038 return "Font (TTF)"; 1039 break; 1045 "Font", 1040 1046 #endif 1041 1047 #ifndef NO_SHADERS 1042 case SHADER: 1043 return "Shader"; 1044 break; 1045 #endif 1046 default: 1047 return "unknown Format"; 1048 break; 1049 } 1050 } 1048 "Shader", 1049 #endif 1050 }; -
trunk/src/util/loading/resource_manager.h
r6645 r6646 47 47 SHADER, //!< openGL-shader program 48 48 #endif /* NO_SHADERS */ 49 RESOURCE_TYPE_SIZE 49 50 }; 50 51 … … 132 133 133 134 static const char* ResourceTypeToChar(ResourceType type); 134 135 static ResourceType stringToResourceType(const char* resourceType); 135 136 136 137 private: … … 146 147 147 148 std::vector<Resource*> resourceList; //!< The List of Resources, that has already been loaded. 149 150 static const char* resourceNames[RESOURCE_TYPE_SIZE]; 148 151 }; 149 152
Note: See TracChangeset
for help on using the changeset viewer.