Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 27, 2005, 7:44:39 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: resource manager working, player uses it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/util/resource_manager.h

    r3655 r3658  
    1515
    1616// FORWARD DEFINITION \\
     17//template<class T> class tList;
     18#include "list.h"                //! \todo do this by forward definition (ask Patrick)
     19enum ResourceType {OBJ, PRIM, WAV, MP3, OGG, IMAGE};
    1720
     21struct Resource
     22{
     23  void* pointer;             //!< Pointer to the Resource.
     24 
     25  char* name;                //!< Name of the Resource.
     26  ResourceType type;         //!< ResourceType of this Resource.
     27  int count;                 //!< How many times this Resource has been loaded.
     28};
    1829
    19 enum ResourceType {OBJ, WAV, MP3, OGG, IMAGE};
    2030
    2131//! The ResourceManager is a class, that decides if a file/resource should be loaded
     
    3444  virtual ~ResourceManager();
    3545
    36   bool setDataDir(char* dataDir);
     46  static bool setDataDir(char* dataDir);
     47  static bool addImageDir(char* imageDir);
    3748  static void* load(const char* fileName);
    3849  static void* load(const char* fileName, ResourceType type);
     50  static bool unload(void* pointer);
    3951
    4052 private:
     
    4254  static ResourceManager* singletonRef;
    4355
     56  static tList<Resource>* resourceList;
     57  static char* dataDir;
     58  static tList<char>* imageDirs;
    4459
    45   struct file;
    46   struct folder
    47   {
    48     char* name;
    49     folder** subfolders;             //!<
    50     file** files;                    //!< Files in the directory
    51   };
    52   struct file
    53   {
    54     char* name;                      //!< exact Name of a file
    55     void* pointer;
    56   };
    57 
    58   char* dataDir;                     //!< The main data directory
     60  static Resource* locateResourceByName(const char* fileName);
     61  static Resource* locateResourceByPointer(const void* pointer);
     62 
    5963
    6064  static bool isDir(const char* directory);
Note: See TracChangeset for help on using the changeset viewer.