Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 25, 2006, 2:19:46 PM (18 years ago)
Author:
patrick
Message:

branches: removed spaceshipcontrol branche

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/util/loading/resource_manager.h

    r6633 r6693  
    1414    (NO_TEXT)
    1515    (NO_TEXTURES)
     16    (NO_SHADERS)
    1617*/
    1718
     
    2021
    2122#include "base_object.h"
     23#include "multi_type.h"
    2224
    23 
    24 #include <list>
     25#include <vector>
    2526
    2627//! An eumerator for different fileTypes the resourceManager supports
     
    4647  SHADER,               //!< openGL-shader program
    4748#endif /* NO_SHADERS */
     49  RESOURCE_TYPE_SIZE
    4850};
    4951
     
    7375  ResourcePriority  prio;              //!< The Priority of this resource. (This will only be increased)
    7476
    75   // more specific
    76   union {
    77 #ifndef NO_MODEL
    78   float             modelSize;         //!< the size of the model (OBJ/PRIM)
    79   char*             secFileName;       //!< a seconf fileName
    80 #endif /* NO_MODEL */
    81 #ifndef NO_TEXT
    82   unsigned int      ttfSize;           //!< the size of the ttf-font (TTF)
    83 #endif /* NO_TEXT */
    84 #ifndef NO_TEXTURES
    85   GLenum            texTarget;
    86 #endif /* NO_TEXTURES */
    87   };
     77  MultiType         param[3];          //!< The Parameters given to this Resource.
    8878};
    8979
     
    114104  bool verifyDataDir(const char* fileInside);
    115105  bool addImageDir(const char* imageDir);
     106
     107  bool cache(const char* fileName, ResourceType type, ResourcePriority prio = RP_NO,
     108             const MultiType& param0 = MultiType(), const MultiType& param1 = MultiType(), const MultiType& param2 = MultiType());
     109  BaseObject* copy(BaseObject* resourcePointer);
     110
    116111  BaseObject* load(const char* fileName, ResourcePriority prio = RP_NO,
    117                void* param1 = NULL, void* param2 = NULL, void* param3 = NULL);
     112                   const MultiType& param0 = MultiType(), const MultiType& param1 = MultiType(), const MultiType& param2 = MultiType());
    118113  BaseObject* load(const char* fileName, ResourceType type, ResourcePriority prio = RP_NO,
    119                void* param1 = NULL, void* param2 = NULL, void* param3 = NULL);
    120   bool unload(void* pointer, ResourcePriority prio = RP_NO);
     114                   const MultiType& param0 = MultiType(), const MultiType& param1 = MultiType(), const MultiType& param2 = MultiType());
     115  bool unload(BaseObject* pointer, ResourcePriority prio = RP_NO);
    121116  bool unload(Resource* resource, ResourcePriority = RP_NO);
    122117  bool unloadAllByPriority(ResourcePriority prio);
    123118
    124   Resource* locateResourceByInfo(const char* fileName, ResourceType type, void* param1, void* param2, void* param3) const;
     119  Resource* locateResourceByInfo(const char* fileName, ResourceType type,
     120                                 const MultiType& param0 = MultiType(), const MultiType& param1 = MultiType(), const MultiType& param2 = MultiType()) const;
    125121  Resource* locateResourceByPointer(const void* pointer) const;
     122
     123  char* toResourcableString(unsigned int i);
     124  bool fromResourceableString(const char* resourceableString);
     125  /** @returns the Count of Resources the ResourceManager handles */
     126  unsigned int resourceCount() const { return this->resourceList.size(); }
    126127
    127128  void debug() const;
     
    138139
    139140  static const char* ResourceTypeToChar(ResourceType type);
    140 
     141  static ResourceType stringToResourceType(const char* resourceType);
    141142
    142143 private:
    143144  ResourceManager();
     145  Resource* loadResource(const char* fileName, ResourceType type, ResourcePriority prio,
     146                         const MultiType& param0, const MultiType& param1, const MultiType& param2);
    144147
    145148 private:
     
    147150
    148151  char*                    dataDir;            //!< The Data Directory, where all relevant Data is stored.
    149   std::list<Resource*>     resourceList;       //!< The List of Resources, that has already been loaded.
    150   std::list<char*>         imageDirs;          //!< A list of directories in which images are stored.
     152  std::vector<char*>       imageDirs;          //!< A list of directories in which images are stored.
    151153
     154  std::vector<Resource*>   resourceList;       //!< The List of Resources, that has already been loaded.
     155
     156  static const char*       resourceNames[RESOURCE_TYPE_SIZE];
    152157};
    153158
Note: See TracChangeset for help on using the changeset viewer.