![]() |
Jopnal Engine
alpha 0.4
Simple Component Based 2D/3D Game Engine
|
Base class for resources. More...
#include <Resource.hpp>
Public Member Functions | |
| Resource (const std::string &name) | |
| Constructor. More... | |
| virtual | ~Resource ()=0 |
| Virtual destructor. More... | |
| const std::string & | getName () const |
| Get the name of this resource. More... | |
| void | setPersistence (const unsigned short level) |
| Set the persistence level. More... | |
| unsigned short | getPersistence () const |
| Get the persistence level. More... | |
Public Member Functions inherited from jop::SafeReferenceable< Resource > | |
| WeakReference< Resource > | getReference () const |
| Get a weak reference to the bound object. More... | |
Public Member Functions inherited from jop::SerializeInfo | |
| SerializeInfo () | |
| void | setSerializePackage (const uint16 package) |
| uint16 | getSerializePackage () const |
| void | setShouldSerialize (const bool set) |
| bool | shouldSerialize () const |
| void | setLightSerializeable (const bool set) |
| bool | isLightSerializeable () const |
Protected Member Functions | |
| Resource (const Resource &other, const std::string &newName) | |
| Copy constructor. More... | |
Protected Member Functions inherited from jop::SafeReferenceable< Resource > | |
| SafeReferenceable (Resource *ref) | |
| Constructor. More... | |
| SafeReferenceable (SafeReferenceable< Resource > &&other) | |
| Move constructor. More... | |
| SafeReferenceable & | operator= (SafeReferenceable< Resource > &&other) |
| Move assignment operator. More... | |
| ~SafeReferenceable () | |
| Protected destructor. More... | |
Friends | |
| class | ResourceManager |
Base class for resources.
It's possible to define special resources in case of load failure, to be returned instead by jop::ResourceManager. To do so, define one or both of the following functions for your derived resource class:
If at least one of these exists, the resource manager will use them to fetch a fallback resource if the load() method fails. Make sure that these functions always succeed, so that they don't cause an infinite recursive loop.
Definition at line 37 of file Resource.hpp.
|
protected |
Copy constructor.
This differs from the standard copy constructor signature. Should you wish your custom resources to be copyable via the resource manager, you should define a copy constructor with an similar signature.
| other | The other resource to copy |
| newName | New name for this resource |
| jop::Resource::Resource | ( | const std::string & | name | ) |
Constructor.
| name | Name of the resource. This must be the file path if this resource is loaded from a file. |
|
pure virtual |
Virtual destructor.
| const std::string& jop::Resource::getName | ( | ) | const |
Get the name of this resource.
| unsigned short jop::Resource::getPersistence | ( | ) | const |
| void jop::Resource::setPersistence | ( | const unsigned short | level | ) |
Set the persistence level.
The persistence level controls how resources are unloaded by the resource manager.
| level | The persistence level |
|
friend |
Definition at line 43 of file Resource.hpp.
1.8.11