#include <resource.h>

Public Types | |
| enum | Type { RES_SOUND, RES_SOUND_RESOURCE, RES_TEXTURE, RES_MESH, RES_MODEL, RES_ANIMATION, RES_FONT, RES_OTHER, RES_COUNT, RES_ALL, RES_INVALID } |
| Resource type. More... | |
Public Member Functions | |
| Resource (const char *id) | |
| virtual | ~Resource () |
| bool | Load () |
| void | Unload () |
| Type | GetType () const |
| bool | TestType (Type t) const |
| bool | IsLoaded () const |
| void | SetFileName (const string &file_name) |
| const string & | GetFileName () const |
| void | SetDataFile (DataFile *data_file) |
| DataFile * | GetDataFile () const |
| virtual ulong_t | GetDataSize () |
| uint_t | GetUniqueId () const |
Protected Member Functions | |
| virtual bool | LoadResource () |
| virtual void | UnloadResource () |
Protected Attributes | |
| Type | type |
| bool | loaded |
| string | file_name |
| File name to load. | |
| DataFile * | data_file |
| Data file will be used insted of file name. | |
| uint_t | unique_id |
| Ref< ResourceServer > | res_server |
Friends | |
| class | ResourceServer |
| enum Resource::Type |
Resource type.
| RES_SOUND | A non-shared sound (Sound). |
| RES_SOUND_RESOURCE | A shared sound resource (SoundResource). |
| RES_TEXTURE | A texture object. |
| RES_MESH | A mesh object. |
| RES_MODEL | A model object. |
| RES_ANIMATION | An animation. |
| RES_FONT | Font data. |
| RES_OTHER | Something else. |
| RES_COUNT | Count of types. |
| RES_ALL | Means all types. |
| RES_INVALID | Invalid type. |
| Resource::Resource | ( | const char * | id | ) |
Constructor.
| Resource::~Resource | ( | ) | [virtual] |
Destructor.
| bool Resource::Load | ( | ) |
Requests to load a resource. Invoke the LoadResource() method which should be overriden by subclasses to implement the actual loading.
Pozn. Load() je oddelene od LoadResource() aby bolo mozne urobit nacitavanie na pozadi. V takomto pripade Load() iba prida job a nic viac. Ked sa job dostane na rad, zavola sa LoadResource().
True if all ok. | void Resource::Unload | ( | ) |
Unload the resource data, freeing runtime resources. This method will call the protected virtual UnloadResources() method which should be overriden by subclasses.
| Resource::Type Resource::GetType | ( | ) | const [inline] |
Gets the resource type.
| bool Resource::TestType | ( | Type | t | ) | const [inline] |
Tests the resource type.
True if tested type is same as current type. | bool Resource::IsLoaded | ( | ) | const [inline] |
| void Resource::SetFileName | ( | const string & | file_name | ) | [inline] |
Sets path to the resource file.
| file_name | Path to the resource file. |
| const string & Resource::GetFileName | ( | ) | const [inline] |
| void Resource::SetDataFile | ( | DataFile * | data_file | ) | [inline] |
| DataFile * Resource::GetDataFile | ( | ) | const [inline] |
| ulong_t Resource::GetDataSize | ( | ) | [virtual] |
Return an estimated byte size of the resource data. This is only used for statistics.
Reimplemented in Animation, Mesh, Model, OpenALSound, OpenALSoundResource, OpenGLFont, and OpenGLTexture.
| uint_t Resource::GetUniqueId | ( | ) | const [inline] |
Returns the unique id of this resource object. You should use the unique id to check whether 2 resources are identical instead of comparing their pointers.
| bool Resource::LoadResource | ( | ) | [protected, virtual] |
Subclasses must override this method and implement the actual resource loading code here. The method may get called from a thread (if the class returns true in the CanLoadAsync() method and the resource object works in async mode).
Reimplemented in Model, SerializedResource, OpenALSound, OpenALSoundResource, OpenGLFont, and OpenGLTexture.
| void Resource::UnloadResource | ( | ) | [protected, virtual] |
Subclasses must override this method and implement the resource unloading. This method will always run in the main thread.
Reimplemented in SerializedResource, OpenALSound, OpenALSoundResource, OpenGLFont, and OpenGLTexture.
friend class ResourceServer [friend] |
Type Resource::type [protected] |
Reimplemented in Animation.
bool Resource::loaded [protected] |
string Resource::file_name [protected] |
File name to load.
DataFile* Resource::data_file [protected] |
Data file will be used insted of file name.
uint_t Resource::unique_id [protected] |
Ref<ResourceServer> Resource::res_server [protected] |
1.5.3