Rev | Line | |
---|
[4838] | 1 | /*! |
---|
[7193] | 2 | * @file resource.h |
---|
[7195] | 3 | * @brief Definition of a Resource. |
---|
[3245] | 4 | */ |
---|
[1853] | 5 | |
---|
[7193] | 6 | #ifndef _RESOURCE_H |
---|
| 7 | #define _RESOURCE_H |
---|
[1853] | 8 | |
---|
[3543] | 9 | #include "base_object.h" |
---|
[7193] | 10 | #include "multi_type.h" |
---|
[7195] | 11 | #include <string> |
---|
[1853] | 12 | |
---|
[4838] | 13 | // FORWARD DECLARATION |
---|
[3543] | 14 | |
---|
| 15 | |
---|
[2036] | 16 | |
---|
[7195] | 17 | //! An enumerator for different (UN)LOAD-types. |
---|
| 18 | /** |
---|
| 19 | * RP_NO: will be unloaded on request |
---|
| 20 | * RP_LEVEL: will be unloaded at the end of a Level |
---|
| 21 | * RP_CAMPAIGN: will be unloaded at the end of a Campaign |
---|
| 22 | * RP_GAME: will be unloaded at the end of the whole Game (when closing orxonox) |
---|
| 23 | */ |
---|
| 24 | typedef enum ResourcePriority |
---|
| 25 | { |
---|
| 26 | RP_NO = 0, |
---|
| 27 | RP_LEVEL = 1, |
---|
| 28 | RP_CAMPAIGN = 2, |
---|
| 29 | RP_GAME = 3 |
---|
| 30 | }; |
---|
| 31 | |
---|
| 32 | |
---|
| 33 | |
---|
| 34 | //! A Resource is an Object, that can be loaded from Disk |
---|
| 35 | /** |
---|
| 36 | * |
---|
| 37 | */ |
---|
[7193] | 38 | class Resource : virtual public BaseObject { |
---|
[1853] | 39 | |
---|
[1904] | 40 | public: |
---|
[7195] | 41 | Resource(const std::string& fileName); |
---|
[7193] | 42 | virtual ~Resource(); |
---|
[1853] | 43 | |
---|
[7195] | 44 | virtual bool load(std::string& fileName, const MultiType& param1, const MultiType& param2); |
---|
[7193] | 45 | virtual bool reload(); |
---|
| 46 | virtual bool unload(); |
---|
[3245] | 47 | |
---|
| 48 | private: |
---|
[7195] | 49 | std::string fileName; |
---|
[3245] | 50 | |
---|
[7195] | 51 | unsigned int referenceCount; //!< How many times this Resource has been loaded. |
---|
| 52 | /// TODO REMOVE THIS: ResourceType type; //!< ResourceType of this Resource. |
---|
| 53 | ResourcePriority prio; //!< The Priority of this resource. (can only be increased, so noone else will delete this) |
---|
| 54 | |
---|
| 55 | MultiType param[3]; //!< The Parameters given to this Resource. |
---|
[1853] | 56 | }; |
---|
| 57 | |
---|
[7193] | 58 | #endif /* _RESOURCE_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.