Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6646 in orxonox.OLD for trunk


Ignore:
Timestamp:
Jan 21, 2006, 5:48:00 PM (19 years ago)
Author:
bensch
Message:

trunk: ResourceManeger names

Location:
trunk/src/util/loading
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/util/loading/resource_manager.cc

    r6645 r6646  
    10081008const char* ResourceManager::ResourceTypeToChar(ResourceType type)
    10091009{
    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 */
     1018ResourceType 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 */
     1030const char* ResourceManager::resourceNames[] =
     1031{
    10121032#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",
    10221036#endif
    10231037#ifndef NO_TEXTURES
    1024   case IMAGE:
    1025     return "ImageFile (Texture)";
    1026     break;
     1038  "Texture",
    10271039#endif
    10281040#ifndef NO_AUDIO
    1029   case WAV:
    1030     return "SoundFile";
    1031     break;
    1032   case OGG:
    1033     return "MusicFile";
    1034     break;
     1041  "Sound",
     1042  "Music",
    10351043#endif
    10361044#ifndef NO_TEXT
    1037   case TTF:
    1038     return "Font (TTF)";
    1039     break;
     1045  "Font",
    10401046#endif
    10411047#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  
    4747  SHADER,               //!< openGL-shader program
    4848#endif /* NO_SHADERS */
     49  RESOURCE_TYPE_SIZE
    4950};
    5051
     
    132133
    133134  static const char* ResourceTypeToChar(ResourceType type);
    134 
     135  static ResourceType stringToResourceType(const char* resourceType);
    135136
    136137 private:
     
    146147
    147148  std::vector<Resource*>   resourceList;       //!< The List of Resources, that has already been loaded.
     149
     150  static const char*       resourceNames[RESOURCE_TYPE_SIZE];
    148151};
    149152
Note: See TracChangeset for help on using the changeset viewer.