Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 29, 2005, 11:50:51 AM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: now ResourceManager has the ability to unload resources by priority

File:
1 edited

Legend:

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

    r3658 r3660  
    1717//template<class T> class tList;
    1818#include "list.h"                //! \todo do this by forward definition (ask Patrick)
     19
     20//! An eumerator for different fileTypes the resourceManager supports \todo WAV, MP3, OGG support
    1921enum ResourceType {OBJ, PRIM, WAV, MP3, OGG, IMAGE};
     22//! An enumerator for different UNLOAD-types.
     23/**
     24   RP_NO: will be unloaded on request
     25   RP_LEVEL: will be unloaded at the end of a Level
     26   RP_CAMPAIGN: will be unloaded at the end of a Campaign
     27   RP_GAME: will be unloaded at the end of the whole Game (when closing orxonox)
     28*/
     29enum ResourcePriority {RP_NO = 0, RP_LEVEL = 1, RP_CAMPAIGN = 2, RP_GAME = 3};
    2030
     31//! A Struct that keeps track about A resource its name its Type, and so on
    2132struct Resource
    2233{
     
    2536  char* name;                //!< Name of the Resource.
    2637  ResourceType type;         //!< ResourceType of this Resource.
     38  ResourcePriority prio;     //!< The Priority of this resource. (This will only be increased)
    2739  int count;                 //!< How many times this Resource has been loaded.
    2840};
     
    4658  static bool setDataDir(char* dataDir);
    4759  static bool addImageDir(char* imageDir);
    48   static void* load(const char* fileName);
    49   static void* load(const char* fileName, ResourceType type);
    50   static bool unload(void* pointer);
     60  static void* load(const char* fileName, ResourcePriority prio = RP_NO);
     61  static void* load(const char* fileName, ResourceType type, ResourcePriority prio = RP_NO);
     62  static bool unload(void* pointer, ResourcePriority prio = RP_NO);
     63  static bool unload(Resource* resource, ResourcePriority = RP_NO);
     64  static bool unloadAllByPriority(ResourcePriority prio);
    5165
    5266 private:
     
    6175  static Resource* locateResourceByPointer(const void* pointer);
    6276 
    63 
    6477  static bool isDir(const char* directory);
    6578  static bool isFile(const char* directory); 
Note: See TracChangeset for help on using the changeset viewer.